bool AppDelegate::applicationDidFinishLaunching() { // initialize director CCDirector *pDirector = CCDirector::sharedDirector(); pDirector->setOpenGLView(CCEGLView::sharedOpenGLView()); // 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); ScriptingCore* sc = ScriptingCore::getInstance(); sc->addRegisterCallback(register_all_cocos2dx); sc->addRegisterCallback(register_cocos2dx_js_extensions); sc->start(); CCScene *scene = CCScene::create(); UpdateLayer *updateLayer = new UpdateLayer(); scene->addChild(updateLayer); updateLayer->release(); pDirector->runWithScene(scene); return true; }
UpdateLayer* UpdateLayer::create(bool b) { UpdateLayer* pRet = new UpdateLayer(); if ( pRet && pRet->initWithData()) { pRet->autorelease(); return pRet; } CC_SAFE_DELETE(pRet); return NULL; }
UpdateLayer* UpdateLayer::create() { UpdateLayer * layer = new UpdateLayer(); if (layer && layer->init()) { layer->autorelease(); return layer; } CC_SAFE_DELETE(layer); return NULL; }