对于不同的游戏,在MainCanvas类中添加代码即可。
import javax.microedition.lcdui.Display;
import javax.microedition.midlet.MIDlet;
import javax.microedition.midlet.MIDletStateChangeException
public class PuzzleMidlet extends MIDlet {
private static MainCanvas m_MainCanvas;
public PuzzleMidlet() {
super();
// TODO Auto-generated constructor stub
}
protected void startApp() throws MIDletStateChangeException {
// TODO Auto-generated method stub
if (m_MainCanvas == null)
{
try
{
m_MainCanvas = new MainCanvas(this);
}
catch (Exception ex)
{
System.out.println(ex);
}
}
Display.getDisplay(this).setCurrent(m_MainCanvas);
}
protected void pauseApp() {
// TODO Auto-generated method stub
m_MainCanvas.stop();
}
protected void destroyApp(boolean arg0) throws MIDletStateChangeException {
// TODO Auto-generated method stub
m_MainCanvas.stop();
}
}
|
阅读(506) | 评论(0) | 转发(0) |