boolean setPlaneCenterString(int index, String mes) { STGPlane plane = planes.get(index); if (plane == null) { plane = new STGPlane(); this.planes.put(index, plane); } plane.font = LFont.getFont(LSystem.FONT_NAME, 0, planeFontSize); plane.color = new LColor(0, 0, 0); plane.str = mes; plane.planeMode = CENTER_STR_MODE; plane.view = true; plane.images.clear(); plane.animation = false; plane.animeNo = 0; plane.draw = null; return true; }
boolean setPlaneDraw(int index, Picture draw) { STGPlane plane = planes.get(index); if (plane == null) { plane = new STGPlane(); this.planes.put(index, plane); } plane.font = null; plane.color = null; plane.str = null; plane.planeMode = DRW_MODE; plane.view = true; plane.images.clear(); plane.animation = false; plane.animeNo = 0; plane.draw = draw; return true; }
boolean setPlaneBitmap(int index, int animeNo, int imgId) { if (bitmapPack == null) { return false; } try { STGPlane plane = planes.get(index); if (plane == null) { plane = new STGPlane(); this.planes.put(index, plane); } plane.animeNo = animeNo; plane.rect = bitmapPack.getImageRect(imgId); plane.images.put(plane.animeNo, imgId); plane.planeMode = GRP_MODE; plane.view = true; plane.str = null; plane.font = null; plane.color = null; plane.draw = null; } catch (Exception e) { e.printStackTrace(); } return true; }
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); }