cocos2dx之AppDelegate
来源:互联网 发布:java语言的优势 编辑:程序博客网 时间:2024/06/06 14:19
在创建完了工程之后,我们可以看到AppDelegate这个文件,我们打开看下这里面有什么:
AppDelegate::AppDelegate() { //1,构造AppDelegate}AppDelegate::~AppDelegate() {}bool AppDelegate::applicationDidFinishLaunching() {//3,在2初始化完之后进入,结束初始化appDelegate // initialize director CCDirector* pDirector = CCDirector::sharedDirector(); CCEGLView* pEGLView = CCEGLView::sharedOpenGLView(); pDirector->setOpenGLView(pEGLView); // turn on display FPS pDirector->setDisplayStats(true); // set FPS. the default value is 1.0/60 if you don't call this pDirector->setAnimationInterval(1.0 / 60);CCScene * pScene = CCScene::create(); GameDemoManager * pLayer = new GameDemoManager();pLayer->initGame(); pLayer->autorelease(); pScene->addChild(pLayer); pDirector->runWithScene(pScene); return true;}// This function will be called when the app is inactive. When comes a phone call,it's be invoked toovoid AppDelegate::applicationDidEnterBackground() {//4,当手机处于后台运行的时候,进入该处 CCDirector::sharedDirector()->stopAnimation(); // if you use SimpleAudioEngine, it must be pause // SimpleAudioEngine::sharedEngine()->pauseBackgroundMusic();}// this function will be called when the app is active againvoid AppDelegate::applicationWillEnterForeground() { /,2,构造完了AppDelegate之后进入初始化application CCDirector::sharedDirector()->startAnimation(); // if you use SimpleAudioEngine, it must resume here // SimpleAudioEngine::sharedEngine()->resumeBackgroundMusic();}
从上面分析:
AppDelegate其实就是整个程序的入口,它的初始化步骤就是上面的1-3,4则是在手机后台运行该程序时所调用的
0 1
- cocos2dx之AppDelegate
- Cocos2dx中AppDelegate生命周期
- 一个cocos2dx 游戏解读(AppDelegate)
- ios开发之AppDelegate
- AppDelegate
- AppDelegate
- AppDelegate
- AppDelegate
- AppDelegate
- AppDelegate
- AppDelegate
- AppDelegate
- AppDelegate
- AppDelegate
- AppDelegate
- appdelegate
- AppDelegate
- AppDelegate
- favorite
- leetcode _Max Points on a Line
- Kernel Source片段 -- 收包(1)硬中断处理函数
- 14 使用HttpConnection获取网络网页源代码
- Ehcache 整合Spring 使用页面、对象缓存
- cocos2dx之AppDelegate
- js导出txt
- C++ 运算符优先级列表
- POJ 3250 Bad Hair Day
- oracle时间函数
- Jquery Table 的基本操作
- 理解 Android Build 系统
- spark安装
- 03ThinkPHP的模版相关