예제 #1
0
 private RectBox rect() {
   STGPlane plane = stg.planes.get(plnNo);
   if (plane == null) {
     return null;
   }
   RectBox rect = plane.rect;
   if (rect == null && hitW != 0 && hitH != 0) {
     plane.rect = new RectBox(0, 0, hitW, hitH);
   } else if (rect == null) {
     return null;
   }
   rect.setX(plane.posX);
   rect.setY(plane.posY);
   if (hitW == 0) {
     hitW = (int) (rect.width * plane.scaleX);
   } else {
     rect.width = hitW;
   }
   if (hitH == 0) {
     hitH = (int) (rect.height * plane.scaleY);
   } else {
     rect.height = hitH;
   }
   return rect;
 }
예제 #2
0
 boolean setPlaneAnime(int index, boolean anime) {
   STGPlane plane = planes.get(index);
   if (plane == null) {
     return false;
   } else if (plane.planeMode != GRP_MODE) {
     return false;
   } else {
     if (plane.animation = anime) {
       if (plane.animeList == null || (plane.animeList.length != plane.images.size())) {
         plane.animeList = new int[plane.images.size()];
       }
       Enumeration<?> enumeration = plane.images.keys();
       for (int j = 0; enumeration.hasMoreElements(); ++j) {
         plane.animeList[j] = ((Integer) enumeration.nextElement());
       }
       for (int i = 0; i < plane.animeList.length - 1; ++i) {
         for (int j = i + 1; j < plane.animeList.length; ++j) {
           if (plane.animeList[i] > plane.animeList[j]) {
             int animeNo = plane.animeList[i];
             plane.animeList[i] = plane.animeList[j];
             plane.animeList[j] = animeNo;
           }
         }
       }
     } else {
       plane.animeList = null;
     }
     return true;
   }
 }
예제 #3
0
 boolean setPosY(int index, float y) {
   STGPlane plane = planes.get(index);
   if (plane == null) {
     return false;
   } else {
     plane.posY = y;
     return true;
   }
 }
예제 #4
0
 boolean setPlaneBitmapColor(int index, LColor c) {
   STGPlane plane = planes.get(index);
   if (plane == null) {
     return false;
   } else {
     plane.drawColor = c;
     return true;
   }
 }
예제 #5
0
 boolean setPlaneAngle(int index, float rotation) {
   STGPlane plane = planes.get(index);
   if (plane == null) {
     return false;
   } else {
     plane.rotation = rotation;
     return true;
   }
 }
예제 #6
0
 boolean setPlaneScale(int index, float sx, float sy) {
   STGPlane plane = planes.get(index);
   if (plane == null) {
     return false;
   } else {
     plane.scaleX = sx;
     plane.scaleY = sy;
     return true;
   }
 }
예제 #7
0
 boolean setPlaneMov(int index, float x, float y) {
   STGPlane plane = planes.get(index);
   if (plane == null) {
     return false;
   } else {
     plane.posX += x;
     plane.posY += y;
     return true;
   }
 }
예제 #8
0
 boolean setPlaneView(int index, boolean v) {
   STGPlane plane = planes.get(index);
   if (plane == null) {
     return false;
   } else if ((plane.planeMode & STR_MODE) == 0) {
     return false;
   } else {
     plane.view = v;
     return true;
   }
 }
예제 #9
0
 boolean setPlaneColor(int index, int r, int g, int b) {
   STGPlane plane = planes.get(index);
   if (plane == null) {
     return false;
   } else if ((plane.planeMode & STR_MODE) == 0) {
     return false;
   } else {
     plane.color = new LColor(r, g, b);
     return true;
   }
 }
예제 #10
0
 void setPlaneSize(int index, int w, int h) {
   STGPlane plane = planes.get(index);
   if (plane == null) {
     plane = new STGPlane();
     this.planes.put(index, plane);
   }
   if (plane.rect == null) {
     plane.rect = new RectBox(0, 0, w, h);
   } else {
     plane.rect.setBounds(0, 0, w, h);
   }
 }
예제 #11
0
 boolean setPlaneAnimeDelay(int index, long delay) {
   STGPlane plane = planes.get(index);
   if (plane == null) {
     return false;
   } else if (plane.planeMode != GRP_MODE) {
     return false;
   } else {
     if (plane.delay != null) {
       plane.delay.setDelay(delay);
     } else {
       plane.delay = new LTimer(delay);
     }
     return true;
   }
 }
예제 #12
0
 boolean setPlaneFont(int index, String font, int style, int size) {
   STGPlane plane = planes.get(index);
   if (plane == null) {
     return false;
   } else if ((plane.planeMode & STR_MODE) == 0) {
     return false;
   } else {
     if (font == null) {
       font = LSystem.FONT_NAME;
     }
     if (style < 0) {
       style = 0;
     }
     if (size < 0) {
       size = planeFontSize;
     }
     plane.font = LFont.getFont(font, style, size);
     return true;
   }
 }
예제 #13
0
 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;
 }
예제 #14
0
 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;
 }
예제 #15
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;
 }
예제 #16
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);
 }