博客首页 注册 建议与交流 排行榜 加入友情链接
推荐 投诉 搜索: 帮助

不想忘却

为了少做无用功,记录下来比较明智
  embedanddelphi.cublog.cn

关于作者
网络游民一个
电子科大在读研究生

|| << >> ||
我的分类


Midlet的通用程序框架
对于不同的游戏,在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();
    }

}

 TAG j2me
发表于: 2008-06-04,修改于: 2008-06-04 17:38,已浏览92次,有评论0条 推荐 投诉


网友评论
 发表评论