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

📄 frame.java

📁 之前有人传过`淘金者的游戏`网上大部分的都没有资源文件的`偶把资源文件和代码一起打包`希望对大家有帮助`
💻 JAVA
字号:
/*
    Marv the Miner for Nokia Series 30, 40 and 60 and for selected MIDP 1.0 supported phones
    Copyright (C) 2003-2004  Digital Entertainment Europe AS (http://www.digiment.no)

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
	
    If you have any questions, please contact support@digiment.no
*/
import javax.microedition.lcdui.*;

public class Frame
{
	int x;
	int y;

	int w;	// full size
	int h;

	int fw;	// one frame size
	int fh;

	int index;	// image index

	static int x1,y1,x2,y2,ix,delay;

	public Frame(int index,int x,int y,int w,int h,int fw,int fh)
	{
		this.index = index;
		this.x = x;
		this.y = y;
		this.w = w;
		this.h = h;
		this.fw = fw;
		this.fh = fh;
		ix = 0;
		delay = 0;
	}

	int next()
	{
		if (delay <= 0)
		{
			delay = 4;
			ix += fw;
		}
		else delay--;
		if (ix >= w) ix = 0;
		return ix;
	}

	void draw(int gx,int gy)
	{
		Main.gd.setClip(gx,gy,fw,fh);
		Main.gd.drawImage(Main.img[index],gx - x,gy - y,20); // Graphics.TOP | Graphics.LEFT
	}

	void draw(int gx,int gy,int cx,int cy,int cw,int ch)
	{
		x1 = gx > cx ? gx : cx;
		y1 = gy > cy ? gy : cy;
		x2 = gx + fw < (cx + cw) ? gx + fw : cx + cw;
		y2 = gy + fh < (cy + ch) ? gy + fh : cy + ch;
		Main.gd.setClip(x1,y1,x2 - x1,y2 - y1);
		Main.gd.drawImage(Main.img[index],gx - x,gy - y,20);
	}
}

⌨️ 快捷键说明

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