Cocos2dx switching between scenarios

Source: Internet
Author: User
1. Usage: If a normal scenario without transition has not yet been established (that is, the first scenario in the game), pDirector-runWithScene (pScene) is used. To replace a scenario, use CCDirector: sharedDirector ()-replaceScene (this); to replace the scenario. If you want to use the scenario

1. Usage: If a normal scenario without transition has not yet been established (that is, the first scenario in the game), pDirector-runWithScene (pScene) is used. To replace a scenario, use CCDirector: sharedDirector ()-replaceScene (this); to replace the scenario. If you want to use the scenario

1. Usage:

If a normal scenario without transition has not yet been established (that is, the first scenario in the game), you can use pDirector-> runWithScene (pScene.

To replace a scenario, use CCDirector: sharedDirector ()-> replaceScene (this); to replace the scenario.

If you want to use the switching effect between scenarios to switch the scenario, you need to use the corresponding switching method: transitionWithDuration (of course, the use of different effects is slightly different) to generate the corresponding scenario, then use CCDirector: sharedDirector ()-> replaceScene (this) to start the scenario. That is to say, this adds an outer packing for the scenario and then starts the scenario, this scenario is not directly displayed, but enters the scenario after the effect of the scenario is used up to achieve a transitional effect.

Generally, this function has two parameters. The first parameter is the special effect switching time. You can directly generate a CCTime. the time set in this example is 1.2 s, which is very comfortable for the display in many scenarios, the second is the scenario to be entered. Some may have a third parameter, which will be described below

2. Summary of results in test

CCTransitionJumpZoom: transitionWithDuration (t, s); // Skip. This scenario is reduced first and then jumped in.

CCTransitionFade: transitionWithDuration (t, s); // fade out, fade out in the original scenario, fade in the new scenario

CCTransitionFade: transitionWithDuration (t, s, ccWHITE); // if the previous function contains three parameters, the third parameter is the fade-out color.

CCTransitionFlipX: transitionWithDuration (t, s, kOrientationLeftOver); // Flip left on the X axis

CCTransitionFlipX: transitionWithDuration (t, s, kOrientationRightOver); // right flip of the X axis

CCTransitionFlipY: transitionWithDuration (t, s, kOrientationUpOver); // flip over the Y axis

CCTransitionFlipY: transitionWithDuration (t, s, kOrientationDownOver); // flip down the Y axis

CCTransitionFlipAngular: transitionWithDuration (t, s, kOrientationLeftOver); // turn left with an angle

CCTransitionFlipAngular: transitionWithDuration (t, s, kOrientationRightOver); // right flip with an angle

CCTransitionZoomFlipX: transitionWithDuration (t, s, kOrientationLeftOver); // zoomflipx with zoom Effect

CCTransitionZoomFlipX: transitionWithDuration (t, s, kOrientationRightOver); // right-flip X axis with zoom Effect

CCTransitionZoomFlipY: transitionWithDuration (t, s, kOrientationUpOver); // rotate the Y axis with the zoom Effect

CCTransitionZoomFlipY: transitionWithDuration (t, s, kOrientationDownOver); // y-axis flip with scaling effect

CCTransitionZoomFlipAnguLar: transitionWithDuration (t, s, kOrientationLeftOver); // zooming effect/left turn with Angle

CCTransitionZoomFlipAnguLar: transitionWithDuration (t, s, kOrientationRightOver); // right flip with zoom Effect

CCTransitionShrinkGrow: transitionWithDuration (t, s); // staggered

CCTransitionRotoZoom: transitionWithDuration (t, s); // corner change

CCTransitionMoveInL: transitionWithDuration (t, s); // the new scene is moved from left to overwrite.

CCTransitionMoveInR: transitionWithDuration (t, s); // the new scene is moved from right to overwrite.

CCTransitionMoveInT: transitionWithDuration (t, s); // overwrite a new scenario

CCTransitionMoveInB: transitionWithDuration (t, s); // new scenario moves from bottom to overwrite

CCTransitionSlideInL: transitionWithDuration (t, s); // The original scenario is introduced from the left.

CCTransitionSlideInR: transitionWithDuration (t, s); // The original scenario is introduced from right to right.

CCTransitionSlideInT: transitionWithDuration (t, s); // The original scenario is introduced from the previous scenario.

CCTransitionSlideInB: transitionWithDuration (t, s); // The scenario moves from the bottom to the original scenario.

The following three checks whether the opengl version supports CCConfiguration: sharedConfiguration ()-> getGlesVersion () <= GLES_VER_1_0. If it is true, it is not supported.

CCTransitionCrossFade: transitionWithDuration (t, s); // fade-in and cross

CCTransitionRadialCCW: transitionWithDuration (t, s); // clockwise cut-in

CCTransitionRadialCW: transitionWithDuration (t, s); //

Set the camera to CCDirector: shareddire()-> setDepthTest (true );

CCTransitionPageTurn: transitionWithDuration (t, s, false); // flip the page, front flip

CCTransitionPageTurn: transitionWithDuration (t, s, true); // flip the page.

CCTransitionFadeTR: transitionWithDuration (t, s); // wave to the right

CCTransitionFadeBL: transitionWithDuration (t, s); // wave to the lower left

CCTransitionFadeUp: transitionWithDuration (t, s); // shutter up

CCTransitionFadeDown: transitionWithDuration (t, s); // shutter down

CCTransitionTurnOffTiles: TransitionWithDuration (t, s); // random small square

CCTransitionSplitRows: transitionWithDuration (t, s); // cut by row

CCTransitionSplitCols: transitionWithDuration (t, s); // cut by Column

Http://www.cnblogs.com/linux-ios/archive/2013/04/09/3010779.html

// CCTransitionJumpZoom // role: Create a beating transition animation // parameter 1: Time of the transition action // parameter 2: switch to the object in the target scenario // reScene = CCTransitionJumpZoom :: create (t, s); // CCDirector: shareddire()-> replaceScene (reScene); // CCTransitionProgressRadialCCW // role: create a sector-shaped transition animation, // parameter 1: Time of the transition action // parameter 2: the object to be switched to the target scenario // reScene = CCTransitionProgressRadialCCW: create (t, s); // CCDirector :: sharedDirector ()-> replaceScene (reScene); // CCTransitionProgressRadialCW // role: create a sector-shaped transition animation, clockwise. // parameter 1: time of the transition action // parameter 2: the object to be switched to the target scenario // reScene = CCTransitionProgressRadialCW: create (t, s); // CCDirector: shareddire () -> replaceScene (reScene); // CCTransitionProgressHorizontal // role: Create a horizontal transition animation. // parameter 1: Time of the transition action // parameter 2: switch to the target scenario object // reScene = CCTransitionProgressHorizontal: create (t, s); // CCDirector: sharedDirector ()-> replaceScene (reScene ); // CCTransitionProgressVertical // role: Create a vertical transition animation, // parameter 1: Time of the transition action // parameter 2: switch to the target scenario object // reScene = CCTransitionProgressVertical: create (t, s); // CCDirector: shareddire()-> replaceScene (reScene ); // CCTransitionProgressInOut // function: Create a transition animation extending from the inside to the outside. // parameter 1: Time of the transition action // parameter 2: switch to the target scenario object // reScene = CCTransitionProgressInOut: create (t, s); // CCDirector: shareddire()-> replaceScene (reScene ); // CCTransitionProgressOutIn // role: Create a transition animation that is extended from the external, // parameter 1: Time of the transition action // parameter 2: switch to the target scenario object // reScene = CCTransitionProgressOutIn: create (t, s); // CCDirector: sharedDirector ()-> replaceScene (reScene ); // CCTransitionCrossFade // function: Create a gradually transparent transition animation // parameter 1: Time of the transition action // parameter 2: the object to be switched to the target scenario // reScene = CCTransitionCrossFade :: create (t, s); // CCDirector: shareddire()-> replaceScene (reScene); // CCTransitionPageTurn // create a page flip transition animation // parameter 1: duration of the transition action // parameter 2: the object of the switched target scenario // parameter 3: whether to Reverse flip/reScene = CCTransitionPageTurn: create (t, s, false ); // CCDirector: sharedDirector ()-> replaceScene (reScene); // CCTransitionFadeTR // role: Create a blog transition animation, from bottom left to top right // parameter 1: duration of the transition action // parameter 2: Object of the switched target scenario // reScene = CCTransitionFadeTR: create (t, s); // CCDirector: shareddire () -> replaceScene (reScene); // CCTransitionFadeBL // role: Create a blog transition animation, from top right to bottom left // parameter 1: duration of the Transition action // parameter 2: the object of the switched target scenario // reScene = CCTransitionFadeBL: create (t, s); // CCDirector: shareddire()-> replaceScene (reScene ); // CCTransitionFadeUp // role: Create a transition animation for bottom-to-top and bar collapse. // parameter 1: duration of the Transition action. // parameter 2: the object of the switched target scenario // reScene = CCTransitionFadeUp: create (t, s); // CCDirector: shareddire()-> replaceScene (s ); // CCTransitionFadeDown // role: Create a transition animation from top to bottom, and fold the bar. // parameter 1: duration of the Transition action. // parameter 2: the object of the switched target scenario // reScene = CCTransitionFadeDown: create (t, s); // CCDirector: shareddire()-> replaceScene (reScene ); // CCTransitionTurnOffTiles // role: Create a transition animation with a random square disappear // parameter 1: duration of the Transition action // parameter 2: the object of the switched target scenario // reScene = CCTransitionTurnOffTiles: create (t, s); // CCDirector: sharedDirector ()-> replaceScene (reScene ); // CCTransitionSplitRows // function: Create a transition animation for branch division switching. // parameter 1: duration of the Transition action. // parameter 2: the object of the switched target scenario // reScene = CCTransitionSplitRows: create (t, s); // CCDirector: shareddire()-> replaceScene (reScene ); // CCTransitionSplitCols // role: Create a transition animation for the partition switch. // parameter 1: duration of the Transition action. // parameter 2: the object of the switched target scenario // reScene = CCTransitionSplitCols: create (t, s); // CCDirector: shareddire()-> replaceScene (reScene ); // CCTransitionFade // role: Create an animation for switching from gradual transition to the target color // parameter 1: duration of the Transition action // parameter 2: object of the switched target scenario // parameter 3: Target color // reScene = CCTransitionFade: create (t, s, ccc3 (255, 0, 0); // CCDirector:: sharedDirector ()-> replaceScene (reScene); // CCTransitionFlipX // role: Create a switching animation for X axis reversal. // parameter 1: duration of the Transition action. // parameter 2: object of the switched target scenario // parameter 3: Reverse type of enumeration variables up and down // kOrientationDownOver implements kOrientationRightOver kOrientationUpOver // reScene = CCTransitionFlipX: create (t, s, limit ); // CCDirector: sharedDirector ()-> replaceScene (reScene); // CCTransitionFlipY // parameter 1: duration of the Transition action // parameter 2: object of the switched target scenario // parameter 3: Up and down of the reverse enumeration variable // reScene = CCTransitionFlipY: create (t, s //, kOrientationDownOver); // CCDirector:: sharedDirector ()-> replaceScene (reScene); // CCTransitionFlipAngular // role: Create an animation with Reverse Rotation switching /// parameter 1: duration of the transition action // parameter 2: object in the switched target scenario // parameter 3: Up or down the reversed enumerated variable // reScene = CCTransitionFlipAngular: create (t, s, kOrientationLeftOver); // CCDirector: sharedDirector ()-> replaceScene (reScene); // CCTransitionZoomFlipX // role: create an animation with a scaled X axis reversal switch // parameter 1: duration of the Transition action // parameter 2: Object of the switched target scenario // parameter 3: reverse type enumeration variables up and down // reScene = CCTransitionZoomFlipX: create (t, s, kOrientationLeftOver); // CCDirector: shareddire()-> replaceScene (reScene ); // CCTransitionZoomFlipY // function: Create an animation with the scaled Y axis reversal switch // parameter 1: duration of the Transition action // parameter 2: object of the switched target scenario // parameter 3: Up or down the enumerated variable of the Reverse type // reScene = CCTransitionZoomFlipY: create (t, s, kOrientationDownOver); // CCDirector :: sharedDirector ()-> replaceScene (reScene); // CCTransitionZoomFlipAngular // role: Create an animation with scaling and Reverse Rotation switching // parameter 1: duration of the transition action // parameter 2: object in the switched target scenario // parameter 3: Up or down the reversed enumerated variable // reScene = CCTransitionZoomFlipAngular: create (t, s, kOrientationRightOver); // CCDirector: sharedDirector ()-> replaceScene (reScene); // CCTransitionShrinkGrow // create an alternate transition animation with the following parameters: duration of the transition action // parameter 2: Object of the switched target scenario // reScene = CCTransitionShrinkGrow: create (t, s); // CCDirector: shareddire () -> replaceScene (reScene); // CCTransitionRotoZoom // create a transition animation with rotation and contraction alternating; // parameter 1: duration of the Transition action // parameter 2: the object of the switched target scenario // reScene = CCTransitionRotoZoom: create (t, s); // CCDirector: shareddire()-> replaceScene (reScene ); // CCTransitionMoveInL // role: Create a transition animation pushed from the Left to overwrite // parameter 1: duration of the Transition action // parameter 2: the object of the switched target scenario // reScene = CCTransitionMoveInL: create (t, s); // CCDirector: shareddire()-> replaceScene (reScene ); // CCTransitionMoveInR // role: Create a transition animation push from the right to overwrite // parameter 1: duration of the Transition action // parameter 2: the object of the switched target scenario // reScene = CCTransitionMoveInR: create (t, s); // CCDirector: shareddire()-> replaceScene (reScene ); // CCTransitionMoveInB // role: Create a transition animation pushed from the bottom to overwrite // parameter 1: duration of the Transition action // parameter 2: the object of the switched target scenario // reScene = CCTransitionMoveInB: create (t, s); // CCDirector: shareddire()-> replaceScene (reScene ); // CCTransitionMoveInT // role: Create a transition animation pushed from top to overwrite // parameter 1: duration of the Transition action // parameter 2: the object of the switched target scenario // reScene = CCTransitionMoveInT: create (t, s); // CCDirector: shareddire()-> replaceScene (reScene ); // CCTransitionSlideInL // role: Create a transition animation pushed from the left and pushed out of the old scene // parameter 1: duration of the Transition action // parameter 2: the object of the switched target scenario // reScene = CCTransitionSlideInL: create (t, s); // CCDirector: shareddire()-> replaceScene (reScene ); // CCTransitionSlideInR // role: Create a transition animation pushed from the right to the original scene. // parameter 1: duration of the Transition action. // parameter 2: the object of the switched target scenario // reScene = CCTransitionSlideInR: create (t, s); // CCDirector: shareddire()-> replaceScene (reScene ); // CCTransitionSlideInT // role: Create a transition animation pushed from the top and pushed out of the old scene // parameter 1: duration of the Transition action // parameter 2: the object of the switched target scenario // reScene = CCTransitionSlideInT: create (t, s); // CCDirector: shareddire()-> replaceScene (reScene ); // CCTransitionSlideInB // role: Create a transition animation pushed from the lower part and pushed out of the old scene // parameter 1: duration of the Transition action // parameter 2: reScene = CCTransitionSlideInB: create (t, s); CCDirector: shareddire()-> replaceScene (reScene );

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.