joybox 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (204) hide show
  1. checksums.yaml +15 -0
  2. data/.gitignore +18 -0
  3. data/Gemfile +6 -0
  4. data/Gemfile.lock +27 -0
  5. data/LICENSE +22 -0
  6. data/README.md +86 -0
  7. data/Rakefile +14 -0
  8. data/app/app_delegate.rb +49 -0
  9. data/app/layers/box2d_layer.rb +109 -0
  10. data/app/layers/cocos2d_layer.rb +14 -0
  11. data/app/layers/cocos_motion_layer.rb +145 -0
  12. data/app/layers/menu_layer.rb +59 -0
  13. data/joybox.gemspec +25 -0
  14. data/lib/joybox.rb +47 -0
  15. data/lib/joybox/box2d/body.rb +106 -0
  16. data/lib/joybox/box2d/world.rb +79 -0
  17. data/lib/joybox/cocos2d/actions/actions.rb +7 -0
  18. data/lib/joybox/cocos2d/actions/move.rb +31 -0
  19. data/lib/joybox/cocos2d/actions/repeat.rb +24 -0
  20. data/lib/joybox/cocos2d/actions/rotate.rb +31 -0
  21. data/lib/joybox/cocos2d/actions/scale.rb +31 -0
  22. data/lib/joybox/cocos2d/actions/sequence.rb +22 -0
  23. data/lib/joybox/cocos2d/actions/skew.rb +36 -0
  24. data/lib/joybox/cocos2d/cocos2d.rb +15 -0
  25. data/lib/joybox/cocos2d/common/cg_point.rb +37 -0
  26. data/lib/joybox/cocos2d/common/color.rb +49 -0
  27. data/lib/joybox/cocos2d/common/gc_size.rb +39 -0
  28. data/lib/joybox/cocos2d/common/ns_set.rb +5 -0
  29. data/lib/joybox/cocos2d/common/numeric.rb +14 -0
  30. data/lib/joybox/cocos2d/common/screen.rb +39 -0
  31. data/lib/joybox/cocos2d/common/ui_touch.rb +15 -0
  32. data/lib/joybox/cocos2d/configuration/configuration.rb +68 -0
  33. data/lib/joybox/cocos2d/configuration/file_utils.rb +33 -0
  34. data/lib/joybox/cocos2d/configuration/gl_view.rb +44 -0
  35. data/lib/joybox/cocos2d/configuration/texture_2d.rb +27 -0
  36. data/lib/joybox/cocos2d/core/layer.rb +87 -0
  37. data/lib/joybox/cocos2d/core/node.rb +26 -0
  38. data/lib/joybox/cocos2d/core/physics_sprite.rb +52 -0
  39. data/lib/joybox/cocos2d/core/scene.rb +24 -0
  40. data/lib/joybox/cocos2d/core/sprite.rb +43 -0
  41. data/lib/joybox/cocos2d/core/sprite_batch.rb +24 -0
  42. data/lib/joybox/cocos2d/director.rb +43 -0
  43. data/lib/joybox/cocos2d/macros.rb +234 -0
  44. data/lib/joybox/cocos2d/ui/label.rb +34 -0
  45. data/lib/joybox/cocos2d/ui/menu.rb +25 -0
  46. data/lib/joybox/cocos2d/ui/menu_image.rb +22 -0
  47. data/lib/joybox/cocos2d/ui/menu_label.rb +45 -0
  48. data/lib/joybox/cocos2d/ui/ui.rb +7 -0
  49. data/lib/joybox/version.rb +3 -0
  50. data/resources/box2d/blocks_sprite_sheet.png +0 -0
  51. data/resources/cocos_motion/dot.png +0 -0
  52. data/resources/cocos_motion/dot_selected.png +0 -0
  53. data/resources/cocos_motion/grossini.png +0 -0
  54. data/resources/cocos_motion/grossinis_sister.png +0 -0
  55. data/resources/cocos_motion/grossinis_sister_two.png +0 -0
  56. data/resources/cocos_motion/left_arrow.png +0 -0
  57. data/resources/cocos_motion/left_arrow_selected.png +0 -0
  58. data/resources/cocos_motion/right_arrow.png +0 -0
  59. data/resources/cocos_motion/right_arrow_selected.png +0 -0
  60. data/resources/fps_images-hd.png +0 -0
  61. data/resources/fps_images-ipadhd.png +0 -0
  62. data/resources/fps_images.png +0 -0
  63. data/spec/lib/joybox/cocos2d/cocos2d_spec.rb +7 -0
  64. data/spec/lib/joybox/cocos2d/macros_spec.rb +37 -0
  65. data/spec/main_spec.rb +9 -0
  66. data/vendor/Box2D.framework/Box2D +0 -0
  67. data/vendor/Box2D.framework/Box2D.framework.bridgesupport +166 -0
  68. data/vendor/Box2D.framework/Versions/A/Box2D +0 -0
  69. data/vendor/Box2D.framework/Versions/A/Headers/Collision/B2DContactListener.h +25 -0
  70. data/vendor/Box2D.framework/Versions/A/Headers/Collision/Shapes/B2DEdgeShape.h +17 -0
  71. data/vendor/Box2D.framework/Versions/A/Headers/Collision/Shapes/B2DPolygonShape.h +16 -0
  72. data/vendor/Box2D.framework/Versions/A/Headers/Collision/Shapes/B2DShape.h +15 -0
  73. data/vendor/Box2D.framework/Versions/A/Headers/Dynamics/B2DBody.h +43 -0
  74. data/vendor/Box2D.framework/Versions/A/Headers/Dynamics/B2DWorld.h +41 -0
  75. data/vendor/Box2D.framework/Versions/A/Resources/Box2DConfig.cmake +3 -0
  76. data/vendor/Box2D.framework/Versions/A/Resources/CMakeLists.txt +205 -0
  77. data/vendor/Cocos2D/Cocos2D.bridgesupport +7808 -0
  78. data/vendor/Cocos2D/include/CCAction.h +195 -0
  79. data/vendor/Cocos2D/include/CCActionCamera.h +73 -0
  80. data/vendor/Cocos2D/include/CCActionCatmullRom.h +139 -0
  81. data/vendor/Cocos2D/include/CCActionEase.h +159 -0
  82. data/vendor/Cocos2D/include/CCActionGrid.h +165 -0
  83. data/vendor/Cocos2D/include/CCActionGrid3D.h +205 -0
  84. data/vendor/Cocos2D/include/CCActionInstant.h +227 -0
  85. data/vendor/Cocos2D/include/CCActionInterval.h +431 -0
  86. data/vendor/Cocos2D/include/CCActionManager.h +113 -0
  87. data/vendor/Cocos2D/include/CCActionPageTurn3D.h +42 -0
  88. data/vendor/Cocos2D/include/CCActionProgressTimer.h +59 -0
  89. data/vendor/Cocos2D/include/CCActionTiledGrid.h +211 -0
  90. data/vendor/Cocos2D/include/CCActionTween.h +62 -0
  91. data/vendor/Cocos2D/include/CCAnimation.h +150 -0
  92. data/vendor/Cocos2D/include/CCAnimationCache.h +74 -0
  93. data/vendor/Cocos2D/include/CCArray.h +119 -0
  94. data/vendor/Cocos2D/include/CCAtlasNode.h +96 -0
  95. data/vendor/Cocos2D/include/CCCamera.h +98 -0
  96. data/vendor/Cocos2D/include/CCConfiguration.h +126 -0
  97. data/vendor/Cocos2D/include/CCDirector.h +344 -0
  98. data/vendor/Cocos2D/include/CCDirectorIOS.h +104 -0
  99. data/vendor/Cocos2D/include/CCDrawingPrimitives.h +139 -0
  100. data/vendor/Cocos2D/include/CCES2Renderer.h +83 -0
  101. data/vendor/Cocos2D/include/CCESRenderer.h +54 -0
  102. data/vendor/Cocos2D/include/CCFileUtils.h +188 -0
  103. data/vendor/Cocos2D/include/CCGL.h +72 -0
  104. data/vendor/Cocos2D/include/CCGLProgram.h +150 -0
  105. data/vendor/Cocos2D/include/CCGLView.h +160 -0
  106. data/vendor/Cocos2D/include/CCGrabber.h +44 -0
  107. data/vendor/Cocos2D/include/CCGrid.h +130 -0
  108. data/vendor/Cocos2D/include/CCLabelAtlas.h +68 -0
  109. data/vendor/Cocos2D/include/CCLabelBMFont.h +216 -0
  110. data/vendor/Cocos2D/include/CCLabelTTF.h +132 -0
  111. data/vendor/Cocos2D/include/CCLayer.h +280 -0
  112. data/vendor/Cocos2D/include/CCMenu.h +100 -0
  113. data/vendor/Cocos2D/include/CCMenuItem.h +423 -0
  114. data/vendor/Cocos2D/include/CCMotionStreak.h +87 -0
  115. data/vendor/Cocos2D/include/CCNS.h +54 -0
  116. data/vendor/Cocos2D/include/CCNode+Debug.h +39 -0
  117. data/vendor/Cocos2D/include/CCNode.h +569 -0
  118. data/vendor/Cocos2D/include/CCParallaxNode.h +50 -0
  119. data/vendor/Cocos2D/include/CCParticleBatchNode.h +99 -0
  120. data/vendor/Cocos2D/include/CCParticleExamples.h +95 -0
  121. data/vendor/Cocos2D/include/CCParticleSystem.h +453 -0
  122. data/vendor/Cocos2D/include/CCParticleSystemQuad.h +73 -0
  123. data/vendor/Cocos2D/include/CCProfiling.h +89 -0
  124. data/vendor/Cocos2D/include/CCProgressTimer.h +94 -0
  125. data/vendor/Cocos2D/include/CCProtocols.h +132 -0
  126. data/vendor/Cocos2D/include/CCRenderTexture.h +139 -0
  127. data/vendor/Cocos2D/include/CCScene.h +43 -0
  128. data/vendor/Cocos2D/include/CCScheduler.h +230 -0
  129. data/vendor/Cocos2D/include/CCShaderCache.h +60 -0
  130. data/vendor/Cocos2D/include/CCSprite.h +288 -0
  131. data/vendor/Cocos2D/include/CCSpriteBatchNode.h +138 -0
  132. data/vendor/Cocos2D/include/CCSpriteFrame.h +126 -0
  133. data/vendor/Cocos2D/include/CCSpriteFrameCache.h +121 -0
  134. data/vendor/Cocos2D/include/CCTMXLayer.h +164 -0
  135. data/vendor/Cocos2D/include/CCTMXObjectGroup.h +67 -0
  136. data/vendor/Cocos2D/include/CCTMXTiledMap.h +145 -0
  137. data/vendor/Cocos2D/include/CCTMXXMLParser.h +217 -0
  138. data/vendor/Cocos2D/include/CCTexture2D.h +357 -0
  139. data/vendor/Cocos2D/include/CCTextureAtlas.h +188 -0
  140. data/vendor/Cocos2D/include/CCTextureCache.h +146 -0
  141. data/vendor/Cocos2D/include/CCTexturePVR.h +129 -0
  142. data/vendor/Cocos2D/include/CCTileMapAtlas.h +83 -0
  143. data/vendor/Cocos2D/include/CCTouchDelegateProtocol.h +75 -0
  144. data/vendor/Cocos2D/include/CCTouchDispatcher.h +120 -0
  145. data/vendor/Cocos2D/include/CCTouchHandler.h +93 -0
  146. data/vendor/Cocos2D/include/CCTransition.h +296 -0
  147. data/vendor/Cocos2D/include/CCTransitionPageTurn.h +60 -0
  148. data/vendor/Cocos2D/include/CCTransitionProgress.h +62 -0
  149. data/vendor/Cocos2D/include/CCVertex.h +36 -0
  150. data/vendor/Cocos2D/include/CGPointExtension.h +344 -0
  151. data/vendor/Cocos2D/include/CocosDenshion/CDAudioManager.h +243 -0
  152. data/vendor/Cocos2D/include/CocosDenshion/CDConfig.h +60 -0
  153. data/vendor/Cocos2D/include/CocosDenshion/CDOpenALSupport.h +77 -0
  154. data/vendor/Cocos2D/include/CocosDenshion/CDXPropertyModifierAction.h +45 -0
  155. data/vendor/Cocos2D/include/CocosDenshion/CocosDenshion.h +440 -0
  156. data/vendor/Cocos2D/include/CocosDenshion/SimpleAudioEngine.h +90 -0
  157. data/vendor/Cocos2D/include/NSThread+performBlock.h +22 -0
  158. data/vendor/Cocos2D/include/OpenGL_Internal.h +86 -0
  159. data/vendor/Cocos2D/include/RubyMotionSchedule.h +7 -0
  160. data/vendor/Cocos2D/include/TGAlib.h +55 -0
  161. data/vendor/Cocos2D/include/TransformUtils.h +36 -0
  162. data/vendor/Cocos2D/include/ZipUtils.h +91 -0
  163. data/vendor/Cocos2D/include/base64.h +33 -0
  164. data/vendor/Cocos2D/include/ccCArray.h +229 -0
  165. data/vendor/Cocos2D/include/ccConfig.h +245 -0
  166. data/vendor/Cocos2D/include/ccDeprecated.h +300 -0
  167. data/vendor/Cocos2D/include/ccGLStateCache.h +138 -0
  168. data/vendor/Cocos2D/include/ccMacros.h +353 -0
  169. data/vendor/Cocos2D/include/ccShader_PositionColor_frag.h +12 -0
  170. data/vendor/Cocos2D/include/ccShader_PositionColor_vert.h +17 -0
  171. data/vendor/Cocos2D/include/ccShader_PositionTextureA8Color_frag.h +16 -0
  172. data/vendor/Cocos2D/include/ccShader_PositionTextureA8Color_vert.h +21 -0
  173. data/vendor/Cocos2D/include/ccShader_PositionTextureColorAlphaTest_frag.h +23 -0
  174. data/vendor/Cocos2D/include/ccShader_PositionTextureColor_frag.h +14 -0
  175. data/vendor/Cocos2D/include/ccShader_PositionTextureColor_vert.h +22 -0
  176. data/vendor/Cocos2D/include/ccShader_PositionTexture_frag.h +13 -0
  177. data/vendor/Cocos2D/include/ccShader_PositionTexture_uColor_frag.h +16 -0
  178. data/vendor/Cocos2D/include/ccShader_PositionTexture_uColor_vert.h +18 -0
  179. data/vendor/Cocos2D/include/ccShader_PositionTexture_vert.h +17 -0
  180. data/vendor/Cocos2D/include/ccShader_Position_uColor_frag.h +12 -0
  181. data/vendor/Cocos2D/include/ccShader_Position_uColor_vert.h +19 -0
  182. data/vendor/Cocos2D/include/ccShaders.h +45 -0
  183. data/vendor/Cocos2D/include/ccTypes.h +374 -0
  184. data/vendor/Cocos2D/include/ccUtils.h +36 -0
  185. data/vendor/Cocos2D/include/cocos2d.h +178 -0
  186. data/vendor/Cocos2D/include/kazmath/GL/mat4stack.h +51 -0
  187. data/vendor/Cocos2D/include/kazmath/GL/matrix.h +58 -0
  188. data/vendor/Cocos2D/include/kazmath/aabb.h +53 -0
  189. data/vendor/Cocos2D/include/kazmath/kazmath.h +39 -0
  190. data/vendor/Cocos2D/include/kazmath/mat3.h +75 -0
  191. data/vendor/Cocos2D/include/kazmath/mat4.h +93 -0
  192. data/vendor/Cocos2D/include/kazmath/neon_matrix_impl.h +41 -0
  193. data/vendor/Cocos2D/include/kazmath/plane.h +70 -0
  194. data/vendor/Cocos2D/include/kazmath/quaternion.h +113 -0
  195. data/vendor/Cocos2D/include/kazmath/ray2.h +50 -0
  196. data/vendor/Cocos2D/include/kazmath/utility.h +74 -0
  197. data/vendor/Cocos2D/include/kazmath/vec2.h +64 -0
  198. data/vendor/Cocos2D/include/kazmath/vec3.h +68 -0
  199. data/vendor/Cocos2D/include/kazmath/vec4.h +68 -0
  200. data/vendor/Cocos2D/include/uthash.h +972 -0
  201. data/vendor/Cocos2D/include/utlist.h +490 -0
  202. data/vendor/Cocos2D/libCocosDenshion.a +0 -0
  203. data/vendor/Cocos2D/libcocos2d.a +0 -0
  204. metadata +277 -0
@@ -0,0 +1,431 @@
1
+ /*
2
+ * cocos2d for iPhone: http://www.cocos2d-iphone.org
3
+ *
4
+ * Copyright (c) 2008-2011 Ricardo Quesada
5
+ * Copyright (c) 2011 Zynga Inc.
6
+ *
7
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ * of this software and associated documentation files (the "Software"), to deal
9
+ * in the Software without restriction, including without limitation the rights
10
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ * copies of the Software, and to permit persons to whom the Software is
12
+ * furnished to do so, subject to the following conditions:
13
+ *
14
+ * The above copyright notice and this permission notice shall be included in
15
+ * all copies or substantial portions of the Software.
16
+ *
17
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23
+ * THE SOFTWARE.
24
+ *
25
+ */
26
+
27
+
28
+ #import "CCNode.h"
29
+ #import "CCAction.h"
30
+ #import "CCProtocols.h"
31
+
32
+ #include <sys/time.h>
33
+
34
+ /** An interval action is an action that takes place within a certain period of time.
35
+ It has an start time, and a finish time. The finish time is the parameter
36
+ duration plus the start time.
37
+
38
+ These CCActionInterval actions have some interesting properties, like:
39
+ - They can run normally (default)
40
+ - They can run reversed with the reverse method
41
+ - They can run with the time altered with the Accelerate, AccelDeccel and Speed actions.
42
+
43
+ For example, you can simulate a Ping Pong effect running the action normally and
44
+ then running it again in Reverse mode.
45
+
46
+ Example:
47
+
48
+ CCAction * pingPongAction = [CCSequence actions: action, [action reverse], nil];
49
+ */
50
+ @interface CCActionInterval: CCFiniteTimeAction <NSCopying>
51
+ {
52
+ ccTime elapsed_;
53
+ BOOL firstTick_;
54
+ }
55
+
56
+ /** how many seconds had elapsed since the actions started to run. */
57
+ @property (nonatomic,readonly) ccTime elapsed;
58
+
59
+ /** creates the action */
60
+ +(id) actionWithDuration: (ccTime) d;
61
+ /** initializes the action */
62
+ -(id) initWithDuration: (ccTime) d;
63
+ /** returns YES if the action has finished */
64
+ -(BOOL) isDone;
65
+ /** returns a reversed action */
66
+ - (CCActionInterval*) reverse;
67
+ @end
68
+
69
+ /** Runs actions sequentially, one after another
70
+ */
71
+ @interface CCSequence : CCActionInterval <NSCopying>
72
+ {
73
+ CCFiniteTimeAction *actions_[2];
74
+ ccTime split_;
75
+ int last_;
76
+ }
77
+ /** helper contructor to create an array of sequenceable actions */
78
+ +(id) actions: (CCFiniteTimeAction*) action1, ... NS_REQUIRES_NIL_TERMINATION;
79
+ /** helper contructor to create an array of sequenceable actions given an array */
80
+ +(id) actionWithArray: (NSArray*) arrayOfActions;
81
+ /** creates the action */
82
+ +(id) actionOne:(CCFiniteTimeAction*)actionOne two:(CCFiniteTimeAction*)actionTwo;
83
+ /** initializes the action */
84
+ -(id) initOne:(CCFiniteTimeAction*)actionOne two:(CCFiniteTimeAction*)actionTwo;
85
+ @end
86
+
87
+
88
+ /** Repeats an action a number of times.
89
+ * To repeat an action forever use the CCRepeatForever action.
90
+ */
91
+ @interface CCRepeat : CCActionInterval <NSCopying>
92
+ {
93
+ NSUInteger times_;
94
+ NSUInteger total_;
95
+ ccTime nextDt_;
96
+ BOOL isActionInstant_;
97
+ CCFiniteTimeAction *innerAction_;
98
+ }
99
+
100
+ /** Inner action */
101
+ @property (nonatomic,readwrite,retain) CCFiniteTimeAction *innerAction;
102
+
103
+ /** creates a CCRepeat action. Times is an unsigned integer between 1 and MAX_UINT.
104
+ */
105
+ +(id) actionWithAction:(CCFiniteTimeAction*)action times: (NSUInteger)times;
106
+ /** initializes a CCRepeat action. Times is an unsigned integer between 1 and MAX_UINT */
107
+ -(id) initWithAction:(CCFiniteTimeAction*)action times: (NSUInteger)times;
108
+ @end
109
+
110
+ /** Spawn a new action immediately
111
+ */
112
+ @interface CCSpawn : CCActionInterval <NSCopying>
113
+ {
114
+ CCFiniteTimeAction *one_;
115
+ CCFiniteTimeAction *two_;
116
+ }
117
+ /** helper constructor to create an array of spawned actions */
118
+ +(id) actions: (CCFiniteTimeAction*) action1, ... NS_REQUIRES_NIL_TERMINATION;
119
+ /** helper contructor to create an array of spawned actions given an array */
120
+ +(id) actionWithArray: (NSArray*) arrayOfActions;
121
+ /** creates the Spawn action */
122
+ +(id) actionOne: (CCFiniteTimeAction*) one two:(CCFiniteTimeAction*) two;
123
+ /** initializes the Spawn action with the 2 actions to spawn */
124
+ -(id) initOne: (CCFiniteTimeAction*) one two:(CCFiniteTimeAction*) two;
125
+ @end
126
+
127
+ /** Rotates a CCNode object to a certain angle by modifying it's
128
+ rotation attribute.
129
+ The direction will be decided by the shortest angle.
130
+ */
131
+ @interface CCRotateTo : CCActionInterval <NSCopying>
132
+ {
133
+ float dstAngle_;
134
+ float startAngle_;
135
+ float diffAngle_;
136
+ }
137
+ /** creates the action */
138
+ +(id) actionWithDuration:(ccTime)duration angle:(float)angle;
139
+ /** initializes the action */
140
+ -(id) initWithDuration:(ccTime)duration angle:(float)angle;
141
+ @end
142
+
143
+ /** Rotates a CCNode object clockwise a number of degrees by modiying its rotation attribute.
144
+ */
145
+ @interface CCRotateBy : CCActionInterval <NSCopying>
146
+ {
147
+ float angle_;
148
+ float startAngle_;
149
+ }
150
+ /** creates the action */
151
+ +(id) actionWithDuration:(ccTime)duration angle:(float)deltaAngle;
152
+ /** initializes the action */
153
+ -(id) initWithDuration:(ccTime)duration angle:(float)deltaAngle;
154
+ @end
155
+
156
+ /** Moves a CCNode object to the position x,y. x and y are absolute coordinates by modifying its position attribute.
157
+ */
158
+ @interface CCMoveTo : CCActionInterval <NSCopying>
159
+ {
160
+ CGPoint endPosition_;
161
+ CGPoint startPosition_;
162
+ CGPoint delta_;
163
+ }
164
+ /** creates the action */
165
+ +(id) actionWithDuration:(ccTime)duration position:(CGPoint)position;
166
+ /** initializes the action */
167
+ -(id) initWithDuration:(ccTime)duration position:(CGPoint)position;
168
+ @end
169
+
170
+ /** Moves a CCNode object x,y pixels by modifying its position attribute.
171
+ x and y are relative to the position of the object.
172
+ Duration is is seconds.
173
+ */
174
+ @interface CCMoveBy : CCMoveTo <NSCopying>
175
+ {
176
+ }
177
+ /** creates the action */
178
+ +(id) actionWithDuration: (ccTime)duration position:(CGPoint)deltaPosition;
179
+ /** initializes the action */
180
+ -(id) initWithDuration: (ccTime)duration position:(CGPoint)deltaPosition;
181
+ @end
182
+
183
+ /** Skews a CCNode object to given angles by modifying its skewX and skewY attributes
184
+ @since v1.0
185
+ */
186
+ @interface CCSkewTo : CCActionInterval <NSCopying>
187
+ {
188
+ float skewX_;
189
+ float skewY_;
190
+ float startSkewX_;
191
+ float startSkewY_;
192
+ float endSkewX_;
193
+ float endSkewY_;
194
+ float deltaX_;
195
+ float deltaY_;
196
+ }
197
+ /** creates the action */
198
+ +(id) actionWithDuration:(ccTime)t skewX:(float)sx skewY:(float)sy;
199
+ /** initializes the action */
200
+ -(id) initWithDuration:(ccTime)t skewX:(float)sx skewY:(float)sy;
201
+ @end
202
+
203
+ /** Skews a CCNode object by skewX and skewY degrees
204
+ @since v1.0
205
+ */
206
+ @interface CCSkewBy : CCSkewTo <NSCopying>
207
+ {
208
+ }
209
+ @end
210
+
211
+ /** Moves a CCNode object simulating a parabolic jump movement by modifying its position attribute.
212
+ */
213
+ @interface CCJumpBy : CCActionInterval <NSCopying>
214
+ {
215
+ CGPoint startPosition_;
216
+ CGPoint delta_;
217
+ ccTime height_;
218
+ NSUInteger jumps_;
219
+ }
220
+ /** creates the action */
221
+ +(id) actionWithDuration: (ccTime)duration position:(CGPoint)position height:(ccTime)height jumps:(NSUInteger)jumps;
222
+ /** initializes the action */
223
+ -(id) initWithDuration: (ccTime)duration position:(CGPoint)position height:(ccTime)height jumps:(NSUInteger)jumps;
224
+ @end
225
+
226
+ /** Moves a CCNode object to a parabolic position simulating a jump movement by modifying its position attribute.
227
+ */
228
+ @interface CCJumpTo : CCJumpBy <NSCopying>
229
+ {
230
+ }
231
+ @end
232
+
233
+ /** bezier configuration structure
234
+ */
235
+ typedef struct _ccBezierConfig {
236
+ //! end position of the bezier
237
+ CGPoint endPosition;
238
+ //! Bezier control point 1
239
+ CGPoint controlPoint_1;
240
+ //! Bezier control point 2
241
+ CGPoint controlPoint_2;
242
+ } ccBezierConfig;
243
+
244
+ /** An action that moves the target with a cubic Bezier curve by a certain distance.
245
+ */
246
+ @interface CCBezierBy : CCActionInterval <NSCopying>
247
+ {
248
+ ccBezierConfig config_;
249
+ CGPoint startPosition_;
250
+ }
251
+
252
+ /** creates the action with a duration and a bezier configuration */
253
+ +(id) actionWithDuration: (ccTime) t bezier:(ccBezierConfig) c;
254
+
255
+ /** initializes the action with a duration and a bezier configuration */
256
+ -(id) initWithDuration: (ccTime) t bezier:(ccBezierConfig) c;
257
+ @end
258
+
259
+ /** An action that moves the target with a cubic Bezier curve to a destination point.
260
+ @since v0.8.2
261
+ */
262
+ @interface CCBezierTo : CCBezierBy
263
+ {
264
+ }
265
+ @end
266
+
267
+ /** Scales a CCNode object to a zoom factor by modifying its scale attribute.
268
+ @warning This action doesn't support "reverse"
269
+ */
270
+ @interface CCScaleTo : CCActionInterval <NSCopying>
271
+ {
272
+ float scaleX_;
273
+ float scaleY_;
274
+ float startScaleX_;
275
+ float startScaleY_;
276
+ float endScaleX_;
277
+ float endScaleY_;
278
+ float deltaX_;
279
+ float deltaY_;
280
+ }
281
+ /** creates the action with the same scale factor for X and Y */
282
+ +(id) actionWithDuration: (ccTime)duration scale:(float) s;
283
+ /** initializes the action with the same scale factor for X and Y */
284
+ -(id) initWithDuration: (ccTime)duration scale:(float) s;
285
+ /** creates the action with and X factor and a Y factor */
286
+ +(id) actionWithDuration: (ccTime)duration scaleX:(float) sx scaleY:(float)sy;
287
+ /** initializes the action with and X factor and a Y factor */
288
+ -(id) initWithDuration: (ccTime)duration scaleX:(float) sx scaleY:(float)sy;
289
+ @end
290
+
291
+ /** Scales a CCNode object a zoom factor by modifying its scale attribute.
292
+ */
293
+ @interface CCScaleBy : CCScaleTo <NSCopying>
294
+ {
295
+ }
296
+ @end
297
+
298
+ /** Blinks a CCNode object by modifying its visible attribute
299
+ */
300
+ @interface CCBlink : CCActionInterval <NSCopying>
301
+ {
302
+ NSUInteger times_;
303
+ }
304
+ /** creates the action */
305
+ +(id) actionWithDuration: (ccTime)duration blinks:(NSUInteger)blinks;
306
+ /** initilizes the action */
307
+ -(id) initWithDuration: (ccTime)duration blinks:(NSUInteger)blinks;
308
+ @end
309
+
310
+ /** Fades In an object that implements the CCRGBAProtocol protocol. It modifies the opacity from 0 to 255.
311
+ The "reverse" of this action is FadeOut
312
+ */
313
+ @interface CCFadeIn : CCActionInterval <NSCopying>
314
+ {
315
+ }
316
+ @end
317
+
318
+ /** Fades Out an object that implements the CCRGBAProtocol protocol. It modifies the opacity from 255 to 0.
319
+ The "reverse" of this action is FadeIn
320
+ */
321
+ @interface CCFadeOut : CCActionInterval <NSCopying>
322
+ {
323
+ }
324
+ @end
325
+
326
+ /** Fades an object that implements the CCRGBAProtocol protocol. It modifies the opacity from the current value to a custom one.
327
+ @warning This action doesn't support "reverse"
328
+ */
329
+ @interface CCFadeTo : CCActionInterval <NSCopying>
330
+ {
331
+ GLubyte toOpacity_;
332
+ GLubyte fromOpacity_;
333
+ }
334
+ /** creates an action with duration and opactiy */
335
+ +(id) actionWithDuration:(ccTime)duration opacity:(GLubyte)opactiy;
336
+ /** initializes the action with duration and opacity */
337
+ -(id) initWithDuration:(ccTime)duration opacity:(GLubyte)opacity;
338
+ @end
339
+
340
+ /** Tints a CCNode that implements the CCNodeRGB protocol from current tint to a custom one.
341
+ @warning This action doesn't support "reverse"
342
+ @since v0.7.2
343
+ */
344
+ @interface CCTintTo : CCActionInterval <NSCopying>
345
+ {
346
+ ccColor3B to_;
347
+ ccColor3B from_;
348
+ }
349
+ /** creates an action with duration and color */
350
+ +(id) actionWithDuration:(ccTime)duration red:(GLubyte)red green:(GLubyte)green blue:(GLubyte)blue;
351
+ /** initializes the action with duration and color */
352
+ -(id) initWithDuration:(ccTime)duration red:(GLubyte)red green:(GLubyte)green blue:(GLubyte)blue;
353
+ @end
354
+
355
+ /** Tints a CCNode that implements the CCNodeRGB protocol from current tint to a custom one.
356
+ @since v0.7.2
357
+ */
358
+ @interface CCTintBy : CCActionInterval <NSCopying>
359
+ {
360
+ GLshort deltaR_, deltaG_, deltaB_;
361
+ GLshort fromR_, fromG_, fromB_;
362
+ }
363
+ /** creates an action with duration and color */
364
+ +(id) actionWithDuration:(ccTime)duration red:(GLshort)deltaRed green:(GLshort)deltaGreen blue:(GLshort)deltaBlue;
365
+ /** initializes the action with duration and color */
366
+ -(id) initWithDuration:(ccTime)duration red:(GLshort)deltaRed green:(GLshort)deltaGreen blue:(GLshort)deltaBlue;
367
+ @end
368
+
369
+ /** Delays the action a certain amount of seconds
370
+ */
371
+ @interface CCDelayTime : CCActionInterval <NSCopying>
372
+ {
373
+ }
374
+ @end
375
+
376
+ /** Executes an action in reverse order, from time=duration to time=0
377
+
378
+ @warning Use this action carefully. This action is not
379
+ sequenceable. Use it as the default "reversed" method
380
+ of your own actions, but using it outside the "reversed"
381
+ scope is not recommended.
382
+ */
383
+ @interface CCReverseTime : CCActionInterval <NSCopying>
384
+ {
385
+ CCFiniteTimeAction * other_;
386
+ }
387
+ /** creates the action */
388
+ +(id) actionWithAction: (CCFiniteTimeAction*) action;
389
+ /** initializes the action */
390
+ -(id) initWithAction: (CCFiniteTimeAction*) action;
391
+ @end
392
+
393
+
394
+ @class CCAnimation;
395
+ @class CCTexture2D;
396
+ /** Animates a sprite given the name of an Animation */
397
+ @interface CCAnimate : CCActionInterval <NSCopying>
398
+ {
399
+ NSMutableArray *splitTimes_;
400
+ NSInteger nextFrame_;
401
+ CCAnimation *animation_;
402
+ id origFrame_;
403
+ NSUInteger executedLoops_;
404
+ }
405
+ /** animation used for the animage */
406
+ @property (readwrite,nonatomic,retain) CCAnimation * animation;
407
+
408
+ /** creates the action with an Animation and will restore the original frame when the animation is over */
409
+ +(id) actionWithAnimation:(CCAnimation*)animation;
410
+ /** initializes the action with an Animation and will restore the original frame when the animtion is over */
411
+ -(id) initWithAnimation:(CCAnimation*)animation;
412
+ @end
413
+
414
+ /** Overrides the target of an action so that it always runs on the target
415
+ * specified at action creation rather than the one specified by runAction.
416
+ */
417
+ @interface CCTargetedAction : CCActionInterval <NSCopying>
418
+ {
419
+ id forcedTarget_;
420
+ CCFiniteTimeAction* action_;
421
+ }
422
+ /** This is the target that the action will be forced to run with */
423
+ @property(readwrite,nonatomic,retain) id forcedTarget;
424
+
425
+ /** Create an action with the specified action and forced target */
426
+ + (id) actionWithTarget:(id) target action:(CCFiniteTimeAction*) action;
427
+
428
+ /** Init an action with the specified action and forced target */
429
+ - (id) initWithTarget:(id) target action:(CCFiniteTimeAction*) action;
430
+
431
+ @end
@@ -0,0 +1,113 @@
1
+ /*
2
+ * cocos2d for iPhone: http://www.cocos2d-iphone.org
3
+ *
4
+ * Copyright (c) 2009 Valentin Milea
5
+ *
6
+ * Copyright (c) 2008-2010 Ricardo Quesada
7
+ * Copyright (c) 2011 Zynga Inc.
8
+ *
9
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
10
+ * of this software and associated documentation files (the "Software"), to deal
11
+ * in the Software without restriction, including without limitation the rights
12
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13
+ * copies of the Software, and to permit persons to whom the Software is
14
+ * furnished to do so, subject to the following conditions:
15
+ *
16
+ * The above copyright notice and this permission notice shall be included in
17
+ * all copies or substantial portions of the Software.
18
+ *
19
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25
+ * THE SOFTWARE.
26
+ *
27
+ */
28
+
29
+
30
+ #import "CCAction.h"
31
+ #import "ccMacros.h"
32
+ #import "Support/ccCArray.h"
33
+ #import "Support/uthash.h"
34
+
35
+ typedef struct _hashElement
36
+ {
37
+ struct ccArray *actions;
38
+ NSUInteger actionIndex;
39
+ BOOL currentActionSalvaged;
40
+ BOOL paused;
41
+ UT_hash_handle hh;
42
+
43
+ CC_ARC_UNSAFE_RETAINED id target;
44
+ CC_ARC_UNSAFE_RETAINED CCAction *currentAction;
45
+ } tHashElement;
46
+
47
+
48
+ /** CCActionManager the object that manages all the actions.
49
+ Normally you won't need to use this API directly. 99% of the cases you will use the CCNode interface, which uses this object.
50
+ But there are some cases where you might need to use this API dirctly:
51
+ Examples:
52
+ - When you want to run an action where the target is different from a CCNode.
53
+ - When you want to pause / resume the actions
54
+
55
+ @since v0.8
56
+ */
57
+ @interface CCActionManager : NSObject
58
+ {
59
+ tHashElement *targets;
60
+ tHashElement *currentTarget;
61
+ BOOL currentTargetSalvaged;
62
+ }
63
+
64
+
65
+ // actions
66
+
67
+ /** Adds an action with a target.
68
+ If the target is already present, then the action will be added to the existing target.
69
+ If the target is not present, a new instance of this target will be created either paused or paused, and the action will be added to the newly created target.
70
+ When the target is paused, the queued actions won't be 'ticked'.
71
+ */
72
+ -(void) addAction: (CCAction*) action target:(id)target paused:(BOOL)paused;
73
+ /** Removes all actions from all the targers.
74
+ */
75
+ -(void) removeAllActions;
76
+
77
+ /** Removes all actions from a certain target.
78
+ All the actions that belongs to the target will be removed.
79
+ */
80
+ -(void) removeAllActionsFromTarget:(id)target;
81
+ /** Removes an action given an action reference.
82
+ */
83
+ -(void) removeAction: (CCAction*) action;
84
+ /** Removes an action given its tag and the target */
85
+ -(void) removeActionByTag:(NSInteger)tag target:(id)target;
86
+ /** Gets an action given its tag an a target
87
+ @return the Action the with the given tag
88
+ */
89
+ -(CCAction*) getActionByTag:(NSInteger) tag target:(id)target;
90
+ /** Returns the numbers of actions that are running in a certain target
91
+ * Composable actions are counted as 1 action. Example:
92
+ * If you are running 1 Sequence of 7 actions, it will return 1.
93
+ * If you are running 7 Sequences of 2 actions, it will return 7.
94
+ */
95
+ -(NSUInteger) numberOfRunningActionsInTarget:(id)target;
96
+
97
+ /** Pauses the target: all running actions and newly added actions will be paused.
98
+ */
99
+ -(void) pauseTarget:(id)target;
100
+ /** Resumes the target. All queued actions will be resumed.
101
+ */
102
+ -(void) resumeTarget:(id)target;
103
+
104
+ /** Pauses all running actions, returning a list of targets whose actions were paused.
105
+ */
106
+ -(NSSet *) pauseAllRunningActions;
107
+
108
+ /** Resume a set of targets (convenience function to reverse a pauseAllRunningActions call)
109
+ */
110
+ -(void) resumeTargets:(NSSet *)targetsToResume;
111
+
112
+ @end
113
+