public void Draw(GLEx g, int minX, int minY, int maxX, int maxY) { if (!visible) { return; } lock (values) { batch.Begin(); if (alpha > 0 && alpha < 1) { batch.SetAlpha(alpha); } for (int i = 0; i < count; i++) { LTextureObject tex2d = this.values[i]; if (tex2d == null || !tex2d.visible) { continue; } nx = minX + tex2d.x; ny = minY + tex2d.y; if (nx + tex2d.width < minX || nx > maxX || ny + tex2d.height < minY || ny > maxY) { continue; } LTexture texture = tex2d.texture; if (texture == null) { continue; } if (tex2d.width != 0 && tex2d.height != 0) { batch.Draw(texture, tex2d.x, tex2d.y, tex2d.width, tex2d.height); } else { batch.Draw(texture, tex2d.x, tex2d.y); } } if (alpha > 0 && alpha < 1) { batch.ResetColor(); } batch.End(); } }
public void Render(GLEx g, float x, float y) { if (!visible) { return; } if ((sprite == null) && (defaultImageName != null)) { LoadSystemParticleImage(); } g.Translate(x, y); if (blendingMode == BLEND_ADDITIVE) { //GLEx.self.setBlendMode(GL.MODE_ALPHA_ONE); } if (UsePoints()) { //GLEx.gl10.glEnable(GL.GL_POINT_SMOOTH); //g.glTex2DDisable(); } for (int emitterIdx = 0; emitterIdx < emitters.Count; emitterIdx++) { ParticleEmitter emitter = emitters[emitterIdx]; if (!emitter.IsEnabled()) { continue; } if (emitter.UseAdditive()) { //g.setBlendMode(GL.MODE_ALPHA_ONE); } ParticlePool pool = particlesByEmitter[emitter]; LTexture image = emitter.GetImage(); if (image == null) { image = this.sprite; } if (!emitter.IsOriented() && !emitter.UsePoints(this)) { image.GLBegin(); } for (int i = 0; i < pool.particles.Length; i++) { if (pool.particles[i].InUse()) { pool.particles[i].Render(); } } if (!emitter.IsOriented() && !emitter.UsePoints(this)) { image.GLEnd(); } if (emitter.UseAdditive()) { //g.setBlendMode(GL.MODE_NORMAL); } } if (UsePoints()) { //GLEx.gl10.glDisable(GL.GL_POINT_SMOOTH); } if (blendingMode == BLEND_ADDITIVE) { //g.setBlendMode(GL.MODE_NORMAL); } g.ResetColor(); g.Translate(-x, -y); }
public void Draw(GLEx g) { Draw(g, 0, 0, width, height); }
public void Render(GLEx g) { Render(g, x, y); }