gameapi_game.java

来自「扫雷程序还会自动展开已确定没有雷的雷区。如果a[3][4]周围雷数为1」· Java 代码 · 共 132 行

JAVA
132
字号
/*
 * 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.
 */

package GameAPI_Demo;


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

import com.siemens.mp.game.*;


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


	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_Game()
	{
	}

	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();

		while (true) 
		{
		Handle(new GameScreen(), "Game screen");
		}
	//	destroyApp(true);
	}


}

⌨️ 快捷键说明

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