newlist

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::
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 0: return CCTransitionJumpZoom::create(t, s);

    case 1: return CCTransitionProgressRadialCCW::create(t, s);
    case 2: return CCTransitionProgressRadialCW::create(t, s);
    case 3: return CCTransitionProgressHorizontal::create(t, s);
    case 4: return CCTransitionProgressVertical::create(t, s);
    case 5: return CCTransitionProgressInOut::create(t, s);
    case 6: return CCTransitionProgressOutIn::create(t, s);

    case 7: return CCTransitionCrossFade::create(t,s);

    case 8: return PageTransitionForward::create(t, s);
    case 9: return PageTransitionBackward::create(t, s);
    case 10: return CCTransitionFadeTR::create(t, s);
    case 11: return CCTransitionFadeBL::create(t, s);
    case 12: return CCTransitionFadeUp::create(t, s);
    case 13: return CCTransitionFadeDown::create(t, s);

    case 14: return CCTransitionTurnOffTiles::create(t, s);

    case 15: return CCTransitionSplitRows::create(t, s);
    case 16: return CCTransitionSplitCols::create(t, s);

    case 17: return CCTransitionFade::create(t, s);
    case 18: return FadeWhiteTransition::create(t, s);

    case 19: return FlipXLeftOver::create(t, s);
    case 20: return FlipXRightOver::create(t, s);
    case 21: return FlipYUpOver::create(t, s);
    case 22: return FlipYDownOver::create(t, s);
    case 23: return FlipAngularLeftOver::create(t, s);
    case 24: return FlipAngularRightOver::create(t, s);

    case 25: return ZoomFlipXLeftOver::create(t, s);
    case 26: return ZoomFlipXRightOver::create(t, s);
    case 27: return ZoomFlipYUpOver::create(t, s);
    case 28: return ZoomFlipYDownOver::create(t, s);
    case 29: return ZoomFlipAngularLeftOver::create(t, s);
    case 30: return ZoomFlipAngularRightOver::create(t, s);

    case 31: return CCTransitionShrinkGrow::create(t, s);
    case 32: return CCTransitionRotoZoom::create(t, s);

    case 33: return CCTransitionMoveInL::create(t, s);
    case 34: return CCTransitionMoveInR::create(t, s);
    case 35: return CCTransitionMoveInT::create(t, s);
    case 36: return CCTransitionMoveInB::create(t, s);

    case 37: return CCTransitionSlideInL::create(t, s);
    case 38: return CCTransitionSlideInR::create(t, s);
    case 39: return CCTransitionSlideInT::create(t, s);
    case 40: 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);
    }    
}

 

posted on 2013-07-22 16:05  一枚程序  阅读(352)  评论(0编辑  收藏  举报