PageRenderTime 50ms CodeModel.GetById 17ms RepoModel.GetById 0ms app.codeStats 0ms

/libs/cocos2d/CCTransition.h

http://github.com/kstenerud/ObjectAL-for-iPhone
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. #import "CCScene.h"
  26. @class CCIntervalAction;
  27. @class CCNode;
  28. /** CCTransitionEaseScene can ease the actions of the scene protocol.
  29. @since v0.8.2
  30. */
  31. @protocol CCTransitionEaseScene <NSObject>
  32. /** returns the Ease action that will be performed on a linear action.
  33. @since v0.8.2
  34. */
  35. -(CCIntervalAction*) easeActionWithAction:(CCIntervalAction*)action;
  36. @end
  37. /** Orientation Type used by some transitions
  38. */
  39. typedef enum {
  40. /// An horizontal orientation where the Left is nearer
  41. kOrientationLeftOver = 0,
  42. /// An horizontal orientation where the Right is nearer
  43. kOrientationRightOver = 1,
  44. /// A vertical orientation where the Up is nearer
  45. kOrientationUpOver = 0,
  46. /// A vertical orientation where the Bottom is nearer
  47. kOrientationDownOver = 1,
  48. } tOrientation;
  49. /** Base class for CCTransition scenes
  50. */
  51. @interface CCTransitionScene : CCScene {
  52. CCScene *inScene;
  53. CCScene *outScene;
  54. ccTime duration;
  55. BOOL inSceneOnTop;
  56. BOOL sendCleanupToScene;
  57. }
  58. /** creates a base transition with duration and incoming scene */
  59. +(id) transitionWithDuration:(ccTime) t scene:(CCScene*)s;
  60. /** initializes a transition with duration and incoming scene */
  61. -(id) initWithDuration:(ccTime) t scene:(CCScene*)s;
  62. /** called after the transition finishes */
  63. -(void) finish;
  64. /** used by some transitions to hide the outter scene */
  65. -(void) hideOutShowIn;
  66. @end
  67. /** A CCTransition that supports orientation like.
  68. * Possible orientation: LeftOver, RightOver, UpOver, DownOver
  69. */
  70. @interface CCOrientedTransitionScene : CCTransitionScene
  71. {
  72. tOrientation orientation;
  73. }
  74. /** creates a base transition with duration and incoming scene */
  75. +(id) transitionWithDuration:(ccTime) t scene:(CCScene*)s orientation:(tOrientation)o;
  76. /** initializes a transition with duration and incoming scene */
  77. -(id) initWithDuration:(ccTime) t scene:(CCScene*)s orientation:(tOrientation)o;
  78. @end
  79. /** CCRotoZoomTransition:
  80. Rotate and zoom out the outgoing scene, and then rotate and zoom in the incoming
  81. */
  82. @interface CCRotoZoomTransition : CCTransitionScene
  83. {}
  84. @end
  85. /** CCJumpZoomTransition:
  86. Zoom out and jump the outgoing scene, and then jump and zoom in the incoming
  87. */
  88. @interface CCJumpZoomTransition : CCTransitionScene
  89. {}
  90. @end
  91. /** CCMoveInLTransition:
  92. Move in from to the left the incoming scene.
  93. */
  94. @interface CCMoveInLTransition : CCTransitionScene <CCTransitionEaseScene>
  95. {}
  96. /** initializes the scenes */
  97. -(void) initScenes;
  98. /** returns the action that will be performed */
  99. -(CCIntervalAction*) action;
  100. @end
  101. /** CCMoveInRTransition:
  102. Move in from to the right the incoming scene.
  103. */
  104. @interface CCMoveInRTransition : CCMoveInLTransition
  105. {}
  106. @end
  107. /** CCMoveInTTransition:
  108. Move in from to the top the incoming scene.
  109. */
  110. @interface CCMoveInTTransition : CCMoveInLTransition
  111. {}
  112. @end
  113. /** CCMoveInBTransition:
  114. Move in from to the bottom the incoming scene.
  115. */
  116. @interface CCMoveInBTransition : CCMoveInLTransition
  117. {}
  118. @end
  119. /** CCSlideInLTransition:
  120. Slide in the incoming scene from the left border.
  121. */
  122. @interface CCSlideInLTransition : CCTransitionScene <CCTransitionEaseScene>
  123. {}
  124. /** initializes the scenes */
  125. -(void) initScenes;
  126. /** returns the action that will be performed by the incomming and outgoing scene */
  127. -(CCIntervalAction*) action;
  128. @end
  129. /** CCSlideInRTransition:
  130. Slide in the incoming scene from the right border.
  131. */
  132. @interface CCSlideInRTransition : CCSlideInLTransition
  133. {}
  134. @end
  135. /** CCSlideInBTransition:
  136. Slide in the incoming scene from the bottom border.
  137. */
  138. @interface CCSlideInBTransition : CCSlideInLTransition
  139. {}
  140. @end
  141. /** CCSlideInTTransition:
  142. Slide in the incoming scene from the top border.
  143. */
  144. @interface CCSlideInTTransition : CCSlideInLTransition
  145. {}
  146. @end
  147. /**
  148. Shrink the outgoing scene while grow the incoming scene
  149. */
  150. @interface CCShrinkGrowTransition : CCTransitionScene <CCTransitionEaseScene>
  151. {}
  152. @end
  153. /** CCFlipXTransition:
  154. Flips the screen horizontally.
  155. The front face is the outgoing scene and the back face is the incoming scene.
  156. */
  157. @interface CCFlipXTransition : CCOrientedTransitionScene
  158. {}
  159. @end
  160. /** CCFlipYTransition:
  161. Flips the screen vertically.
  162. The front face is the outgoing scene and the back face is the incoming scene.
  163. */
  164. @interface CCFlipYTransition : CCOrientedTransitionScene
  165. {}
  166. @end
  167. /** CCFlipAngularTransition:
  168. Flips the screen half horizontally and half vertically.
  169. The front face is the outgoing scene and the back face is the incoming scene.
  170. */
  171. @interface CCFlipAngularTransition : CCOrientedTransitionScene
  172. {}
  173. @end
  174. /** CCZoomFlipXTransition:
  175. Flips the screen horizontally doing a zoom out/in
  176. The front face is the outgoing scene and the back face is the incoming scene.
  177. */
  178. @interface CCZoomFlipXTransition : CCOrientedTransitionScene
  179. {
  180. }
  181. @end
  182. /** CCZoomFlipYTransition:
  183. Flips the screen vertically doing a little zooming out/in
  184. The front face is the outgoing scene and the back face is the incoming scene.
  185. */
  186. @interface CCZoomFlipYTransition : CCOrientedTransitionScene
  187. {}
  188. @end
  189. /** CCZoomFlipAngularTransition:
  190. Flips the screen half horizontally and half vertically doing a little zooming out/in.
  191. The front face is the outgoing scene and the back face is the incoming scene.
  192. */
  193. @interface CCZoomFlipAngularTransition : CCOrientedTransitionScene
  194. {}
  195. @end
  196. /** CCFadeTransition:
  197. Fade out the outgoing scene and then fade in the incoming scene.'''
  198. */
  199. @interface CCFadeTransition : CCTransitionScene
  200. {
  201. ccColor4B color;
  202. }
  203. /** creates the transition with a duration and with an RGB color
  204. * Example: [FadeTransition transitionWithDuration:2 scene:s withColor:ccc3(255,0,0)]; // red color
  205. */
  206. +(id) transitionWithDuration:(ccTime)duration scene:(CCScene*)scene withColor:(ccColor3B)color;
  207. /** initializes the transition with a duration and with an RGB color */
  208. -(id) initWithDuration:(ccTime)duration scene:(CCScene*)scene withColor:(ccColor3B)color;
  209. @end
  210. /**
  211. CCCrossFadeTransition:
  212. Cross fades two scenes using the CCRenderTexture object.
  213. */
  214. @class CCRenderTexture;
  215. @interface CCCrossFadeTransition : CCTransitionScene
  216. {
  217. }
  218. @end
  219. /** CCTurnOffTilesTransition:
  220. Turn off the tiles of the outgoing scene in random order
  221. */
  222. @interface CCTurnOffTilesTransition : CCTransitionScene <CCTransitionEaseScene>
  223. {}
  224. @end
  225. /** CCSplitColsTransition:
  226. The odd columns goes upwards while the even columns goes downwards.
  227. */
  228. @interface CCSplitColsTransition : CCTransitionScene <CCTransitionEaseScene>
  229. {}
  230. -(CCIntervalAction*) action;
  231. @end
  232. /** CCSplitRowsTransition:
  233. The odd rows goes to the left while the even rows goes to the right.
  234. */
  235. @interface CCSplitRowsTransition : CCSplitColsTransition
  236. {}
  237. @end
  238. /** CCFadeTRTransition:
  239. Fade the tiles of the outgoing scene from the left-bottom corner the to top-right corner.
  240. */
  241. @interface CCFadeTRTransition : CCTransitionScene <CCTransitionEaseScene>
  242. {}
  243. -(CCIntervalAction*) actionWithSize:(ccGridSize) vector;
  244. @end
  245. /** CCFadeBLTransition:
  246. Fade the tiles of the outgoing scene from the top-right corner to the bottom-left corner.
  247. */
  248. @interface CCFadeBLTransition : CCFadeTRTransition
  249. {}
  250. @end
  251. /** CCFadeUpTransition:
  252. * Fade the tiles of the outgoing scene from the bottom to the top.
  253. */
  254. @interface CCFadeUpTransition : CCFadeTRTransition
  255. {}
  256. @end
  257. /** CCFadeDownTransition:
  258. * Fade the tiles of the outgoing scene from the top to the bottom.
  259. */
  260. @interface CCFadeDownTransition : CCFadeTRTransition
  261. {}
  262. @end