gamemidlet.java
来自「J2ME 上的坦克大战的demo,欢迎大家用来学习使用」· Java 代码 · 共 47 行
JAVA
47 行
/*
* Created on 2006-2-4
* Author: Xuefeng, Copyright (C) 2006, Xuefeng.
*/
package com.javaeedev.j2megame.tank;
import javax.microedition.lcdui.*;
import javax.microedition.midlet.MIDlet;
public class GameMIDlet extends MIDlet {
private static GameMIDlet instance = null;
private Display display = null;
private GameMainCanvas canvas = null;
public GameMIDlet() {
instance = this;
}
protected void startApp() {
if(display==null) {
display = Display.getDisplay(this);
canvas = new GameMainCanvas(100);
}
display.setCurrent(canvas);
canvas.pauseGame(false);
}
protected void pauseApp() {
canvas.pauseGame(true);
}
protected void destroyApp(boolean unconditional) {
// unconditional:
// If true when this method is called, the MIDlet must cleanup and release all resources.
// If false the MIDlet may throw MIDletStateChangeException to indicate it does not want to be destroyed at this time.
canvas.stopGame();
}
public static void quitApp() {
instance.destroyApp(true);
instance.notifyDestroyed();
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?