📄 roadrun.java
字号:
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
/**
* The application class for the game RoadRun.
* @author Martin J. Wells
*/
public class RoadRun extends MIDlet
{
private MainMenu menu;
/**
* MIDlet constructor instantiates the main menu.
*/
public RoadRun()
{
menu = new MainMenu(this);
}
/**
* Handles Application Manager notification the MIDlet is starting (or
* resuning from a pause). In this case we set the menu as the current
* display screen.
* @throws MIDletStateChangeException
*/
public void startApp() throws MIDletStateChangeException
{
Display.getDisplay(this).setCurrent(menu);
}
/**
* Handles Application Manager notification the MIDlet is about to be paused.
* We don't bother doing anything for this case.
*/
public void pauseApp()
{
}
/**
* Handles Application Manager notification the MIDlet is about to be
* destroyed. We don't bother doing anything for this case.
*/
public void destroyApp(boolean unconditional) throws MIDletStateChangeException
{
}
/**
* Called by the game classes to indicate to the user that the current game
* is over.
*/
public void gameOver()
{
// Display an alert (the device will take care of implementing how to
// show it to the user.
Alert alert = new Alert("", "Splat! Game Over", null, AlertType.INFO);
// Then set the menu to be current.
Display.getDisplay(this).setCurrent(alert, menu);
}
/**
* A utility method to shutdown the application.
*/
public void close()
{
try
{
destroyApp(true);
notifyDestroyed();
}
catch (MIDletStateChangeException e)
{ }
}
/**
* A utility method to create and then activate a new GameScreen.
*/
public void activateGameScreen()
{
GameScreen gameScreen = new GameScreen(this);
Display.getDisplay(this).setCurrent(gameScreen);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -