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

📄 imp.java

📁 thq 发布的《worms》 motorola 源代码
💻 JAVA
字号:
import javax.microedition.lcdui.Graphics;
import javax.microedition.lcdui.Image;

public class Imp
{

    public int width;
    public int height;
    public int positionX;
    public int positionY;
    public int curFrame;
    public int frameCount;
    private boolean visible;
    private int drawState;
    public Image image;
    private boolean rendered;
    int tag_cx;
    int tag_cy;
    int tag_cw;
    int tag_ch;

    public void setVisible(boolean flag)
    {
        visible = flag;
    }

    public boolean isVisible()
    {
        return visible;
    }

    public int getFrame()
    {
        return curFrame;
    }

    public int getWidth()
    {
        return width;
    }

    public int getHeight()
    {
        return height;
    }

    public int getPositionX()
    {
        return positionX;
    }

    public int getPositionY()
    {
        return positionY;
    }

    public int getFrameCount()
    {
        return frameCount;
    }

    public Imp(String s, int i)
    {
        curFrame = 0;
        visible = true;
        drawState = 0;
        rendered = false;
        try
        {
            image = Image.createImage(s);
            frameCount = i;
            width = image.getWidth() / i;
            height = image.getHeight();
        }
        catch(Exception exception)
        {
            exception.printStackTrace();
        }
    }

    public void setPosition(int i, int j)
    {
        positionX = i;
        positionY = j;
    }

    public void setFrame(int i)
    {
        curFrame = i;
    }

    public void setDrawState(int i)
    {
        drawState = i;
    }

    public int getDrawState()
    {
        return drawState;
    }

    public void paint(Graphics g)
    {
        if(!visible)
            return;
        tag_cx = g.getClipX();
        tag_cy = g.getClipY();
        tag_cw = g.getClipWidth();
        tag_ch = g.getClipHeight();
        if(drawState == 0)
        {
            g.setClip(positionX, positionY, width, height);
            g.drawImage(image, positionX - curFrame * width, positionY, 20);
        } else
        {
            for(byte byte0 = 0; byte0 < width; byte0++)
            {
                g.setClip(positionX + (width - byte0), positionY, 1, height);
                g.drawImage(image, (positionX - curFrame * width) + (width - byte0 * 2), positionY, 20);
            }

        }
        g.setClip(tag_cx, tag_cy, tag_cw, tag_ch);
    }

    public void paintRaw(Graphics g)
    {
        if(!visible)
        {
            return;
        } else
        {
            g.drawImage(image, positionX - curFrame * width, positionY, 20);
            return;
        }
    }
}

⌨️ 快捷键说明

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