⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 gamemidlet.java

📁 J2ME 上的坦克大战的demo,欢迎大家用来学习使用
💻 JAVA
字号:
/*
 * 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 + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -