⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sjgspritefa.java

📁 一个基于J2ME的动画引擎框架
💻 JAVA
字号:
package sjg.animation;import java.awt.*;/** * SJGSprite with frame animation. * * @author Christian Hvid */public class SJGSpriteFA extends SJGSprite {    private Animation animation;    private int frame;    protected void setFrame(int frame) {        this.frame = frame;    }    protected int getFrame() {        return frame;    }    protected void nextFrame() {        frame++;    }    protected void prevFrame() {        frame--;    }    protected void reset() {        frame = 0;    }    public int getWidth() {        return animation.getFrame(frame).getWidth();    }    public int getHeight() {        return animation.getFrame(frame).getHeight();    }    protected void setAnimation(Animation animation) {        this.animation = animation;    }    public void draw(Graphics g, View view) {        g.drawImage(animation.getFrame(frame).getImage(),                view.worldToRealX(getX()) - animation.getFrame(frame).getWidth() / 2,                view.worldToRealY(getY()) - animation.getFrame(frame).getHeight() / 2,                null);    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -