/** * 游戏背景绘制 * * @param g */ protected void background(GLEx g) { switch (backgroundMode) { case BACK_STAR_MODE: if (starColor != null) { g.setColor(starColor); } g.glBegin(GL.GL_LINES); for (int j = 0; j < dot_size; this.count = (this.count + 1) % dot_size) { int index = this.dot[this.count] % 3; g.glVertex2f(dot[count] - index, getHeight() - j * 10); g.glVertex2f(dot[count] + index, getHeight() - j * 10); g.glVertex2f(dot[count], getHeight() - j * 10 - index); g.glVertex2f(dot[count], getHeight() - j * 10 + index); ++j; } g.glEnd(); if (starColor != null) { g.resetColor(); } break; case BACK_SCROLL_MODE: if (scroll != null) { scroll.createUI(g); } break; case BACK_OTHER_MODE: drawOtherBackground(g); break; case BACK_EMPTY_MODE: default: break; } }
private void drawString(GLEx g) { int activeNum = getActiveNum(); arrayR[activeNum] = 20; g.setColor(224, 255, 255); for (int j = 0; j < number; j++) { arrayR[j] += 8; g.drawString(message, getShoutX(j) - mesWidth, getShoutY(j) - mesHeight); } g.resetColor(); }
@Override public void createUI(GLEx g) { if (!visible) { return; } if (alpha > 0 && alpha < 1) { g.setAlpha(alpha); } g.setColor(color); for (int i = 0; i < drops.length; ++i) { g.fillOval((int) drops[i].x, (int) drops[i].y, 2, 2); } g.resetColor(); if (alpha > 0 && alpha < 1) { g.setAlpha(1); } }
@Override protected synchronized void createCustomUI(GLEx g, int x, int y, int w, int h) { if (!visible) { return; } LFont oldFont = g.getFont(); g.setFont(messageFont); print.draw(g, fontColor); g.setFont(oldFont); if (print.isComplete() && animation != null) { if (animation.getSpriteImage() != null) { g.setAlpha(1.0F); updateIcon(); g.drawTexture(animation.getSpriteImage(), dx, dy); } } g.resetColor(); }
public synchronized void draw(GLEx g) { if (isExist()) { int i = index; if (max <= i) { i = max - 1; } SRPGMessage mes = getMessage(i); if (listener != null) { listener.drawBackground(i, g); } if (character != null) { g.drawTexture(character, chara_x, chara_y); } LFont font = g.getFont(); if (face != null) { int w = face.getWidth(); int h = face.getHeight(); int x = mes.getX(); int y = mes.getY() - h; g.setColor(LColor.black); g.fillRect(x, y, w, h); g.drawTexture(face, x, y); } g.setFont(mes.getFont()); if (background == null) { LGradation.getInstance(LColor.white, LColor.black, mes.getWidth(), mes.getHeight()) .drawHeight(g, mes.getX(), mes.getY()); g.setColor(LColor.black); g.drawRect(mes.getX(), mes.getY(), mes.getWidth(), mes.getHeight()); } else { g.drawTexture(background, mes.getX(), mes.getY()); } mes.update(delay); g.setColor(LColor.white); mes.draw(g); if (listener != null) { listener.drawForeground(i, g); } g.setFont(font); g.resetColor(); } }
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.size(); emitterIdx++) { ParticleEmitter emitter = emitters.get(emitterIdx); if (!emitter.isEnabled()) { continue; } if (emitter.useAdditive()) { g.setBlendMode(GL.MODE_ALPHA_ONE); } ParticlePool pool = particlesByEmitter.get(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); }