Example #1
0
 int addBitmap(LTexture img) {
   try {
     return bitmapPack.putImage(img);
   } catch (Exception e) {
   }
   return -1;
 }
Example #2
0
 int addBitmap(String res) {
   try {
     return bitmapPack.putImage(res);
   } catch (Exception e) {
   }
   return -1;
 }
Example #3
0
 public void dispose() {
   stopShotLoop();
   if (stgObjects != null) {
     stgObjects.dispose();
     stgObjects = null;
   }
   if (bitmapPack != null) {
     bitmapPack.dispose();
     bitmapPack = null;
   }
 }
Example #4
0
 public void createUI(GLEx g, int x, int y, LComponent component, LTexture[] buttonImage) {
   if (Touch.isUp()) {
     freeClick();
   }
   pack.glBegin();
   pack.draw(0, x, y, backWidth, backHeight);
   if (isClick) {
     if (angle < 360) {
       angle += 1;
     } else {
       angle = 0;
     }
     pack.draw(2, x + centerX, y + centerY, dotWidth, dotHeight, angle, null);
   }
   pack.draw(
       1,
       x + (backWidth - baseWidth) * 0.5f,
       y + (backHeight - baseHeight) * 0.5f,
       baseWidth,
       baseHeight);
   pack.glEnd();
 }
Example #5
0
 public final void onLoad() {
   if (bitmapPack != null) {
     bitmapPack.dispose();
     bitmapPack = null;
   }
   if (packXmlName == null) {
     bitmapPack = new LTexturePack();
   } else {
     bitmapPack = new LTexturePack(packXmlName);
   }
   if (commandName != null) {
     this.openCommand(commandName, true);
   }
   final DrawableVisit visit = new DrawableVisit(this);
   this.loadDrawable(visit);
   this.bitmapPack.packed(visit.format);
   this.onLoading();
 }
Example #6
0
 public LPad(int x, int y, LTexturePack p, float scale) {
   super(
       x,
       y,
       (int) (p.getEntry("fore").width() * scale),
       (int) (p.getEntry("fore").height() * scale));
   this.offsetX = 6 * scale;
   this.offsetY = 6 * scale;
   this.pack = p;
   this.dotWidth = (int) (p.getEntry("dot").width() * scale);
   this.dotHeight = (int) (p.getEntry("dot").height() * scale);
   this.baseWidth = (int) (p.getEntry("fore").width() * scale);
   this.baseHeight = (int) (p.getEntry("fore").height() * scale);
   this.backWidth = (int) (p.getEntry("back").width() * scale);
   this.backHeight = (int) (p.getEntry("back").height() * scale);
   this.centerX = (baseWidth - dotWidth) / 2 + offsetX;
   this.centerY = (baseHeight - dotHeight) / 2 + offsetY;
   this.scale_pad = scale;
   p.setFormat(Format.LINEAR);
 }
Example #7
0
 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;
 }
Example #8
0
 public void dispose() {
   super.dispose();
   if (pack != null) {
     pack.dispose();
   }
 }
Example #9
0
 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);
 }