📄 pacman.java
字号:
/**
* PacMan for J2ME Devices
* CS 327 - Design Project, Fall 2002
* University of Illinois, Urbana-Champaign
*
* file: pacman.java
* contact: Braden Kowitz
* date: 11/24/02
**/
//----------------------------------------------------------------------------//
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
import java.lang.*;
/**
* This is the base class for the midlet.
* It starts up and shuts down the game.
**/
public class pacman extends MIDlet implements CommandListener
{
/**
* A canvas draws to the screen.
* The game canvas contains all of main
* functionality of the gameplay.
**/
private GameCanvas canvas_;
/**
* The introscreen of this pacman program
*/
private Menu menu_ ;
private Menu gameOvermenu_ ;
public int gameOver;
/**
* Constructor for this MIDlet.
* This function get's the current display,
* and creates a GameCanvas with the display.
**/
public pacman()
{
super();
Display disp = Display.getDisplay(this);
menu_ = new Menu(disp, this);
canvas_ = new GameCanvas(this, disp);
}
/**
* When the OS tells this midlet to start,
* we simply show the GameCanvas.
**/
public void startApp() throws MIDletStateChangeException
{
//introScreen_.show();
gameOver = 0;
menu_.show();
//canvas_.show();
}
/**
* Handles a request from the OS to pause the game.
* This is not currently implemented.
**/
public void pauseApp()
{
}
/**
* Handles a restart of the game
*/
public void restartApp() throws MIDletStateChangeException
{
Display disp = Display.getDisplay(this);
canvas_ = new GameCanvas(this, disp);
//canvas_.addCommand(exitCommand);
canvas_.setCommandListener(this);
//playedGame_ = false;
//startApp();
gameOvermenu_=new Menu(disp,this);
//gameOver = 0;
gameOvermenu_.show();
//menu_.show();
}
/**
* Handles a request from the OS to end the game.
* Calls to destroy FrameTrigger thread accessable
* in GameCanvas
**/
public void destroyApp(boolean bool)
{
/*
canvas_.destroyFrameTrigger();
System.out.println("Destroy App Called, should be end of prog");
*/
}
/**
* Respond to a command issued on the canvas
**/
public void commandAction(Command c, Displayable s)
{
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -