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

📄 torino.java

📁 国外人写的操作感挺好的一款滑雪游戏.结构也比较清楚
💻 JAVA
字号:
// Copyright (c) 2004 Venan Entertainment, Inc. All rights reserved.
//
// Venan Entertainment, Inc.,  Middletown, Connecticut 06457
// http://www.venan.com
//

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

//#ifdef _SPRINT_MRC
//import com.sprintpcs.license.LicenseException;
//import com.sprintpcs.license.LicenseProxy;
//#endif	

//! Torino (winter games) for MIDP 1.0
/*!
	This class defines the Athens MIDlet and extends the MIDlet class
	provided by MIDP.  It implements the required startApp(), pauseApp(), and
	destroyApp() methods required by MIDP.
*/
public class Torino extends MIDlet
{
//#ifdef _DEBUG
////#define DUMP_EXCEPTION(e)			{ //System.out.println( e.getMessage()); e.printStackTrace(); }
////#define DUMP_EXCEPTION_MSG(e,msg)	{ //System.out.println( msg + "\n" + e.getMessage()); e.printStackTrace(); }
////#define DEBUG_MSG(msg)				//System.out.println(msg)
//#else
//#endif

//#ifdef _PROFILE
////#define START_TIMER(a)				a = System.currentTimeMillis();
////#define STOP_TIMER(a)				a = System.currentTimeMillis() - a;
//#else
//#endif




	private Display m_display;					//!< A reference to the display
	private TorinoCanvas m_canvas;				//!< The main game screen
//#ifdef _DISPLAY_MEM_ERROR
//	public boolean m_bCriticalError = false;	//!< Critical error occurred
//#endif

	//! Constructor
	/*!
	Default constructor.  Initialization should not take place here, as the
	context is not yet set for the application.
	*/
	public Torino( )
	{
	}

	//! Signals the MIDlet to start providing service and enter the Active state.
	/*!
	This function is called to activate the MIDlet.  It is called whenever the
	MIDlet leaves the Paused state ad enters the Active state.  It also
	conducts one-time initialization if required.

	\throw MIDletStateChangeException 

	\todo Add additional activation code
	*/
	public void startApp( )
	{
            try
            {
		if ( m_display == null )
		{

				m_display = Display.getDisplay( this );
				m_canvas = new TorinoCanvas( this, m_display );
				m_canvas.startMainLoop( );
				m_display.setCurrent( m_canvas );
		}
		if ( m_canvas != null )
		{
                        m_canvas.unpause();
		}
            }catch(Exception E){/*E.printStackTrace();*/}
	}

	//! Signals the MIDlet to stop providing service and enter the Paused state.
	/*!
	This function is called to pause the MIDlet.  It is called whenever the
	MIDlet leaves the Active state and enters the Paused state.  In the
	Paused state the MIDlet must stop providing service, and might release
	all resources and become quiescent.

	\todo Add additional pause code
	*/
	public void pauseApp( )
	{
		// add pause code here
		if (m_canvas != null)
		{
			m_canvas.pause();
			try
			{
				m_canvas.saveData(false);
			}
			catch ( IOException e )
			{
//				DUMP_EXCEPTION(e);
			}
//#ifndef _FULL_CANVAS
//			m_canvas.setCommandListener( null );
//#endif
		}
	}

	//! Signals the MIDlet to terminate and enter the Destroyed state.
	/*!
	This function is called to destroy the MIDlet.  It is called whenever
	the MIDlet is exiting.  This should perform any operations required
	before being terminated, such as releasing resources or saving
	preferences or state.

	\throw MIDletStateChangeException

	\todo Add additional destruction code
	*/
	public void destroyApp( boolean unconditional )
	{
		if (m_canvas != null)
		{
			// unload some resources before displaying alert
			// in case we are exiting due to a memory error
			
			try
			{
				m_canvas.openWindow( TorinoCanvas.WINDOW_NONE );
				m_canvas.saveData(false);
//#ifdef _DISPLAY_MEM_ERROR
//				if ( m_bCriticalError )
//				{
//					m_canvas.displayErrorAlert();
//				}
//#endif
			}
			catch( IOException e )
			{
//				DUMP_EXCEPTION(e);
			}
		}
		notifyDestroyed( );
	}

	//! Request MIDlet exit.
	/*!
	This function is called to request the MIDlet to exit.
	*/
	public void exitRequested( )
	{
		destroyApp(false);
	}
}

⌨️ 快捷键说明

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