gamepp.java

来自「此代码是手机五指棋代码!!使用ECLIPSE开发工具开发!!在手机模拟器上通过.」· Java 代码 · 共 82 行

JAVA
82
字号
/*
 * GamePP.java
 *
 * Created on 2006年2月20日, 下午10:06
 *
 * To change this template, choose Tools | Options and locate the template under
 * the Source Creation and Management node. Right-click the template and choose
 * Open. You can then make changes to the template in the Source Editor.
 */

package GamePP;

/**
 *
 * @author Sirius
 */
import java.io.IOException;
import javax.microedition.lcdui.*;


public class GamePP {
	
	private int top_x ;
	private int top_y ;
	private int bottom_x ;
	private int bottom_y ;
	private int width ;
	private int height ;
	private Image pic ;
	public GamePP (String ImagePath){
		try{
			pic=Image.createImage(ImagePath);
		}catch(IOException e){
			System.out.println("load png resource error"+e.getMessage());
			pic=null;
		}
		width=pic.getWidth();
		height=pic.getHeight();
	}
	
	public void drawPic(int x ,int y ,Graphics g){
		top_x=x ;
		top_y=y ;
		bottom_x=x+width ;
		bottom_y=y+height ;
		g.drawImage(pic,top_x,top_y,Graphics.TOP|Graphics.LEFT);
	}
	
	public void OffdrawPic(int x ,int y ,Graphics offscreen){
		top_x=x ;
		top_y=y ;
		bottom_x=x+width ;
		bottom_y=y+height ;
		//绘制
		offscreen.drawImage(pic,top_x,top_y,Graphics.TOP|Graphics.LEFT);
	}
	
	public int get_top_x(){
		return top_x ;
	}

	public int get_top_y(){
		return top_y ;
	}
	
	public int get_bottom_x(){
		return bottom_x ;
	}
	
	public int get_bottom_y(){
		return bottom_y ;
	}
	
	public int get_width(){
		return width ;
	}
	
	public int get_height(){
		return height ;
	}
}

⌨️ 快捷键说明

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