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

📄 gamemidlet.java

📁 怎样做一个手机游戏上面有很多经验之谈
💻 JAVA
字号:
//%PACKAGE.NAME%

import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
import java.io.DataInputStream;
import java.io.InputStream;

/**
 *
 */
public class GameMIDlet	extends MIDlet implements Runnable
{
	private Display						m_display;
	private Nokia3D				m_gameMode;
	private static Thread				m_thread;

	private boolean						m_running = false;
	private boolean						m_firstRun = true;
	private boolean						m_requestExit = false;
	private boolean						m_exitApplication = false;

	public GameMIDlet()
	{
		m_gameMode = new Nokia3D( this );
		m_display = Display.getDisplay( this );
	}

	public void startApp()
	{
		// check which mode was active when paused, and resume it (or start)
		if ( m_firstRun )
		{
			m_gameMode.startApp(false);
			m_display.setCurrent( m_gameMode );
			m_firstRun = false;
		}
		else
		{
			m_gameMode.startApp(true);
		}

		m_running = true;
		m_thread = new Thread( this );
		m_thread.start();
	}

	public void pauseApp()
	{

	}

	public void destroyApp( boolean unconditional )
	{
		try
		{
			m_running = false;
			if ( m_thread != null )
			{
				m_thread.join();
			}
		}
		catch ( Exception e )
		{

		}
		notifyDestroyed();
	}

	public void run()
	{
		while (m_running)
		{
			try
			{
				m_gameMode.executeOnce();
				Thread.sleep ( 10 ) ;
			}
			catch (Exception e)
			{

			}
		}
	}
}

⌨️ 快捷键说明

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