?? stringitemtestmidlet.java
字號:
package redduke.game.j2me.example;
import redduke.game.j2me.GameMIDlet;
import redduke.game.j2me.ui.*;
import redduke.game.j2me.util.*;
/*
* StringItem 測試
*
*/
public class StringItemTestMIDlet extends GameMIDlet {
public StringItemTestMIDlet() {
super(new StringItemTestCanvas());
}
static class StringItemTestCanvas extends GameCanvas {
StringItem item = new StringItem("Redduke");
{
add(item);
item.setPosition(getScreenWidth() >> 1, getScreenHeight() >> 1,
true);
super.setBackGround(Color.blue);
}
protected void main() {
/*
* 向上移動
*/
if (super.isPressing(UP))
item.move(0, -1, true);
/*
* 向下移動
*/
if (super.isPressing(DOWN))
item.move(0, 1, true);
/*
* 向左移動
*/
if (super.isPressing(LEFT))
item.move(-1, 0, true);
/*
* 向右移動
*/
if (super.isPressing(RIGHT))
item.move(1, 0, true);
/*
* 設置隨機顏色
*/
if (super.isPressing(FIRE))
item.setColor(Util.randInt(0xffffff));
}
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -