📄 gamepp.java
字号:
/*
* 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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -