本文整理汇总了C++中CCScene::init方法的典型用法代码示例。如果您正苦于以下问题:C++ CCScene::init方法的具体用法?C++ CCScene::init怎么用?C++ CCScene::init使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCScene
的用法示例。
在下文中一共展示了CCScene::init方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CCScene
CCScene *CCScene::create()
{
CCScene *pRet = new CCScene();
if (pRet && pRet->init())
{
pRet->autorelease();
return pRet;
}
else
{
CC_SAFE_DELETE(pRet);
return NULL;
}
}
示例2: LoadingScene
CCScene *LoadingScene::scene()
{
LoadingScene *layer = new LoadingScene();
if (!layer->init()) {
delete layer;
return 0;
}
layer->autorelease();
CCScene *scene = new CCScene();
scene->init();
scene->addChild(layer);
return scene;
}
示例3:
CCScene * GameLayer::scene() {
CCScene *scene = CCScene::create();
if (scene && scene->init()) {
if (scene) {
/*-- 背景 --*/
scene->addChild(BgLayer::create());
GameLayer *layer = GameLayer::create();
scene->addChild(layer, TAG_LAYER_GAME);
scene->addChild(layer->createPauseButtonLayer());
}
return scene;
} else {
CC_SAFE_DELETE(scene);
return NULL;
}
}
示例4: goNextScene
void SceneManager::goNextScene()
{
CCScene * sceneToRun = NULL;
m_prevSceneID = m_curSceneID;
m_curSceneID = m_nextSceneID;
switch (m_nextSceneID)
{
case kStartScene:
sceneToRun = new StartScene;
break;
case kPcSelectScene:
sceneToRun = new PcSelectScene;
break;
case kWorldMapScene:
sceneToRun = new WorldMapScene;
break;
case kStageSelectScene:
sceneToRun = new StageSelectScene;
break;
case kBattleScene:
sceneToRun = new BattleScene;
break;
case kAchievementScene:
sceneToRun = new AchievementScene;
break;
case kRankScene:
// sceneToRun = [RankScene node];
break;
}
sceneToRun->init();
curScene = sceneToRun;
if (CCDirector::sharedDirector()->getRunningScene() == NULL)
{
CCDirector::sharedDirector()->runWithScene(sceneToRun);
}
else
{
CCDirector::sharedDirector()->replaceScene(CCTransitionSlideInL::create(0.5, sceneToRun));
}
// [[CCDirector sharedDirector].view setUserInteractionEnabled:TRUE];
}
示例5:
CCScene * MainLayer::scene()
{
CCScene *scene = CCScene::create();
if (scene && scene->init())
{
if (scene)
{
/*-- 背景 --*/
CCLayer *bgLayer = BgLayer::create();
scene->addChild(bgLayer);
MainLayer *layer = MainLayer::create();
scene->addChild(layer);
}
return scene;
}
else
{
CC_SAFE_DELETE(scene);
return NULL;
}
}
示例6: applicationDidFinishLaunching
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);
// create a scene. it's an autorelease object
CCScene *pScene = new PuzzleScene;
pScene->init();
// run
pDirector->runWithScene(pScene);
return true;
}
示例7: initScenes
//------------------------------------------------------------------------------
bool initScenes(CCScene * pScene, CCScene** inScene, CCScene ** outScene)
{
CCAssert(pScene != NULL, "Argument scene must be non-nil");
CCScene * pOutScene = (CCScene*)CCDirector::sharedDirector()->getNotificationNode();
if (pOutScene == NULL)
{
pOutScene = CCScene::create();
pOutScene->init();
pOutScene->onEnter();
}
pOutScene->retain();
pScene->retain();
CCAssert(pScene != pOutScene, "Incoming scene must be different from the outgoing scene");
*inScene = pScene;
*outScene = pOutScene;
return true;
}