/** * 游戏背景绘制 * * @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 draw(GLEx g, int tx, int ty) { next(); int x = t_x - tx; int y = t_y - ty; g.setColor(LColor.black); if (super.frame < 40) { for (int i = 0; i < sd.length; i++) { sd[i].drawPaint(g, x, (LSystem.screenRect.height - y)); } } else { int r = ((super.frame - 40) * 220) / 40; g.setColor(r, 0, 0); sd[0].drawPaint(g, x, (LSystem.screenRect.height - y)); } if (super.frame > 80) { setExist(false); } }
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(); } }
@Override public void draw(GLEx g, int x, int y) { next(); g.setColor(color); for (int j = 0; j < arrow.length; j++) { arrow[j].drawPaint(g, s_x - x, (LSystem.screenRect.height - (s_y - y))); } if (super.frame >= max) { setExist(false); } }
@Override public void createUI(GLEx g, int x, int y, LComponent component, LTexture[] buttonImage) { LFont font = g.getFont(); int color = g.getColorARGB(); if (batch != null) { batch.begin(); draw(batch, mainX + x, mainY + y); batch.end(); } g.setColor(color); g.setFont(font); }
public void paint(GLEx g, Object value, int x, int y, int width, int height) { if (value instanceof BindIcon) { int size = font.getHeight() - 4; BindIcon icon = (BindIcon) value; String s = icon.name; s = font.confineLength(s, width - size - 4); int entryOffset = 4 + alignment.alignX(width - 4, font.stringWidth(s)); g.setFont(font); g.setColor(textColor); if (icon.texture != null) { g.drawTexture(icon.texture, x + 4, y + (font.getHeight() - size) / 2, size, size); g.drawString(s, x + size + entryOffset + 4, y + font.getHeight() - 4); } else { g.drawString(s, x + entryOffset, y + font.getHeight() - 4); } } else { String s = value.toString(); s = font.confineLength(s, width - 4); int entryOffset = 4 + alignment.alignX(width - 4, font.stringWidth(s)); g.setFont(font); g.setColor(textColor); g.drawString(s, x + entryOffset, y + font.getHeight() - 4); } }
@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); } }
public final synchronized void draw(GLEx g) { background(g); if (isOnLoadComplete()) { if (spriteLength == 0) { return; } bitmapPack.glBegin(); for (int j = 0; j < spriteLength; ++j) { if (spriteList == null) { continue; } final int id = spriteList[j]; STGPlane plane = planes.get(id); if (plane == null) { continue; } if (onDrawPlane(g, id)) { continue; } if (plane.view) { if (plane.planeMode == GRP_MODE) { if (plane.animation) { if (plane.delay.action(elapsedTime)) { int index; for (index = 0; plane.animeList[index] != plane.animeNo; ++index) {; } index = (index + 1) % plane.animeList.length; plane.animeNo = plane.animeList[index]; } } if (plane.scaleX == 1 && plane.scaleY == 1) { bitmapPack.draw( plane.images.get(plane.animeNo), plane.posX, plane.posY, plane.rotation, plane.drawColor); } else { bitmapPack.draw( plane.images.get(plane.animeNo), plane.posX, plane.posY, plane.rect.width * plane.scaleX, plane.rect.height * plane.scaleY, plane.rotation, plane.drawColor); } } else if (plane.planeMode == STR_MODE) { g.setFont(plane.font); g.setColor(plane.color); g.drawString(plane.str, plane.posX, plane.posY + plane.font.getSize()); } else if (plane.planeMode == CENTER_STR_MODE) { g.setFont(plane.font); g.setColor(plane.color); g.drawString( plane.str, plane.posX - plane.font.stringWidth(plane.str) / 2, plane.posY + plane.font.getSize()); } else if (plane.planeMode == DRW_MODE) { plane.draw.paint(g, plane); } } } bitmapPack.glEnd(); } foreground(g); }