/libs/cocos2d/CCTransition.h
C Header | 295 lines | 122 code | 33 blank | 140 comment | 0 complexity | 72eeb073c8d38350a4890e9bb018bc0e MD5 | raw file
Possible License(s): Apache-2.0
1/* 2 * cocos2d for iPhone: http://www.cocos2d-iphone.org 3 * 4 * Copyright (c) 2008-2010 Ricardo Quesada 5 * 6 * Permission is hereby granted, free of charge, to any person obtaining a copy 7 * of this software and associated documentation files (the "Software"), to deal 8 * in the Software without restriction, including without limitation the rights 9 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 * copies of the Software, and to permit persons to whom the Software is 11 * furnished to do so, subject to the following conditions: 12 * 13 * The above copyright notice and this permission notice shall be included in 14 * all copies or substantial portions of the Software. 15 * 16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 * THE SOFTWARE. 23 * 24 */ 25 26 27#import "CCScene.h" 28@class CCIntervalAction; 29@class CCNode; 30 31/** CCTransitionEaseScene can ease the actions of the scene protocol. 32 @since v0.8.2 33 */ 34@protocol CCTransitionEaseScene <NSObject> 35/** returns the Ease action that will be performed on a linear action. 36 @since v0.8.2 37 */ 38-(CCIntervalAction*) easeActionWithAction:(CCIntervalAction*)action; 39@end 40 41/** Orientation Type used by some transitions 42 */ 43typedef enum { 44 /// An horizontal orientation where the Left is nearer 45 kOrientationLeftOver = 0, 46 /// An horizontal orientation where the Right is nearer 47 kOrientationRightOver = 1, 48 /// A vertical orientation where the Up is nearer 49 kOrientationUpOver = 0, 50 /// A vertical orientation where the Bottom is nearer 51 kOrientationDownOver = 1, 52} tOrientation; 53 54/** Base class for CCTransition scenes 55 */ 56@interface CCTransitionScene : CCScene { 57 CCScene *inScene; 58 CCScene *outScene; 59 ccTime duration; 60 BOOL inSceneOnTop; 61 BOOL sendCleanupToScene; 62} 63/** creates a base transition with duration and incoming scene */ 64+(id) transitionWithDuration:(ccTime) t scene:(CCScene*)s; 65/** initializes a transition with duration and incoming scene */ 66-(id) initWithDuration:(ccTime) t scene:(CCScene*)s; 67/** called after the transition finishes */ 68-(void) finish; 69/** used by some transitions to hide the outter scene */ 70-(void) hideOutShowIn; 71@end 72 73/** A CCTransition that supports orientation like. 74 * Possible orientation: LeftOver, RightOver, UpOver, DownOver 75 */ 76@interface CCOrientedTransitionScene : CCTransitionScene 77{ 78 tOrientation orientation; 79} 80/** creates a base transition with duration and incoming scene */ 81+(id) transitionWithDuration:(ccTime) t scene:(CCScene*)s orientation:(tOrientation)o; 82/** initializes a transition with duration and incoming scene */ 83-(id) initWithDuration:(ccTime) t scene:(CCScene*)s orientation:(tOrientation)o; 84@end 85 86 87/** CCRotoZoomTransition: 88 Rotate and zoom out the outgoing scene, and then rotate and zoom in the incoming 89 */ 90@interface CCRotoZoomTransition : CCTransitionScene 91{} 92@end 93 94/** CCJumpZoomTransition: 95 Zoom out and jump the outgoing scene, and then jump and zoom in the incoming 96*/ 97@interface CCJumpZoomTransition : CCTransitionScene 98{} 99@end 100 101/** CCMoveInLTransition: 102 Move in from to the left the incoming scene. 103*/ 104@interface CCMoveInLTransition : CCTransitionScene <CCTransitionEaseScene> 105{} 106/** initializes the scenes */ 107-(void) initScenes; 108/** returns the action that will be performed */ 109-(CCIntervalAction*) action; 110@end 111 112/** CCMoveInRTransition: 113 Move in from to the right the incoming scene. 114 */ 115@interface CCMoveInRTransition : CCMoveInLTransition 116{} 117@end 118 119/** CCMoveInTTransition: 120 Move in from to the top the incoming scene. 121 */ 122@interface CCMoveInTTransition : CCMoveInLTransition 123{} 124@end 125 126/** CCMoveInBTransition: 127 Move in from to the bottom the incoming scene. 128 */ 129@interface CCMoveInBTransition : CCMoveInLTransition 130{} 131@end 132 133/** CCSlideInLTransition: 134 Slide in the incoming scene from the left border. 135 */ 136@interface CCSlideInLTransition : CCTransitionScene <CCTransitionEaseScene> 137{} 138/** initializes the scenes */ 139-(void) initScenes; 140/** returns the action that will be performed by the incomming and outgoing scene */ 141-(CCIntervalAction*) action; 142@end 143 144/** CCSlideInRTransition: 145 Slide in the incoming scene from the right border. 146 */ 147@interface CCSlideInRTransition : CCSlideInLTransition 148{} 149@end 150 151/** CCSlideInBTransition: 152 Slide in the incoming scene from the bottom border. 153 */ 154@interface CCSlideInBTransition : CCSlideInLTransition 155{} 156@end 157 158/** CCSlideInTTransition: 159 Slide in the incoming scene from the top border. 160 */ 161@interface CCSlideInTTransition : CCSlideInLTransition 162{} 163@end 164 165/** 166 Shrink the outgoing scene while grow the incoming scene 167 */ 168@interface CCShrinkGrowTransition : CCTransitionScene <CCTransitionEaseScene> 169{} 170@end 171 172/** CCFlipXTransition: 173 Flips the screen horizontally. 174 The front face is the outgoing scene and the back face is the incoming scene. 175 */ 176@interface CCFlipXTransition : CCOrientedTransitionScene 177{} 178@end 179 180/** CCFlipYTransition: 181 Flips the screen vertically. 182 The front face is the outgoing scene and the back face is the incoming scene. 183 */ 184@interface CCFlipYTransition : CCOrientedTransitionScene 185{} 186@end 187 188/** CCFlipAngularTransition: 189 Flips the screen half horizontally and half vertically. 190 The front face is the outgoing scene and the back face is the incoming scene. 191 */ 192@interface CCFlipAngularTransition : CCOrientedTransitionScene 193{} 194@end 195 196/** CCZoomFlipXTransition: 197 Flips the screen horizontally doing a zoom out/in 198 The front face is the outgoing scene and the back face is the incoming scene. 199 */ 200@interface CCZoomFlipXTransition : CCOrientedTransitionScene 201{ 202} 203@end 204 205/** CCZoomFlipYTransition: 206 Flips the screen vertically doing a little zooming out/in 207 The front face is the outgoing scene and the back face is the incoming scene. 208 */ 209@interface CCZoomFlipYTransition : CCOrientedTransitionScene 210{} 211@end 212 213/** CCZoomFlipAngularTransition: 214 Flips the screen half horizontally and half vertically doing a little zooming out/in. 215 The front face is the outgoing scene and the back face is the incoming scene. 216 */ 217@interface CCZoomFlipAngularTransition : CCOrientedTransitionScene 218{} 219@end 220 221/** CCFadeTransition: 222 Fade out the outgoing scene and then fade in the incoming scene.''' 223 */ 224@interface CCFadeTransition : CCTransitionScene 225{ 226 ccColor4B color; 227} 228/** creates the transition with a duration and with an RGB color 229 * Example: [FadeTransition transitionWithDuration:2 scene:s withColor:ccc3(255,0,0)]; // red color 230 */ 231+(id) transitionWithDuration:(ccTime)duration scene:(CCScene*)scene withColor:(ccColor3B)color; 232/** initializes the transition with a duration and with an RGB color */ 233-(id) initWithDuration:(ccTime)duration scene:(CCScene*)scene withColor:(ccColor3B)color; 234@end 235 236/** 237 CCCrossFadeTransition: 238 Cross fades two scenes using the CCRenderTexture object. 239 */ 240@class CCRenderTexture; 241@interface CCCrossFadeTransition : CCTransitionScene 242{ 243} 244@end 245 246/** CCTurnOffTilesTransition: 247 Turn off the tiles of the outgoing scene in random order 248 */ 249@interface CCTurnOffTilesTransition : CCTransitionScene <CCTransitionEaseScene> 250{} 251@end 252 253/** CCSplitColsTransition: 254 The odd columns goes upwards while the even columns goes downwards. 255 */ 256@interface CCSplitColsTransition : CCTransitionScene <CCTransitionEaseScene> 257{} 258-(CCIntervalAction*) action; 259@end 260 261/** CCSplitRowsTransition: 262 The odd rows goes to the left while the even rows goes to the right. 263 */ 264@interface CCSplitRowsTransition : CCSplitColsTransition 265{} 266@end 267 268/** CCFadeTRTransition: 269 Fade the tiles of the outgoing scene from the left-bottom corner the to top-right corner. 270 */ 271@interface CCFadeTRTransition : CCTransitionScene <CCTransitionEaseScene> 272{} 273-(CCIntervalAction*) actionWithSize:(ccGridSize) vector; 274@end 275 276/** CCFadeBLTransition: 277 Fade the tiles of the outgoing scene from the top-right corner to the bottom-left corner. 278 */ 279@interface CCFadeBLTransition : CCFadeTRTransition 280{} 281@end 282 283/** CCFadeUpTransition: 284 * Fade the tiles of the outgoing scene from the bottom to the top. 285 */ 286@interface CCFadeUpTransition : CCFadeTRTransition 287{} 288@end 289 290/** CCFadeDownTransition: 291 * Fade the tiles of the outgoing scene from the top to the bottom. 292 */ 293@interface CCFadeDownTransition : CCFadeTRTransition 294{} 295@end