MIDP2.0取软键码BUG解决方法
j2me · 拉肚子 发表于 2005-04-05 00:44:38 · 阅读 51 · 回复 0 · 分类:[j2me]
我把左软键定义为GAME_A_PRESSED
右软件定义为GAME_B_PRESSED
十字键 中间键定义为FIRE_PRESSED
void input() {
keyStates = (short)getKeyStates();
switch(softKey){
case -5:
keyStates=256;
break;
case -6:
keyStates=512;
break;
case -7:
keyStates=1024;
break;
case 21:
keyStates=512;
break;
case 22:
keyStates=1024;
break;
}
...
}
protected void keyPressed(int k){
softKey = (byte)k;
}
protected void keyReleased(int k){
softKey = 0;
}
右软件定义为GAME_B_PRESSED
十字键 中间键定义为FIRE_PRESSED
void input() {
keyStates = (short)getKeyStates();
switch(softKey){
case -5:
keyStates=256;
break;
case -6:
keyStates=512;
break;
case -7:
keyStates=1024;
break;
case 21:
keyStates=512;
break;
case 22:
keyStates=1024;
break;
}
...
}
protected void keyPressed(int k){
softKey = (byte)k;
}
protected void keyReleased(int k){
softKey = 0;
}
评论
暂无评论
