Beispiel #1
0
CCScene *CCScene::create()
{
    CCScene *pRet = new CCScene();
    if (pRet && pRet->init())
    {
        pRet->autorelease();
        return pRet;
    }
    else
    {
        CC_SAFE_DELETE(pRet);
        return NULL;
    }
}
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;
}
Beispiel #3
0
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;
	}

}
Beispiel #4
0
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];
}
Beispiel #5
0
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;
	}
}
Beispiel #6
0
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;
}
Beispiel #7
0
//------------------------------------------------------------------------------
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;
}