CCTransitionScene* createTransition(int nIndex, float t, CCScene* s)
{
// fix bug #486, without setDepthTest(false), FlipX,Y will flickers
CCDirector::sharedDirector()->setDepthTest(false); switch(nIndex)
{
case : return CCTransitionJumpZoom::create(t, s); case : return CCTransitionProgressRadialCCW::create(t, s);
case : return CCTransitionProgressRadialCW::create(t, s);
case : return CCTransitionProgressHorizontal::create(t, s);
case : return CCTransitionProgressVertical::create(t, s);
case : return CCTransitionProgressInOut::create(t, s);
case : return CCTransitionProgressOutIn::create(t, s); case : return CCTransitionCrossFade::create(t,s); case : return PageTransitionForward::create(t, s);
case : return PageTransitionBackward::create(t, s);
case : return CCTransitionFadeTR::create(t, s);
case : return CCTransitionFadeBL::create(t, s);
case : return CCTransitionFadeUp::create(t, s);
case : return CCTransitionFadeDown::create(t, s); case : return CCTransitionTurnOffTiles::create(t, s); case : return CCTransitionSplitRows::create(t, s);
case : return CCTransitionSplitCols::create(t, s); case : return CCTransitionFade::create(t, s);
case : return FadeWhiteTransition::create(t, s); case : return FlipXLeftOver::create(t, s);
case : return FlipXRightOver::create(t, s);
case : return FlipYUpOver::create(t, s);
case : return FlipYDownOver::create(t, s);
case : return FlipAngularLeftOver::create(t, s);
case : return FlipAngularRightOver::create(t, s); case : return ZoomFlipXLeftOver::create(t, s);
case : return ZoomFlipXRightOver::create(t, s);
case : return ZoomFlipYUpOver::create(t, s);
case : return ZoomFlipYDownOver::create(t, s);
case : return ZoomFlipAngularLeftOver::create(t, s);
case : return ZoomFlipAngularRightOver::create(t, s); case : return CCTransitionShrinkGrow::create(t, s);
case : return CCTransitionRotoZoom::create(t, s); case : return CCTransitionMoveInL::create(t, s);
case : return CCTransitionMoveInR::create(t, s);
case : return CCTransitionMoveInT::create(t, s);
case : return CCTransitionMoveInB::create(t, s); case : return CCTransitionSlideInL::create(t, s);
case : return CCTransitionSlideInR::create(t, s);
case : return CCTransitionSlideInT::create(t, s);
case : return CCTransitionSlideInB::create(t, s); default: break;
} return NULL;
}
//调用
void TestLayer1::restartCallback(CCObject* pSender)
{
//TransitionsTestScene是CCScene的子类
CCScene* s = new TransitionsTestScene(); CCLayer* pLayer = new TestLayer2();
s->addChild(pLayer);
//这里是使用
CCScene* pScene = createTransition(s_nSceneIdx, TRANSITION_DURATION, s);
s->release();
pLayer->release();
if (pScene)
{
CCDirector::sharedDirector()->replaceScene(pScene);
}
}
05-04 06:41