cocos2d-x学习之一:cocos2d-x程序的生命周期
2012-10-26 16:11
169 查看
1.main.m(ios为例)程序入口:cocos2d::CCApplication::sharedApplication().run();
2.程序启动之后会调用AppDelegate.cpp中的回调applicationDidFinishLaunching:
bool AppDelegate::applicationDidFinishLaunching()
{
// initialize director
CCDirector *pDirector = CCDirector::sharedDirector();
pDirector->setOpenGLView(&CCEGLView::sharedOpenGLView());
// enable High Resource Mode(2x, such as iphone4) and maintains low resource on other devices.
pDirector->enableRetinaDisplay(true);
// 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);
// create a scene. it's an autorelease object
CCScene *pScene = MainScene::scene();
// run
pDirector->runWithScene(pScene);
return true;
}
3.通过调用
// create a scene. it's an autorelease object
CCScene *pScene = MainScene::scene();
// run
pDirector->runWithScene(pScene);
来实现加载主界面。
2.程序启动之后会调用AppDelegate.cpp中的回调applicationDidFinishLaunching:
bool AppDelegate::applicationDidFinishLaunching()
{
// initialize director
CCDirector *pDirector = CCDirector::sharedDirector();
pDirector->setOpenGLView(&CCEGLView::sharedOpenGLView());
// enable High Resource Mode(2x, such as iphone4) and maintains low resource on other devices.
pDirector->enableRetinaDisplay(true);
// 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);
// create a scene. it's an autorelease object
CCScene *pScene = MainScene::scene();
// run
pDirector->runWithScene(pScene);
return true;
}
3.通过调用
// create a scene. it's an autorelease object
CCScene *pScene = MainScene::scene();
// run
pDirector->runWithScene(pScene);
来实现加载主界面。
相关文章推荐
- 系统学习1——C程序的生命周期
- 地球人己阻止不了程序猿们学习cocos2d-x了 (第三篇)
- 【cocos2d-x 3.x 学习笔记】 HelloWorld —— 小程序大道理
- cocos2d-x-3.1 win32程序-初识源码(coco2d-x 学习笔记二)
- 地球人己阻止不了程序猿们学习cocos2d-x了 (第二篇)
- 地球人己阻止不了程序猿们学习cocos2d-x了-学习笔记04
- cocos2d-x学习日志(18) --程序是如何开始运行与结束?
- [原创]java WEB学习笔记04:Servlet 简介及第一个Servlet程序(配置注册servlet,生命周期)
- 地球人己阻止不了程序猿们学习cocos2d-x了 (第三篇)
- Cocos2d-x的学习 程序是如何进入到自己的代码的 Application有趣的地方
- Cocos2d-x 3.1.1 学习笔记(一)关联程序逻辑与CocosStudio导出文件
- iPhone学习笔记一]iPhone程序的生命周期
- 地球人己阻止不了程序猿们学习cocos2d-x了-学习笔记01
- 地球人己阻止不了程序猿们学习cocos2d-x了
- 地球人己阻止不了程序猿们学习cocos2d-x了-学习笔记03
- 地球人己阻止不了程序猿们学习cocos2d-x了 (第一篇)
- 地球人己阻止不了程序猿们学习cocos2d-x了 (第四篇)
- cocos2d-x 给函数接口生命周期添加检测函数,用于调试程序时检测错误。
- 微信小程序学习 - 程序、页面注册及生命周期
- 地球人己阻止不了程序猿们学习cocos2d-x了 (第五篇)