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

📄 gameapi_demo.java

📁 这是一个Java座的扫雷游戏
💻 JAVA
字号:
/*
 * Siemens AG
 * Mobile Radio Terminals
 * Munich, Germany
 * .AUTHOR      Michael Becker CT SE 2 / Sam Nova (THQ)
 * .PACKAGE		GameAPI_Demo
 * .STATUS         DRAFT
 * .CHANGE_CONTROL
 * Version |  Date  	| Changed by | 	Reason for Change
 * 1.0    	21.05.01  		M.Becker		file created.
 * 1.1          26.06.01 Jan Eichholz Math.randomInt removed 
*/

package GameAPI_Demo;


import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;

import com.siemens.mp.game.*;


/**
 * Class declaration
 *
 */
public class GameAPI_Demo extends MIDlet implements CommandListener {

    static java.util.Random rand = new java.util.Random();

	protected static final String       OK_COMMAND_LABEL = "ok",
		EXIT_COMMAND_LABEL = "Exit",
		DEMO1_COMMAND_LABEL = "Demo 1";

	protected Command                   exitCommand, okCommand, demo1Command;


	/**
	* Method declaration
	*
	*
	* @param c
	* @param d
	*
	* @see
	*/
	public void commandAction(Command c, Displayable d)
	{
		if (c == exitCommand)
		{
			destroyApp(true);
		}
		else if (c == okCommand)
		{

		}

	}


	/**
	* Method declaration
	*
	* Signals the MIDlet to terminate and enter the Destroyed state.
	* @param unconditional
	*
	*/
	protected void destroyApp(boolean b)
	{
		Display.getDisplay(this).setCurrent(null);

		notifyDestroyed();
	}

	/**
	* Method declaration
	*
	* Signals the MIDlet to stop and enter the Paused state.
	*
	*/
	protected void pauseApp()
	{
		notifyPaused();
	}


	public GameAPI_Demo()
	{
	}

	public int Handle(MyScreen screen, String name)
	{
		Display.getDisplay(this).setCurrent(screen);

		// Lets run the menu screen
		Thread updateThread = new Thread(screen);
		updateThread.start();

		while(updateThread.isAlive()) ;

		// Task done....
		Display.getDisplay(this).setCurrent(null);
		updateThread = null;

		int returnValue = screen.getReturnValue();

		screen.Dispose();
		screen = null;

		return returnValue;
	}


	/**
	* Method declaration
	*
	* Signals the MIDlet to start and enter the Active state.
	*
	*/
	protected void startApp()
	{
		System.gc();

		Light.setLightOn();

		Handle(new IntroScreen(), "Intro screen");
		Handle(new GameScreen(), "Game screen");
		Handle(new TiledScreen(), "Tiled screen");
		Handle(new WhoScreen(), "Who Screen");        

		Light.setLightOff();
		destroyApp(true);
	}


}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -