cocos2d学习(03)——AppDelegate类中applicationDidFinishLaunching函数分析

cocos2d学习(03)——AppDelegate类中applicationDidFinishLaunching函数分析,第1张

概述AppDelegate类中applicationDidFinishLaunching函数分析   1: bool AppDelegate::applicationDidFinishLaunching() { 2: // initialize director 初始化导演 3: CCDirector* pDirector = CCDirector::sharedDirector AppDelegate类中applicationDIDFinishLaunching函数分析
 1: bool AppDelegate::applicationDIDFinishLaunching() {
 2:     // initialize director 初始化导演
 3:     CCDirector* pDirector = CCDirector::sharedDirector();
 4:     //导演Director也是单例模式的,只能有一个导演
 5:     /* CCDirector* CCDirector::sharedDirector(voID)
 6:  {
 7:  if (!s_SharedDirector) //导演不存在的时候
 8:  { //创建一个导演
 9:  s_SharedDirector = new CCdisplaylinkDirector();
 10:  s_SharedDirector->init();
 11:  }
 12: 
 13:  return s_SharedDirector; //返回导演
 14:  }
 15:  //单例模式的一个重要的实现方法,私有化构造函数和静态类指针
 16:  static CCdisplaylinkDirector *s_SharedDirector = NulL;
 17:  *****************************************************/
 18:     CCEGLVIEw* pEGLVIEw = CCEGLVIEw::sharedOpenGLVIEw();
 19:
 20:     pDirector->setopenGLVIEw(pEGLVIEw);
 21:
 22:     // turn on display FPS turn on对准;对…进行突击
 23:     //display显示 (=feet per second)英尺/秒n.【摄】张 / 秒
 24:     pDirector->setdisplayStats(true);
 25:
 26:     // set FPS. the default value is 1.0/60 if you don't call this
 27:     //设置FPS的默认值为60张每秒。
 28:     pDirector->setAnimationInterval(1.0 / 60);
 29:
 30:     // create a scene. it's an autorelease object
 31:     //创建一个场景scene,他会自动释放对象(对象管理池)
 32:     CCScene *pScene = HelloWorld::scene();   //要做的事情都在这里,多数内容都加在这里面
 33: // CCAction* CCAction::create()
 34: // {
 35: // CCAction * pRet = new CCAction();
 36: // pRet->autorelease(); //对象调用创建的时候
 37: // return pRet;
 38: // }
 39: //
 40: // CCObject* CCObject::autorelease(voID)
 41: // { //将创建的对象加入到对象管理池
 42: // CCPoolManager::sharedPoolManager()->addobject(this);
 43: // return this;
 44: // }
 45: // //对象管理池也是单实例的
 46: // CCPoolManager* CCPoolManager::sharedPoolManager()
 47: // {
 48: // if (s_pPoolManager == NulL)
 49: // {
 50: // s_pPoolManager = new CCPoolManager();
 51: // }
 52: // return s_pPoolManager;
 53: // }
 54: //
 55: // voID CCPoolManager::addobject(CCObject* pObject)
 56: // {
 57: // getCurReleasePool()->addobject(pObject);
 58: // }
 59:
 60:     // run 运行。由导演来使用这个场景
 61:     pDirector->runWithScene(pScene);
 62:     //返回成功
 63:     return true;
 64: }
总结

以上是内存溢出为你收集整理的cocos2d学习(03)——AppDelegate类中applicationDidFinishLaunching函数分析全部内容,希望文章能够帮你解决cocos2d学习(03)——AppDelegate类中applicationDidFinishLaunching函数分析所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/web/1013001.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-22
下一篇 2022-05-22

发表评论

登录后才能评论

评论列表(0条)

保存