예제 #1
0
 /**
  * 转化一组Image为动画图像
  *
  * @param images
  * @param maxFrame
  * @param row
  * @param col
  * @param timer
  * @return
  */
 public static Animation getDefaultAnimation(LTexture[] images, int maxFrame, int timer) {
   Animation animation = new Animation();
   if (maxFrame != -1) {
     for (int i = 0; i < maxFrame; i++) {
       animation.addFrame(images[i], timer);
     }
   } else {
     for (int i = 0; i < images.length; i++) {
       animation.addFrame(images[i], timer);
     }
   }
   return animation;
 }
예제 #2
0
 public Bitmap getBitmap() {
   SpriteImage simg = animation.getSpriteImage();
   if (simg != null) {
     return simg.getBitmap();
   }
   return null;
 }
예제 #3
0
 public void dispose() {
   if (gifDecoder != null) {
     gifDecoder = null;
   }
   if (animation != null) {
     animation.dispose();
     animation = null;
   }
 }
예제 #4
0
 public GIFAnimation(String fileName) {
   this.gifDecoder = new GIFDecoder();
   this.gifDecoder.read(fileName);
   RectBox d = gifDecoder.getFrameSize();
   this.width = (int) d.getWidth();
   this.height = (int) d.getHeight();
   this.isVisible = true;
   this.animation = new Animation();
   int delay;
   for (int i = 0; i < gifDecoder.getFrameCount(); i++) {
     delay = gifDecoder.getDelay(i);
     animation.addFrame(gifDecoder.getFrame(i), delay == 0 ? 100 : delay);
   }
 }
예제 #5
0
 /**
  * 转化指定文件为动画图像
  *
  * @param fileName
  * @param maxFrame
  * @param row
  * @param col
  * @param timer
  * @return
  */
 public static Animation getDefaultAnimation(
     String fileName, int maxFrame, int row, int col, int timer) {
   return Animation.getDefaultAnimation(
       TextureUtils.getSplitTextures(fileName, row, col), maxFrame, timer);
 }
예제 #6
0
 public void createUI(LGraphics g) {
   if (isVisible) {
     g.drawImage(animation.getSpriteImage().getImage(), x(), y());
   }
 }
예제 #7
0
 public void update(long elapsedTime) {
   if (isVisible) {
     animation.update(elapsedTime);
   }
 }
예제 #8
0
 public boolean isRunning() {
   return animation.isRunning();
 }
예제 #9
0
 public void setRunning(boolean runing) {
   animation.setRunning(runing);
 }
예제 #10
0
 public float getAlpha() {
   return animation.getAlpha();
 }