home *** CD-ROM | disk | FTP | other *** search
/ PC Pro 64 / CDPRO64.iso / JUEGOS / java / tobitris / tobitris.jar / tetris_std / mytetris.class (.txt) < prev    next >
Encoding:
Java Class File  |  2005-06-27  |  2.0 KB  |  59 lines

  1. package tetris_std;
  2.  
  3. import javax.microedition.lcdui.Command;
  4. import javax.microedition.lcdui.CommandListener;
  5. import javax.microedition.lcdui.Display;
  6. import javax.microedition.lcdui.Displayable;
  7. import javax.microedition.midlet.MIDlet;
  8.  
  9. public class mytetris extends MIDlet implements CommandListener {
  10.    private Display display;
  11.    private Command exitCommand;
  12.    private Command pauseCommand;
  13.    private Command goonCommand;
  14.    maingame tetris = new maingame();
  15.    boolean started = false;
  16.  
  17.    public void startApp() {
  18.       if (!this.started) {
  19.          this.started = true;
  20.          this.tetris.start();
  21.          this.display = Display.getDisplay(this);
  22.          this.display.setCurrent(this.tetris);
  23.          this.exitCommand = new Command("Exit", 7, 0);
  24.          this.pauseCommand = new Command("Pause", 6, 0);
  25.          this.goonCommand = new Command("Continue", 4, 0);
  26.          this.tetris.setCommandListener(this);
  27.          this.tetris.addCommand(this.exitCommand);
  28.          this.tetris.addCommand(this.pauseCommand);
  29.          this.tetris.addCommand(this.goonCommand);
  30.       } else {
  31.          this.tetris.wakemeup();
  32.          this.display.setCurrent(this.tetris);
  33.       }
  34.  
  35.    }
  36.  
  37.    public void pauseApp() {
  38.       this.tetris.gosleep();
  39.    }
  40.  
  41.    public void destroyApp(boolean unconditional) {
  42.    }
  43.  
  44.    public void commandAction(Command c, Displayable d) {
  45.       if (c == this.exitCommand) {
  46.          this.notifyDestroyed();
  47.       }
  48.  
  49.       if (c == this.pauseCommand) {
  50.          this.tetris.gosleep();
  51.       }
  52.  
  53.       if (c == this.goonCommand) {
  54.          this.tetris.wakemeup();
  55.       }
  56.  
  57.    }
  58. }
  59.