home *** CD-ROM | disk | FTP | other *** search
- package tetris_std;
-
- import javax.microedition.lcdui.Command;
- import javax.microedition.lcdui.CommandListener;
- import javax.microedition.lcdui.Display;
- import javax.microedition.lcdui.Displayable;
- import javax.microedition.midlet.MIDlet;
-
- public class mytetris extends MIDlet implements CommandListener {
- private Display display;
- private Command exitCommand;
- private Command pauseCommand;
- private Command goonCommand;
- maingame tetris = new maingame();
- boolean started = false;
-
- public void startApp() {
- if (!this.started) {
- this.started = true;
- this.tetris.start();
- this.display = Display.getDisplay(this);
- this.display.setCurrent(this.tetris);
- this.exitCommand = new Command("Exit", 7, 0);
- this.pauseCommand = new Command("Pause", 6, 0);
- this.goonCommand = new Command("Continue", 4, 0);
- this.tetris.setCommandListener(this);
- this.tetris.addCommand(this.exitCommand);
- this.tetris.addCommand(this.pauseCommand);
- this.tetris.addCommand(this.goonCommand);
- } else {
- this.tetris.wakemeup();
- this.display.setCurrent(this.tetris);
- }
-
- }
-
- public void pauseApp() {
- this.tetris.gosleep();
- }
-
- public void destroyApp(boolean unconditional) {
- }
-
- public void commandAction(Command c, Displayable d) {
- if (c == this.exitCommand) {
- this.notifyDestroyed();
- }
-
- if (c == this.pauseCommand) {
- this.tetris.gosleep();
- }
-
- if (c == this.goonCommand) {
- this.tetris.wakemeup();
- }
-
- }
- }
-