📄 imageitemtestmidlet.java
字号:
package redduke.game.j2me.example;
import redduke.game.j2me.GameMIDlet;
import redduke.game.j2me.ui.*;
/*
* ImageItem 测试
*/
public class ImageItemTestMIDlet extends GameMIDlet {
public ImageItemTestMIDlet() {
super(new ImageItemTestCanvas());
}
static class ImageItemTestCanvas extends GameCanvas {
ImageItem item = new ImageItem("/redduke/game/j2me/example/duke.png");
{
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);
/*
* 顺时针旋转90度
*/
if (super.lastPressed(KEY_NUM1))
item.roate90(true);
/*
* 上下翻转
*/
if (super.lastPressed(KEY_NUM3))
item.flip(true);
/*
* 左右翻转
*/
if (super.lastPressed(KEY_NUM2))
item.mirror(true);
clearKey();
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -