summary refs log tree commit diff stats
path: root/libs/cocos2d/CCTransition.h
blob: e37d3e82e45676da14fdd79d1e067821e88640f6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
/*
 * cocos2d for iPhone: http://www.cocos2d-iphone.org
 *
 * Copyright (c) 2008-2010 Ricardo Quesada
 * Copyright (c) 2011 Zynga Inc.
 * 
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 * 
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 * 
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 *
 */


#import "CCScene.h"
@class CCActionInterval;
@class CCNode;

/** CCTransitionEaseScene can ease the actions of the scene protocol.
 @since v0.8.2
 */
@protocol CCTransitionEaseScene <NSObject>
/** returns the Ease action that will be performed on a linear action.
 @since v0.8.2
 */
-(CCActionInterval*) easeActionWithAction:(CCActionInterval*)action;
@end

/** Orientation Type used by some transitions
 */
typedef enum {
	/// An horizontal orientation where the Left is nearer
	kOrientationLeftOver = 0,
	/// An horizontal orientation where the Right is nearer
	kOrientationRightOver = 1,
	/// A vertical orientation where the Up is nearer
	kOrientationUpOver = 0,
	/// A vertical orientation where the Bottom is nearer
	kOrientationDownOver = 1,
} tOrientation;

/** Base class for CCTransition scenes
 */
@interface CCTransitionScene : CCScene
{
	CCScene	*inScene_;
	CCScene	*outScene_;
	ccTime	duration_;
	BOOL	inSceneOnTop_;
	BOOL	sendCleanupToScene_;
}
/** creates a base transition with duration and incoming scene */
+(id) transitionWithDuration:(ccTime) t scene:(CCScene*)s;
/** initializes a transition with duration and incoming scene */
-(id) initWithDuration:(ccTime) t scene:(CCScene*)s;
/** called after the transition finishes */
-(void) finish;
/** used by some transitions to hide the outter scene */
-(void) hideOutShowIn;
@end

/** A CCTransition that supports orientation like.
 * Possible orientation: LeftOver, RightOver, UpOver, DownOver
 */
@interface CCTransitionSceneOriented : CCTransitionScene
{
	tOrientation orientation;
}
/** creates a base transition with duration and incoming scene */
+(id) transitionWithDuration:(ccTime) t scene:(CCScene*)s orientation:(tOrientation)o;
/** initializes a transition with duration and incoming scene */
-(id) initWithDuration:(ccTime) t scene:(CCScene*)s orientation:(tOrientation)o;
@end


/** CCTransitionRotoZoom:
 Rotate and zoom out the outgoing scene, and then rotate and zoom in the incoming 
 */
@interface CCTransitionRotoZoom : CCTransitionScene
{}
@end

/** CCTransitionJumpZoom:
 Zoom out and jump the outgoing scene, and then jump and zoom in the incoming 
*/
@interface CCTransitionJumpZoom : CCTransitionScene
{}
@end

/** CCTransitionMoveInL:
 Move in from to the left the incoming scene.
*/
@interface CCTransitionMoveInL : CCTransitionScene <CCTransitionEaseScene>
{}
/** initializes the scenes */
-(void) initScenes;
/** returns the action that will be performed */
-(CCActionInterval*) action;
@end

/** CCTransitionMoveInR:
 Move in from to the right the incoming scene.
 */
@interface CCTransitionMoveInR : CCTransitionMoveInL
{}
@end

/** CCTransitionMoveInT:
 Move in from to the top the incoming scene.
 */
@interface CCTransitionMoveInT : CCTransitionMoveInL 
{}
@end

/** CCTransitionMoveInB:
 Move in from to the bottom the incoming scene.
 */
@interface CCTransitionMoveInB : CCTransitionMoveInL
{}
@end

/** CCTransitionSlideInL:
 Slide in the incoming scene from the left border.
 */
@interface CCTransitionSlideInL : CCTransitionScene <CCTransitionEaseScene>
{}
/** initializes the scenes */
-(void) initScenes;
/** returns the action that will be performed by the incomming and outgoing scene */
-(CCActionInterval*) action;
@end

/** CCTransitionSlideInR:
 Slide in the incoming scene from the right border.
 */
@interface CCTransitionSlideInR : CCTransitionSlideInL 
{}
@end

/** CCTransitionSlideInB:
 Slide in the incoming scene from the bottom border.
 */
@interface CCTransitionSlideInB : CCTransitionSlideInL
{}
@end

/** CCTransitionSlideInT:
 Slide in the incoming scene from the top border.
 */
@interface CCTransitionSlideInT : CCTransitionSlideInL
{}
@end

/**
 Shrink the outgoing scene while grow the incoming scene
 */
@interface CCTransitionShrinkGrow : CCTransitionScene <CCTransitionEaseScene>
{}
@end

/** CCTransitionFlipX:
 Flips the screen horizontally.
 The front face is the outgoing scene and the back face is the incoming scene.
 */
@interface CCTransitionFlipX : CCTransitionSceneOriented
{}
@end

/** CCTransitionFlipY:
 Flips the screen vertically.
 The front face is the outgoing scene and the back face is the incoming scene.
 */
@interface CCTransitionFlipY : CCTransitionSceneOriented
{}
@end

/** CCTransitionFlipAngular:
 Flips the screen half horizontally and half vertically.
 The front face is the outgoing scene and the back face is the incoming scene.
 */
@interface CCTransitionFlipAngular : CCTransitionSceneOriented
{}
@end

/** CCTransitionZoomFlipX:
 Flips the screen horizontally doing a zoom out/in
 The front face is the outgoing scene and the back face is the incoming scene.
 */
@interface CCTransitionZoomFlipX : CCTransitionSceneOriented
{}
@end

/** CCTransitionZoomFlipY:
 Flips the screen vertically doing a little zooming out/in
 The front face is the outgoing scene and the back face is the incoming scene.
 */
@interface CCTransitionZoomFlipY : CCTransitionSceneOriented
{}
@end

/** CCTransitionZoomFlipAngular:
 Flips the screen half horizontally and half vertically doing a little zooming out/in.
 The front face is the outgoing scene and the back face is the incoming scene.
 */
@interface CCTransitionZoomFlipAngular : CCTransitionSceneOriented
{}
@end

/** CCTransitionFade:
 Fade out the outgoing scene and then fade in the incoming scene.'''
 */
@interface CCTransitionFade : CCTransitionScene
{
	ccColor4B	color;
}
/** creates the transition with a duration and with an RGB color
 * Example: [FadeTransition transitionWithDuration:2 scene:s withColor:ccc3(255,0,0)]; // red color
 */
+(id) transitionWithDuration:(ccTime)duration scene:(CCScene*)scene withColor:(ccColor3B)color;
/** initializes the transition with a duration and with an RGB color */
-(id) initWithDuration:(ccTime)duration scene:(CCScene*)scene withColor:(ccColor3B)color;
@end


/**
 CCTransitionCrossFade:
 Cross fades two scenes using the CCRenderTexture object.
 */
@class CCRenderTexture;
@interface CCTransitionCrossFade : CCTransitionScene
{}
@end

/** CCTransitionTurnOffTiles:
 Turn off the tiles of the outgoing scene in random order
 */
@interface CCTransitionTurnOffTiles : CCTransitionScene <CCTransitionEaseScene>
{}
@end

/** CCTransitionSplitCols:
 The odd columns goes upwards while the even columns goes downwards.
 */
@interface CCTransitionSplitCols : CCTransitionScene <CCTransitionEaseScene>
{}
-(CCActionInterval*) action;
@end

/** CCTransitionSplitRows:
 The odd rows goes to the left while the even rows goes to the right.
 */
@interface CCTransitionSplitRows : CCTransitionSplitCols
{}
@end

/** CCTransitionFadeTR:
 Fade the tiles of the outgoing scene from the left-bottom corner the to top-right corner.
 */
@interface CCTransitionFadeTR : CCTransitionScene <CCTransitionEaseScene>
{}
-(CCActionInterval*) actionWithSize:(ccGridSize) vector;
@end

/** CCTransitionFadeBL:
 Fade the tiles of the outgoing scene from the top-right corner to the bottom-left corner.
 */
@interface CCTransitionFadeBL : CCTransitionFadeTR
{}
@end

/** CCTransitionFadeUp:
 * Fade the tiles of the outgoing scene from the bottom to the top.
 */
@interface CCTransitionFadeUp : CCTransitionFadeTR
{}
@end

/** CCTransitionFadeDown:
 * Fade the tiles of the outgoing scene from the top to the bottom.
 */
@interface CCTransitionFadeDown : CCTransitionFadeTR
{}
@end