GameCanvasMidlet.java
上传用户:pyly5030
上传日期:2021-09-17
资源大小:174k
文件大小:1k
- import javax.microedition.lcdui.Alert;
- import javax.microedition.lcdui.Display;
- import javax.microedition.lcdui.Image;
- import javax.microedition.midlet.MIDlet;
- public class GameCanvasMidlet extends MIDlet {
- private Display display;
- private MyGameCanvas gameCanvas;
- private LogoCanvas logoCanvas;
- private MenuCanvas menuCanvas;
-
- protected void destroyApp(boolean arg0) {
- exit();
- }
- public void exit(){
- logoCanvas = null;
- menuCanvas = null;
- gameCanvas = null;
- System.gc();
- notifyDestroyed();
- }
- protected void pauseApp() {
-
- }
- protected void startApp() {
- display = Display.getDisplay(this);
- try {
- logoCanvas = new LogoCanvas(this);
- logoCanvas.setFullScreenMode(true);
-
- menuCanvas = new MenuCanvas(this);
- menuCanvas.setFullScreenMode(true);
- //display.setCurrent(menuCanvas);
- display.setCurrent(logoCanvas);
- String key1 = getAppProperty("mykey-1");
- System.out.println(key1);
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- public void mainMenuScreenShow(Alert alert){
- if(alert != null){
- display.setCurrent(alert, menuCanvas);
- }else{
- display.setCurrent(menuCanvas);
- }
- }
- }