场景切换
void MyScene::daySceneCallback(CCObject *pSender)
{
CCScene *scene = new MyScene();
CCLayer *pLayer = new LayerDay();
scene->addChild(pLayer, 0);
CCDirector::sharedDirector()->pushScene(scene);
scene->release();
pLayer->release();
}
|
带过渡效果
void MyScene::daySceneCallback(CCObject *pSender)
{
CCScene *scene = new MyScene();
CCLayer *pLayer = new LayerDay();
scene->addChild(pLayer, 0);
CCTransitionJumpZoom *pScene = CCTransitionJumpZoom::create(1.2f, scene); //note
//CCDirector::sharedDirector()->pushScene(pScene);
//CCDirector::sharedDirector()->pushScene(scene);
CCDirector::sharedDirector()->replaceScene(pScene);
scene->release();
//pScene->release();//note
pLayer->release();
}
|
注意切换场景带过渡效果时使用replaceScene函数