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);
来实现加载主界面。