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,195 @@
1
+ /*
2
+ * cocos2d for iPhone: http://www.cocos2d-iphone.org
3
+ *
4
+ * Copyright (c) 2008-2010 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
+ #include <sys/time.h>
29
+ #import <Foundation/Foundation.h>
30
+
31
+ #import "ccTypes.h"
32
+
33
+ enum {
34
+ //! Default tag
35
+ kCCActionTagInvalid = -1,
36
+ };
37
+
38
+ /** Base class for CCAction objects.
39
+ */
40
+ @interface CCAction : NSObject <NSCopying>
41
+ {
42
+ id originalTarget_;
43
+ id target_;
44
+ NSInteger tag_;
45
+ }
46
+
47
+ /** The "target". The action will modify the target properties.
48
+ The target will be set with the 'startWithTarget' method.
49
+ When the 'stop' method is called, target will be set to nil.
50
+ The target is 'assigned', it is not 'retained'.
51
+ */
52
+ @property (nonatomic,readonly,assign) id target;
53
+
54
+ /** The original target, since target can be nil.
55
+ Is the target that were used to run the action. Unless you are doing something complex, like CCActionManager, you should NOT call this method.
56
+ @since v0.8.2
57
+ */
58
+ @property (nonatomic,readonly,assign) id originalTarget;
59
+
60
+
61
+ /** The action tag. An identifier of the action */
62
+ @property (nonatomic,readwrite,assign) NSInteger tag;
63
+
64
+ /** Allocates and initializes the action */
65
+ +(id) action;
66
+
67
+ /** Initializes the action */
68
+ -(id) init;
69
+
70
+ -(id) copyWithZone: (NSZone*) zone;
71
+
72
+ //! return YES if the action has finished
73
+ -(BOOL) isDone;
74
+ //! called before the action start. It will also set the target.
75
+ -(void) startWithTarget:(id)target;
76
+ //! called after the action has finished. It will set the 'target' to nil.
77
+ //! IMPORTANT: You should never call "[action stop]" manually. Instead, use: "[target stopAction:action];"
78
+ -(void) stop;
79
+ //! called every frame with its delta time. DON'T override unless you know what you are doing.
80
+ -(void) step: (ccTime) dt;
81
+ //! called once per frame. time a value between 0 and 1
82
+ //! For example:
83
+ //! * 0 means that the action just started
84
+ //! * 0.5 means that the action is in the middle
85
+ //! * 1 means that the action is over
86
+ -(void) update: (ccTime) time;
87
+
88
+ @end
89
+
90
+ /** Base class actions that do have a finite time duration.
91
+ Possible actions:
92
+ - An action with a duration of 0 seconds
93
+ - An action with a duration of 35.5 seconds
94
+ Infitite time actions are valid
95
+ */
96
+ @interface CCFiniteTimeAction : CCAction <NSCopying>
97
+ {
98
+ //! duration in seconds
99
+ ccTime duration_;
100
+ }
101
+ //! duration in seconds of the action
102
+ @property (nonatomic,readwrite) ccTime duration;
103
+
104
+ /** returns a reversed action */
105
+ - (CCFiniteTimeAction*) reverse;
106
+ @end
107
+
108
+
109
+ @class CCActionInterval;
110
+ /** Repeats an action for ever.
111
+ To repeat the an action for a limited number of times use the Repeat action.
112
+ @warning This action can't be Sequenceable because it is not an IntervalAction
113
+ */
114
+ @interface CCRepeatForever : CCAction <NSCopying>
115
+ {
116
+ CCActionInterval *innerAction_;
117
+ }
118
+ /** Inner action */
119
+ @property (nonatomic, readwrite, retain) CCActionInterval *innerAction;
120
+
121
+ /** creates the action */
122
+ +(id) actionWithAction: (CCActionInterval*) action;
123
+ /** initializes the action */
124
+ -(id) initWithAction: (CCActionInterval*) action;
125
+ @end
126
+
127
+ /** Changes the speed of an action, making it take longer (speed<1)
128
+ or less (speed>1) time.
129
+ Useful to simulate 'slow motion' or 'fast forward' effect.
130
+ @warning This action can't be Sequenceable because it is not an CCIntervalAction
131
+ */
132
+ @interface CCSpeed : CCAction <NSCopying>
133
+ {
134
+ CCActionInterval *innerAction_;
135
+ float speed_;
136
+ }
137
+ /** alter the speed of the inner function in runtime */
138
+ @property (nonatomic,readwrite) float speed;
139
+ /** Inner action of CCSpeed */
140
+ @property (nonatomic, readwrite, retain) CCActionInterval *innerAction;
141
+
142
+ /** creates the action */
143
+ +(id) actionWithAction: (CCActionInterval*) action speed:(float)value;
144
+ /** initializes the action */
145
+ -(id) initWithAction: (CCActionInterval*) action speed:(float)value;
146
+ @end
147
+
148
+ @class CCNode;
149
+ /** CCFollow is an action that "follows" a node.
150
+
151
+ Eg:
152
+ [layer runAction: [CCFollow actionWithTarget:hero]];
153
+
154
+ Instead of using CCCamera as a "follower", use this action instead.
155
+ @since v0.99.2
156
+ */
157
+ @interface CCFollow : CCAction <NSCopying>
158
+ {
159
+ /* node to follow */
160
+ CCNode *followedNode_;
161
+
162
+ /* whether camera should be limited to certain area */
163
+ BOOL boundarySet;
164
+
165
+ /* if screensize is bigger than the boundary - update not needed */
166
+ BOOL boundaryFullyCovered;
167
+
168
+ /* fast access to the screen dimensions */
169
+ CGPoint halfScreenSize;
170
+ CGPoint fullScreenSize;
171
+
172
+ /* world boundaries */
173
+ float leftBoundary;
174
+ float rightBoundary;
175
+ float topBoundary;
176
+ float bottomBoundary;
177
+ }
178
+
179
+ /** alter behavior - turn on/off boundary */
180
+ @property (nonatomic,readwrite) BOOL boundarySet;
181
+
182
+ /** creates the action with no boundary set */
183
+ +(id) actionWithTarget:(CCNode *)followedNode;
184
+
185
+ /** creates the action with a set boundary */
186
+ +(id) actionWithTarget:(CCNode *)followedNode worldBoundary:(CGRect)rect;
187
+
188
+ /** initializes the action */
189
+ -(id) initWithTarget:(CCNode *)followedNode;
190
+
191
+ /** initializes the action with a set boundary */
192
+ -(id) initWithTarget:(CCNode *)followedNode worldBoundary:(CGRect)rect;
193
+
194
+ @end
195
+
@@ -0,0 +1,73 @@
1
+ /*
2
+ * cocos2d for iPhone: http://www.cocos2d-iphone.org
3
+ *
4
+ * Copyright (c) 2008-2010 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
+ #import "CCActionInterval.h"
28
+
29
+ @class CCCamera;
30
+
31
+ /** Base class for CCCamera actions
32
+ */
33
+ @interface CCActionCamera : CCActionInterval <NSCopying>
34
+ {
35
+ float centerXOrig_;
36
+ float centerYOrig_;
37
+ float centerZOrig_;
38
+
39
+ float eyeXOrig_;
40
+ float eyeYOrig_;
41
+ float eyeZOrig_;
42
+
43
+ float upXOrig_;
44
+ float upYOrig_;
45
+ float upZOrig_;
46
+ }
47
+ @end
48
+
49
+ /** CCOrbitCamera action
50
+ Orbits the camera around the center of the screen using spherical coordinates
51
+ */
52
+ @interface CCOrbitCamera : CCActionCamera <NSCopying>
53
+ {
54
+ float radius_;
55
+ float deltaRadius_;
56
+ float angleZ_;
57
+ float deltaAngleZ_;
58
+ float angleX_;
59
+ float deltaAngleX_;
60
+
61
+ float radZ_;
62
+ float radDeltaZ_;
63
+ float radX_;
64
+ float radDeltaX_;
65
+
66
+ }
67
+ /** creates a CCOrbitCamera action with radius, delta-radius, z, deltaZ, x, deltaX */
68
+ +(id) actionWithDuration:(float) t radius:(float)r deltaRadius:(float) dr angleZ:(float)z deltaAngleZ:(float)dz angleX:(float)x deltaAngleX:(float)dx;
69
+ /** initializes a CCOrbitCamera action with radius, delta-radius, z, deltaZ, x, deltaX */
70
+ -(id) initWithDuration:(float) t radius:(float)r deltaRadius:(float) dr angleZ:(float)z deltaAngleZ:(float)dz angleX:(float)x deltaAngleX:(float)dx;
71
+ /** positions the camera according to spherical coordinates */
72
+ -(void) sphericalRadius:(float*) r zenith:(float*) zenith azimuth:(float*) azimuth;
73
+ @end
@@ -0,0 +1,139 @@
1
+ /*
2
+ * cocos2d for iPhone: http://www.cocos2d-iphone.org
3
+ *
4
+ * Copyright (c) 2008 Radu Gruian
5
+ *
6
+ * Copyright (c) 2011 Vit Valentin
7
+ *
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
+ * Orignal code by Radu Gruian: http://www.codeproject.com/Articles/30838/Overhauser-Catmull-Rom-Splines-for-Camera-Animatio.So
29
+ *
30
+ * Adapted to cocos2d-x by Vit Valentin
31
+ *
32
+ * Adapted from cocos2d-x to cocos2d-iphone by Ricardo Quesada
33
+ */
34
+
35
+
36
+ #import "CCActionInterval.h"
37
+
38
+ /** An Array that contain control points.
39
+ Used by CCCardinalSplineTo and (By) and CCCatmullRomTo (and By) actions.
40
+ */
41
+ @interface CCPointArray : NSObject <NSCopying>
42
+ {
43
+ NSMutableArray *controlPoints_;
44
+ }
45
+
46
+ /** Array that contains the control points */
47
+ @property (nonatomic,readwrite,retain) NSMutableArray *controlPoints;
48
+
49
+ /** creates and initializes a Points array with capacity */
50
+ +(id) arrayWithCapacity:(NSUInteger)capacity;
51
+
52
+ /** initializes a Catmull Rom config with a capacity hint */
53
+ -(id) initWithCapacity:(NSUInteger)capacity;
54
+
55
+ /** appends a control point */
56
+ -(void) addControlPoint:(CGPoint)controlPoint;
57
+
58
+ /** inserts a controlPoint at index */
59
+ -(void) insertControlPoint:(CGPoint)controlPoint atIndex:(NSUInteger)index;
60
+
61
+ /** replaces an existing controlPoint at index */
62
+ -(void) replaceControlPoint:(CGPoint)controlPoint atIndex:(NSUInteger)index;
63
+
64
+ /** get the value of a controlPoint at a given index */
65
+ -(CGPoint) getControlPointAtIndex:(NSInteger)index;
66
+
67
+ /** deletes a control point at a given index */
68
+ -(void) removeControlPointAtIndex:(NSUInteger)index;
69
+
70
+ /** returns the number of objects of the control point array */
71
+ -(NSUInteger) count;
72
+
73
+ /** returns a new copy of the array reversed. User is responsible for releasing this copy */
74
+ -(CCPointArray*) reverse;
75
+
76
+ /** reverse the current control point array inline, without generating a new one */
77
+ -(void) reverseInline;
78
+ @end
79
+
80
+ /** Cardinal Spline path.
81
+ http://en.wikipedia.org/wiki/Cubic_Hermite_spline#Cardinal_spline
82
+ */
83
+ @interface CCCardinalSplineTo : CCActionInterval
84
+ {
85
+ CCPointArray *points_;
86
+ CGFloat deltaT_;
87
+ CGFloat tension_;
88
+ }
89
+
90
+ /** Array of control points */
91
+ @property (nonatomic,readwrite,retain) CCPointArray *points;
92
+
93
+ /** creates an action with a Cardinal Spline array of points and tension */
94
+ +(id) actionWithDuration:(ccTime)duration points:(CCPointArray*)points tension:(CGFloat)tension;
95
+
96
+ /** initializes the action with a duration and an array of points */
97
+ -(id) initWithDuration:(ccTime)duration points:(CCPointArray*)points tension:(CGFloat)tension;
98
+
99
+ @end
100
+
101
+ /** Cardinal Spline path.
102
+ http://en.wikipedia.org/wiki/Cubic_Hermite_spline#Cardinal_spline
103
+ */
104
+ @interface CCCardinalSplineBy : CCCardinalSplineTo
105
+ {
106
+ CGPoint startPosition_;
107
+ }
108
+ @end
109
+
110
+ /** An action that moves the target with a CatmullRom curve to a destination point.
111
+ A Catmull Rom is a Cardinal Spline with a tension of 0.5.
112
+ http://en.wikipedia.org/wiki/Cubic_Hermite_spline#Catmull.E2.80.93Rom_spline
113
+ */
114
+ @interface CCCatmullRomTo : CCCardinalSplineTo
115
+ {
116
+ }
117
+ /** creates an action with a Cardinal Spline array of points and tension */
118
+ +(id) actionWithDuration:(ccTime)dt points:(CCPointArray*)points;
119
+
120
+ /** initializes the action with a duration and an array of points */
121
+ -(id) initWithDuration:(ccTime)dt points:(CCPointArray*)points;
122
+ @end
123
+
124
+ /** An action that moves the target with a CatmullRom curve by a certain distance.
125
+ A Catmull Rom is a Cardinal Spline with a tension of 0.5.
126
+ http://en.wikipedia.org/wiki/Cubic_Hermite_spline#Catmull.E2.80.93Rom_spline
127
+ */
128
+ @interface CCCatmullRomBy : CCCardinalSplineBy
129
+ {
130
+ }
131
+ /** creates an action with a Cardinal Spline array of points and tension */
132
+ +(id) actionWithDuration:(ccTime)dt points:(CCPointArray*)points;
133
+
134
+ /** initializes the action with a duration and an array of points */
135
+ -(id) initWithDuration:(ccTime)dt points:(CCPointArray*)points;
136
+ @end
137
+
138
+ /** Returns the Cardinal Spline position for a given set of control points, tension and time */
139
+ CGPoint ccCardinalSplineAt( CGPoint p0, CGPoint p1, CGPoint p2, CGPoint p3, CGFloat tension, ccTime t );
@@ -0,0 +1,159 @@
1
+ /*
2
+ * cocos2d for iPhone: http://www.cocos2d-iphone.org
3
+ *
4
+ * Copyright (c) 2008-2009 Jason Booth
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 "CCActionInterval.h"
28
+
29
+ /** Base class for Easing actions
30
+ */
31
+ @interface CCActionEase : CCActionInterval <NSCopying>
32
+ {
33
+ CCActionInterval * other;
34
+ }
35
+ /** creates the action */
36
+ +(id) actionWithAction: (CCActionInterval*) action;
37
+ /** initializes the action */
38
+ -(id) initWithAction: (CCActionInterval*) action;
39
+ @end
40
+
41
+ /** Base class for Easing actions with rate parameters
42
+ */
43
+ @interface CCEaseRateAction : CCActionEase <NSCopying>
44
+ {
45
+ float rate;
46
+ }
47
+ /** rate value for the actions */
48
+ @property (nonatomic,readwrite,assign) float rate;
49
+ /** Creates the action with the inner action and the rate parameter */
50
+ +(id) actionWithAction: (CCActionInterval*) action rate:(float)rate;
51
+ /** Initializes the action with the inner action and the rate parameter */
52
+ -(id) initWithAction: (CCActionInterval*) action rate:(float)rate;
53
+ @end
54
+
55
+ /** CCEaseIn action with a rate
56
+ */
57
+ @interface CCEaseIn : CCEaseRateAction <NSCopying> {} @end
58
+
59
+ /** CCEaseOut action with a rate
60
+ */
61
+ @interface CCEaseOut : CCEaseRateAction <NSCopying> {} @end
62
+
63
+ /** CCEaseInOut action with a rate
64
+ */
65
+ @interface CCEaseInOut : CCEaseRateAction <NSCopying> {} @end
66
+
67
+ /** CCEase Exponential In
68
+ */
69
+ @interface CCEaseExponentialIn : CCActionEase <NSCopying> {} @end
70
+ /** Ease Exponential Out
71
+ */
72
+ @interface CCEaseExponentialOut : CCActionEase <NSCopying> {} @end
73
+ /** Ease Exponential InOut
74
+ */
75
+ @interface CCEaseExponentialInOut : CCActionEase <NSCopying> {} @end
76
+ /** Ease Sine In
77
+ */
78
+ @interface CCEaseSineIn : CCActionEase <NSCopying> {} @end
79
+ /** Ease Sine Out
80
+ */
81
+ @interface CCEaseSineOut : CCActionEase <NSCopying> {} @end
82
+ /** Ease Sine InOut
83
+ */
84
+ @interface CCEaseSineInOut : CCActionEase <NSCopying> {} @end
85
+
86
+ /** Ease Elastic abstract class
87
+ @since v0.8.2
88
+ */
89
+ @interface CCEaseElastic : CCActionEase <NSCopying>
90
+ {
91
+ float period_;
92
+ }
93
+
94
+ /** period of the wave in radians. default is 0.3 */
95
+ @property (nonatomic,readwrite) float period;
96
+
97
+ /** Creates the action with the inner action and the period in radians (default is 0.3) */
98
+ +(id) actionWithAction: (CCActionInterval*) action period:(float)period;
99
+ /** Initializes the action with the inner action and the period in radians (default is 0.3) */
100
+ -(id) initWithAction: (CCActionInterval*) action period:(float)period;
101
+ @end
102
+
103
+ /** Ease Elastic In action.
104
+ @warning This action doesn't use a bijective fucntion. Actions like Sequence might have an unexpected result when used with this action.
105
+ @since v0.8.2
106
+ */
107
+ @interface CCEaseElasticIn : CCEaseElastic <NSCopying> {} @end
108
+ /** Ease Elastic Out action.
109
+ @warning This action doesn't use a bijective fucntion. Actions like Sequence might have an unexpected result when used with this action.
110
+ @since v0.8.2
111
+ */
112
+ @interface CCEaseElasticOut : CCEaseElastic <NSCopying> {} @end
113
+ /** Ease Elastic InOut action.
114
+ @warning This action doesn't use a bijective fucntion. Actions like Sequence might have an unexpected result when used with this action.
115
+ @since v0.8.2
116
+ */
117
+ @interface CCEaseElasticInOut : CCEaseElastic <NSCopying> {} @end
118
+
119
+ /** CCEaseBounce abstract class.
120
+ @since v0.8.2
121
+ */
122
+ @interface CCEaseBounce : CCActionEase <NSCopying> {} @end
123
+
124
+ /** CCEaseBounceIn action.
125
+ @warning This action doesn't use a bijective fucntion. Actions like Sequence might have an unexpected result when used with this action.
126
+ @since v0.8.2
127
+ */
128
+ @interface CCEaseBounceIn : CCEaseBounce <NSCopying> {} @end
129
+
130
+ /** EaseBounceOut action.
131
+ @warning This action doesn't use a bijective fucntion. Actions like Sequence might have an unexpected result when used with this action.
132
+ @since v0.8.2
133
+ */
134
+ @interface CCEaseBounceOut : CCEaseBounce <NSCopying> {} @end
135
+
136
+ /** CCEaseBounceInOut action.
137
+ @warning This action doesn't use a bijective fucntion. Actions like Sequence might have an unexpected result when used with this action.
138
+ @since v0.8.2
139
+ */
140
+ @interface CCEaseBounceInOut : CCEaseBounce <NSCopying> {} @end
141
+
142
+ /** CCEaseBackIn action.
143
+ @warning This action doesn't use a bijective fucntion. Actions like Sequence might have an unexpected result when used with this action.
144
+ @since v0.8.2
145
+ */
146
+ @interface CCEaseBackIn : CCActionEase <NSCopying> {} @end
147
+
148
+ /** CCEaseBackOut action.
149
+ @warning This action doesn't use a bijective fucntion. Actions like Sequence might have an unexpected result when used with this action.
150
+ @since v0.8.2
151
+ */
152
+ @interface CCEaseBackOut : CCActionEase <NSCopying> {} @end
153
+
154
+ /** CCEaseBackInOut action.
155
+ @warning This action doesn't use a bijective fucntion. Actions like Sequence might have an unexpected result when used with this action.
156
+ @since v0.8.2
157
+ */
158
+ @interface CCEaseBackInOut : CCActionEase <NSCopying> {} @end
159
+