Пример #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();
 }