📄 gameui.java
字号:
package cn.org.matrix.gmatrix.gameLab.util.ui;
import javax.microedition.lcdui.Canvas;
/**
* 游戏UI类
* @author cleverpig
*
*/
public abstract class GameUI extends Canvas{
//UI类型:直到键盘干预才关闭
public static final int NEVERCLOSE_UNTILKEYPRESS=1;
//UI类型:UI打开一定时间后自动关闭
public static final int CLOSE_UNTILTIMEOUT=2;
//UI范围
private UIScope scope=null;
//UI配色方案
private UIColorScheme colorScheme=null;
//选择确定所对应的键盘值:与KeyManager定义的常量对应
private int affirmKey=0;
//选择取消所对应的键盘值:与KeyManager定义的常量对应
private int cancelKey=0;
//UI类型
private int type=0;
//等待时间(以每500ms为单位)
private int waitTime=0;
public GameUI(){
this.colorScheme=new UIColorScheme();
this.scope=new UIScope();
}
/**
* 构造方法
* @param uiWidth UI宽度
* @param uiHeight UI高度
* @param startX UI左上角X坐标
* @param startY UI左上角Y坐标
* @param affirmKey 确定按键值
* @param cancelKey 取消按键值
* @param type UI类型
* @param bgColor 背景颜色
* @param borderColor 边框颜色
* @param waitTime 等待时间
*/
public GameUI(int uiWidth,int uiHeight,
int startX,int startY,
int affirmKey,int cancelKey,
int type,int bgColor,int uiBgColor,
int borderColor,int waitTime){
this.scope=new UIScope();
this.scope.setLeftTopCoordinates(startX,startY);
this.scope.setUIWidth(uiWidth);
this.scope.setUIHeight(uiHeight);
this.affirmKey=affirmKey;
this.cancelKey=cancelKey;
this.type=type;
this.colorScheme=new UIColorScheme(bgColor,uiBgColor,borderColor);
this.waitTime=waitTime;
}
public int getWaitTime() {
return waitTime;
}
public void setWaitTime(int waitTime) {
this.waitTime = waitTime;
}
public int getAffirmKey() {
return affirmKey;
}
public void setAffirmKey(int affirmKey) {
this.affirmKey = affirmKey;
}
public int getCancelKey() {
return cancelKey;
}
public void setCancelKey(int cancelKey) {
this.cancelKey = cancelKey;
}
public int getType() {
return type;
}
public void setType(int type) {
this.type = type;
}
public UIScope getScope() {
return this.scope;
}
public void setScope(UIScope uiScope) {
this.scope = uiScope;
}
public UIColorScheme getColorScheme() {
return this.colorScheme;
}
public void setColorScheme(UIColorScheme colorSheme) {
this.colorScheme = colorSheme;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -