cocos2d-x之场景转换特效

bool HelloWorld::init()

{

if ( !Layer::init() )

{

return false;

}

Size visibleSize = Director::getInstance()->getVisibleSize();

Vec2 origin = Director::getInstance()->getVisibleOrigin();

auto background=Sprite::create("Saloon (5).png");

background->setPosition(visibleSize/2);

background->setScale(10);

addChild(background);

scheduleOnce([visibleSize](float f){

//创建新的场景

auto newScene=Scene::create();

auto newBackground=Sprite::create("Saloon (7).png");

newBackground->setPosition(visibleSize/2);

newBackground->setScale(10);

newScene->addChild(newBackground);

//auto transition=TransitionCrossFade::create(1,newScene);

//auto transition=TransitionZoomFlipAngular::create(1,newScene);

//auto transition=TransitionPageTurn::create(1,newScene,true);

//auto transition=TransitionProgressRadialCCW::create(1,newScene);

auto transition=TransitionSplitRows::create(1,newScene);

Director::getInstance()->replaceScene(transition);

},2,"Test");

return true;

}

上一篇:一段处理百分数的js代码


下一篇:linux上应用程序的执行机制