MainNonTouch.java
* Copyright © 2011 Nokia Corporation. All rights reserved.
* Nokia and Nokia Connecting People are registered trademarks of Nokia Corporation.
* Oracle and Java are trademarks or registered trademarks of Oracle and/or its
* affiliates. Other product and company names mentioned herein may be trademarks
* or trade names of their respective owners.
* See LICENSE.TXT for license information.
*/
package com.nokia.example.racer;
import com.nokia.example.racer.views.GameView;
import com.nokia.example.racer.views.Menu;
import com.nokia.example.racer.views.Splash;
import javax.microedition.lcdui.Display;
import javax.microedition.midlet.MIDlet;
public class MainNonTouch extends MIDlet implements ExitListener{
private Display display;
private static MainNonTouch self;
private GameView gameView;
private Menu menu;
public static MainNonTouch getInstance() {
return self;
}
public void startApp() {
if(display == null) {
display = Display.getDisplay(this);
self = this;
new Thread() {
public void run() {
Splash splash = new Splash();
display.setCurrent(splash);
try {
sleep(1000);
}catch(InterruptedException e) {
}
menu = new Menu();
gameView = new GameView();
display.setCurrent(menu);
splash = null;
try {
join();
}catch(InterruptedException e) {
}
}
}.start();
}
}
public void showGameView() {
display.setCurrent(gameView);
}
public void showMenu() {
display.setCurrent(menu);
}
public void pauseApp() {
}
public void destroyApp(boolean unconditional) {
}
public void exit() {
destroyApp(false);
notifyDestroyed();
}
}