MarioMIDlet.java
上传用户:gyyuli
上传日期:2013-07-09
资源大小:3050k
文件大小:2k
源码类别:

J2ME

开发平台:

Java

  1. /**
  2.  * <p>Title: Mario</p>
  3.  * <p>Description:
  4.  * You cannot remove this copyright and notice.
  5.  * You cannot use this file any part without the express permission of the author.
  6.  * All Rights Reserved</p>
  7.  * <p>Copyright: lizhenpeng (c) 2004</p>
  8.  * <p>Company: LP&P</p>
  9.  * @author lizhenpeng
  10.  * @version 1.0.0
  11.  */
  12. package mario;
  13. import javax.microedition.midlet.*;
  14. import javax.microedition.lcdui.*;
  15. import lipeng.LPIGetCanvas;
  16. import lipeng.LPProgressThread;
  17. public class MarioMIDlet
  18.   extends MIDlet
  19. implements LPIGetCanvas
  20. {
  21.   public MarioMIDlet()
  22.   {
  23.     gameLoading = new LPProgressThread(this);
  24.   }
  25.   public void startApp()
  26.   {
  27.     if(gameLoading.loadProgressIsOver)
  28.   {
  29.     Display.getDisplay(this).setCurrent(gameCanvas);
  30.     gameCanvas.start();
  31.   }
  32.  else
  33.   {
  34.     Display.getDisplay(this).setCurrent(gameLoading);
  35.     gameLoading.start();
  36.     if(gameLoading.gaugeCnt==0)
  37.     {
  38.       gameCanvas = new MarioGameCanvas(this);
  39.     }
  40.   }
  41.   }
  42.   public Canvas getCanvas()
  43.   {
  44.     return gameCanvas;
  45.   }
  46.   public void pauseApp()
  47.   {
  48.     if(gameLoading.loadProgressIsOver)
  49.     {
  50.       gameCanvas.stop();
  51.     }
  52.     else
  53.     {
  54.       gameLoading.stop();
  55.     }
  56.   }
  57.   public void destroyApp(boolean unconditional)
  58.   {
  59.     if(gameLoading.loadProgressIsOver)
  60.     {
  61.       gameCanvas.record.close();
  62.       gameCanvas.stop();
  63.     }
  64.   }
  65.   public void exitMIDlet()
  66.   {
  67.     destroyApp(false);
  68.     notifyDestroyed();
  69.   }
  70.   static public MarioGameCanvas gameCanvas;
  71.   public LPProgressThread gameLoading;
  72. }