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,344 @@
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 "ccConfig.h"
28
+ #import "ccTypes.h"
29
+ #import "ccMacros.h"
30
+
31
+ #import "CCProtocols.h"
32
+ #import "Platforms/CCGL.h"
33
+ #import "kazmath/mat4.h"
34
+
35
+ /** @typedef ccDirectorProjection
36
+ Possible OpenGL projections used by director
37
+ */
38
+ typedef enum {
39
+ /// sets a 2D projection (orthogonal projection).
40
+ kCCDirectorProjection2D,
41
+
42
+ /// sets a 3D projection with a fovy=60, znear=0.5f and zfar=1500.
43
+ kCCDirectorProjection3D,
44
+
45
+ /// it calls "updateProjection" on the projection delegate.
46
+ kCCDirectorProjectionCustom,
47
+
48
+ /// Detault projection is 3D projection
49
+ kCCDirectorProjectionDefault = kCCDirectorProjection3D,
50
+
51
+ } ccDirectorProjection;
52
+
53
+
54
+ @class CCLabelAtlas;
55
+ @class CCScene;
56
+ @class CCScheduler;
57
+ @class CCActionManager;
58
+
59
+
60
+ #ifdef __CC_PLATFORM_IOS
61
+ #define CC_VIEWCONTROLLER UIViewController
62
+ #elif defined(__CC_PLATFORM_MAC)
63
+ #define CC_VIEWCONTROLLER NSObject
64
+ #endif
65
+
66
+ /**Class that creates and handle the main Window and manages how
67
+ and when to execute the Scenes.
68
+
69
+ The CCDirector is also resposible for:
70
+ - initializing the OpenGL ES context
71
+ - setting the OpenGL pixel format (default on is RGB565)
72
+ - setting the OpenGL buffer depth (default one is 0-bit)
73
+ - setting the projection (default one is 3D)
74
+
75
+ Since the CCDirector is a singleton, the standard way to use it is by calling:
76
+ - [[CCDirector sharedDirector] methodName];
77
+
78
+ The CCDirector also sets the default OpenGL context:
79
+ - GL_TEXTURE_2D is enabled
80
+ - GL_VERTEX_ARRAY is enabled
81
+ - GL_COLOR_ARRAY is enabled
82
+ - GL_TEXTURE_COORD_ARRAY is enabled
83
+ */
84
+ @interface CCDirector : CC_VIEWCONTROLLER
85
+ {
86
+ // internal timer
87
+ NSTimeInterval animationInterval_;
88
+ NSTimeInterval oldAnimationInterval_;
89
+
90
+ /* stats */
91
+ BOOL displayStats_;
92
+
93
+ NSUInteger frames_;
94
+ NSUInteger totalFrames_;
95
+ ccTime secondsPerFrame_;
96
+
97
+ ccTime accumDt_;
98
+ ccTime frameRate_;
99
+ CCLabelAtlas *FPSLabel_;
100
+ CCLabelAtlas *SPFLabel_;
101
+ CCLabelAtlas *drawsLabel_;
102
+
103
+ /* is the running scene paused */
104
+ BOOL isPaused_;
105
+
106
+ /* Is the director running */
107
+ BOOL isAnimating_;
108
+
109
+ /* The running scene */
110
+ CCScene *runningScene_;
111
+
112
+ /* This object will be visited after the scene. Useful to hook a notification node */
113
+ id notificationNode_;
114
+
115
+ /* will be the next 'runningScene' in the next frame
116
+ nextScene is a weak reference. */
117
+ CCScene *nextScene_;
118
+
119
+ /* If YES, then "old" scene will receive the cleanup message */
120
+ BOOL sendCleanupToScene_;
121
+
122
+ /* scheduled scenes */
123
+ NSMutableArray *scenesStack_;
124
+
125
+ /* last time the main loop was updated */
126
+ struct timeval lastUpdate_;
127
+ /* delta time since last tick to main loop */
128
+ ccTime dt;
129
+ /* whether or not the next delta time will be zero */
130
+ BOOL nextDeltaTimeZero_;
131
+
132
+ /* projection used */
133
+ ccDirectorProjection projection_;
134
+
135
+ /* CCDirector delegate */
136
+ id<CCDirectorDelegate> delegate_;
137
+
138
+ /* window size in points */
139
+ CGSize winSizeInPoints_;
140
+
141
+ /* window size in pixels */
142
+ CGSize winSizeInPixels_;
143
+
144
+ /* the cocos2d running thread */
145
+ NSThread *runningThread_;
146
+
147
+ /* scheduler associated with this director */
148
+ CCScheduler *scheduler_;
149
+
150
+ /* action manager associated with this director */
151
+ CCActionManager *actionManager_;
152
+
153
+ /* OpenGLView. On iOS it is a copy of self.view */
154
+ CCGLView *view_;
155
+ }
156
+
157
+ /** returns the cocos2d thread.
158
+ If you want to run any cocos2d task, run it in this thread.
159
+ On iOS usually it is the main thread.
160
+ @since v0.99.5
161
+ */
162
+ @property (readonly, nonatomic ) NSThread *runningThread;
163
+ /** The current running Scene. Director can only run one Scene at the time */
164
+ @property (nonatomic,readonly) CCScene* runningScene;
165
+ /** The FPS value */
166
+ @property (nonatomic,readwrite, assign) NSTimeInterval animationInterval;
167
+ /** Whether or not to display director statistics */
168
+ @property (nonatomic, readwrite, assign) BOOL displayStats;
169
+ /** whether or not the next delta time will be zero */
170
+ @property (nonatomic,readwrite,assign) BOOL nextDeltaTimeZero;
171
+ /** Whether or not the Director is paused */
172
+ @property (nonatomic,readonly) BOOL isPaused;
173
+ /** Whether or not the Director is active (animating) */
174
+ @property (nonatomic,readonly) BOOL isAnimating;
175
+ /** Sets an OpenGL projection */
176
+ @property (nonatomic,readwrite) ccDirectorProjection projection;
177
+ /** How many frames were called since the director started */
178
+ @property (nonatomic,readonly) NSUInteger totalFrames;
179
+ /** seconds per frame */
180
+ @property (nonatomic, readonly) ccTime secondsPerFrame;
181
+
182
+ /** Whether or not the replaced scene will receive the cleanup message.
183
+ If the new scene is pushed, then the old scene won't receive the "cleanup" message.
184
+ If the new scene replaces the old one, the it will receive the "cleanup" message.
185
+ @since v0.99.0
186
+ */
187
+ @property (nonatomic, readonly) BOOL sendCleanupToScene;
188
+
189
+ /** This object will be visited after the main scene is visited.
190
+ This object MUST implement the "visit" selector.
191
+ Useful to hook a notification object, like CCNotifications (http://github.com/manucorporat/CCNotifications)
192
+ @since v0.99.5
193
+ */
194
+ @property (nonatomic, readwrite, retain) id notificationNode;
195
+
196
+ /** CCDirector delegate. It shall implemente the CCDirectorDelegate protocol
197
+ @since v0.99.5
198
+ */
199
+ @property (nonatomic, readwrite, retain) id<CCDirectorDelegate> delegate;
200
+
201
+ /** CCScheduler associated with this director
202
+ @since v2.0
203
+ */
204
+ @property (nonatomic,readwrite,retain) CCScheduler *scheduler;
205
+
206
+ /** CCActionManager associated with this director
207
+ @since v2.0
208
+ */
209
+ @property (nonatomic,readwrite,retain) CCActionManager *actionManager;
210
+
211
+ /** returns a shared instance of the director */
212
+ +(CCDirector*)sharedDirector;
213
+
214
+
215
+ #pragma mark Director - Stats
216
+
217
+ #pragma mark Director - Win Size
218
+ /** returns the size of the OpenGL view in points */
219
+ - (CGSize) winSize;
220
+
221
+ /** returns the size of the OpenGL view in pixels.
222
+ On Mac winSize and winSizeInPixels return the same value.
223
+ */
224
+ - (CGSize) winSizeInPixels;
225
+
226
+ /** changes the projection size */
227
+ -(void) reshapeProjection:(CGSize)newWindowSize;
228
+
229
+ /** converts a UIKit coordinate to an OpenGL coordinate
230
+ Useful to convert (multi) touchs coordinates to the current layout (portrait or landscape)
231
+ */
232
+ -(CGPoint) convertToGL: (CGPoint) p;
233
+ /** converts an OpenGL coordinate to a UIKit coordinate
234
+ Useful to convert node points to window points for calls such as glScissor
235
+ */
236
+ -(CGPoint) convertToUI:(CGPoint)p;
237
+
238
+ /// XXX: missing description
239
+ -(float) getZEye;
240
+
241
+ #pragma mark Director - Scene Management
242
+
243
+ /**Enters the Director's main loop with the given Scene.
244
+ * Call it to run only your FIRST scene.
245
+ * Don't call it if there is already a running scene.
246
+ *
247
+ * It will call pushScene: and then it will call startAnimation
248
+ */
249
+ - (void) runWithScene:(CCScene*) scene;
250
+
251
+ /**Suspends the execution of the running scene, pushing it on the stack of suspended scenes.
252
+ * The new scene will be executed.
253
+ * Try to avoid big stacks of pushed scenes to reduce memory allocation.
254
+ * ONLY call it if there is a running scene.
255
+ */
256
+ - (void) pushScene:(CCScene*) scene;
257
+
258
+ /**Pops out a scene from the queue.
259
+ * This scene will replace the running one.
260
+ * The running scene will be deleted. If there are no more scenes in the stack the execution is terminated.
261
+ * ONLY call it if there is a running scene.
262
+ */
263
+ - (void) popScene;
264
+
265
+ /**Pops out all scenes from the queue until the root scene in the queue.
266
+ * This scene will replace the running one.
267
+ * The running scene will be deleted. If there are no more scenes in the stack the execution is terminated.
268
+ * ONLY call it if there is a running scene.
269
+ */
270
+ - (void) popToRootScene;
271
+
272
+ /** Replaces the running scene with a new one. The running scene is terminated.
273
+ * ONLY call it if there is a running scene.
274
+ */
275
+ -(void) replaceScene: (CCScene*) scene;
276
+
277
+ /** Ends the execution, releases the running scene.
278
+ It doesn't remove the OpenGL view from its parent. You have to do it manually.
279
+ */
280
+ -(void) end;
281
+
282
+ /** Pauses the running scene.
283
+ The running scene will be _drawed_ but all scheduled timers will be paused
284
+ While paused, the draw rate will be 4 FPS to reduce CPU consuption
285
+ */
286
+ -(void) pause;
287
+
288
+ /** Resumes the paused scene
289
+ The scheduled timers will be activated again.
290
+ The "delta time" will be 0 (as if the game wasn't paused)
291
+ */
292
+ -(void) resume;
293
+
294
+ /** Stops the animation. Nothing will be drawn. The main loop won't be triggered anymore.
295
+ If you wan't to pause your animation call [pause] instead.
296
+ */
297
+ -(void) stopAnimation;
298
+
299
+ /** The main loop is triggered again.
300
+ Call this function only if [stopAnimation] was called earlier
301
+ @warning Dont' call this function to start the main loop. To run the main loop call runWithScene
302
+ */
303
+ -(void) startAnimation;
304
+
305
+ /** Draw the scene.
306
+ This method is called every frame. Don't call it manually.
307
+ */
308
+ -(void) drawScene;
309
+
310
+
311
+ // XXX: Hack. Should be placed on CCDirectorMac.h. Refactoring needed
312
+ #if defined(__CC_PLATFORM_MAC)
313
+ /** sets the openGL view */
314
+ -(void) setView:(CCGLView*)view;
315
+
316
+ /** returns the OpenGL view */
317
+ -(CCGLView*) view;
318
+ #endif
319
+
320
+ #pragma mark Director - Memory Helper
321
+
322
+ /** Removes all the cocos2d data that was cached automatically.
323
+ It will purge the CCTextureCache, CCLabelBMFont cache.
324
+ IMPORTANT: The CCSpriteFrameCache won't be purged. If you want to purge it, you have to purge it manually.
325
+ @since v0.99.3
326
+ */
327
+ -(void) purgeCachedData;
328
+
329
+ // OpenGL Helper
330
+
331
+ /** sets the OpenGL default values */
332
+ -(void) setGLDefaultValues;
333
+ /** enables/disables OpenGL alpha blending */
334
+ - (void) setAlphaBlending: (BOOL) on;
335
+ /** enables/disables OpenGL depth test */
336
+ - (void) setDepthTest: (BOOL) on;
337
+
338
+ // helper
339
+ /** creates the Stats labels */
340
+ -(void) createStatsLabel;
341
+ @end
342
+
343
+ // optimization. Should only be used to read it. Never to write it.
344
+ extern NSUInteger __ccNumberOfDraws;
@@ -0,0 +1,104 @@
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
+ // Only compile this code on iOS. These files should NOT be included on your Mac project.
28
+ // But in case they are included, it won't be compiled.
29
+ #import "../../ccMacros.h"
30
+ #ifdef __CC_PLATFORM_IOS
31
+
32
+ #import "../../CCDirector.h"
33
+ #import "kazmath/mat4.h"
34
+
35
+ @class CCTouchDispatcher;
36
+
37
+ /** CCDirector extensions for iPhone
38
+ */
39
+ @interface CCDirector (iOSExtension)
40
+
41
+ /** sets the CCTouchDispatcher (iOS only) */
42
+ @property (nonatomic,readwrite,retain) CCTouchDispatcher * touchDispatcher;
43
+
44
+ /** The size in pixels of the surface. It could be different than the screen size.
45
+ High-res devices might have a higher surface size than the screen size.
46
+ In non High-res device the contentScale will be emulated.
47
+
48
+ The recommend way to enable Retina Display is by using the "enableRetinaDisplay:(BOOL)enabled" method.
49
+
50
+ @since v0.99.4
51
+ */
52
+ -(void) setContentScaleFactor:(CGFloat)scaleFactor;
53
+
54
+ /** Will enable Retina Display on devices that supports it.
55
+ It will enable Retina Display on iPhone4 and iPod Touch 4.
56
+ It will return YES, if it could enabled it, otherwise it will return NO.
57
+
58
+ This is the recommened way to enable Retina Display.
59
+ @since v0.99.5
60
+ */
61
+ -(BOOL) enableRetinaDisplay:(BOOL)enableRetina;
62
+
63
+ /** returns the content scale factor */
64
+ -(CGFloat) contentScaleFactor;
65
+ @end
66
+
67
+ #pragma mark -
68
+ #pragma mark CCDirectorIOS
69
+
70
+ /** CCDirectorIOS: Base class of iOS directors
71
+ @since v0.99.5
72
+ */
73
+ @interface CCDirectorIOS : CCDirector
74
+ {
75
+ /* contentScaleFactor could be simulated */
76
+ BOOL isContentScaleSupported_;
77
+
78
+ CCTouchDispatcher *touchDispatcher_;
79
+ }
80
+ @end
81
+
82
+ /** DisplayLinkDirector is a Director that synchronizes timers with the refresh rate of the display.
83
+ *
84
+ * Features and Limitations:
85
+ * - Only available on 3.1+
86
+ * - Scheduled timers & drawing are synchronizes with the refresh rate of the display
87
+ * - Only supports animation intervals of 1/60 1/30 & 1/15
88
+ *
89
+ * It is the recommended Director if the SDK is 3.1 or newer
90
+ *
91
+ * @since v0.8.2
92
+ */
93
+ @interface CCDirectorDisplayLink : CCDirectorIOS
94
+ {
95
+ CADisplayLink *displayLink_;
96
+ CFTimeInterval lastDisplayTime_;
97
+ }
98
+ -(void) mainLoop:(id)sender;
99
+ @end
100
+
101
+ // optimization. Should only be used to read it. Never to write it.
102
+ extern CGFloat __ccContentScaleFactor;
103
+
104
+ #endif // __CC_PLATFORM_IOS
@@ -0,0 +1,139 @@
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
+ #ifndef __CC_DRAWING_PRIMITIVES_H
28
+ #define __CC_DRAWING_PRIMITIVES_H
29
+
30
+ #import <Foundation/Foundation.h>
31
+
32
+ #import "ccTypes.h"
33
+ #import "ccMacros.h"
34
+
35
+ #ifdef __CC_PLATFORM_IOS
36
+ #import <CoreGraphics/CGGeometry.h> // for CGPoint
37
+ #endif
38
+
39
+
40
+ #ifdef __cplusplus
41
+ extern "C" {
42
+ #endif
43
+
44
+ @class CCPointArray;
45
+
46
+
47
+ /**
48
+ @file
49
+ Drawing OpenGL ES primitives.
50
+ - ccDrawPoint
51
+ - ccDrawLine
52
+ - ccDrawPoly
53
+ - ccDrawCircle
54
+ - ccDrawQuadBezier
55
+ - ccDrawCubicBezier
56
+
57
+ You can change the color, width and other property by calling the
58
+ glColor4ub(), glLineWidth(), glPointSize().
59
+
60
+ @warning These functions draws the Line, Point, Polygon, immediately. They aren't batched. If you are going to make a game that depends on these primitives, I suggest creating a batch.
61
+ */
62
+
63
+
64
+ /** draws a point given x and y coordinate measured in points. */
65
+ void ccDrawPoint( CGPoint point );
66
+
67
+ /** draws an array of points.
68
+ @since v0.7.2
69
+ */
70
+ void ccDrawPoints( const CGPoint *points, NSUInteger numberOfPoints );
71
+
72
+ /** draws a line given the origin and destination point measured in points. */
73
+ void ccDrawLine( CGPoint origin, CGPoint destination );
74
+
75
+ /** draws a rectangle given the origin and destination point measured in points. */
76
+ void ccDrawRect( CGPoint origin, CGPoint destination );
77
+
78
+ /** draws a solid rectangle given the origin and destination point measured in points.
79
+ @since 1.1
80
+ */
81
+ void ccDrawSolidRect( CGPoint origin, CGPoint destination, ccColor4F color );
82
+
83
+ /** draws a poligon given a pointer to CGPoint coordiantes and the number of vertices measured in points.
84
+ The polygon can be closed or open
85
+ */
86
+ void ccDrawPoly( const CGPoint *vertices, NSUInteger numOfVertices, BOOL closePolygon );
87
+
88
+ /** draws a solid polygon given a pointer to CGPoint coordiantes, the number of vertices measured in points, and a color.
89
+ */
90
+ void ccDrawSolidPoly( const CGPoint *poli, NSUInteger numberOfPoints, ccColor4F color );
91
+
92
+ /** draws a circle given the center, radius and number of segments measured in points */
93
+ void ccDrawCircle( CGPoint center, float radius, float angle, NSUInteger segments, BOOL drawLineToCenter);
94
+
95
+ /** draws a quad bezier path measured in points.
96
+ @warning This function could be pretty slow. Use it only for debugging purposes.
97
+ @since v0.8
98
+ */
99
+ void ccDrawQuadBezier(CGPoint origin, CGPoint control, CGPoint destination, NSUInteger segments);
100
+
101
+ /** draws a cubic bezier path measured in points.
102
+ @warning This function could be pretty slow. Use it only for debugging purposes.
103
+ @since v0.8
104
+ */
105
+ void ccDrawCubicBezier(CGPoint origin, CGPoint control1, CGPoint control2, CGPoint destination, NSUInteger segments);
106
+
107
+ /** draws a Catmull Rom path.
108
+ @warning This function could be pretty slow. Use it only for debugging purposes.
109
+ @since v2.0
110
+ */
111
+ void ccDrawCatmullRom( CCPointArray *arrayOfControlPoints, NSUInteger segments );
112
+
113
+ /** draws a Cardinal Spline path.
114
+ @warning This function could be pretty slow. Use it only for debugging purposes.
115
+ @since v2.0
116
+ */
117
+ void ccDrawCardinalSpline( CCPointArray *config, CGFloat tension, NSUInteger segments );
118
+
119
+ /** set the drawing color with 4 unsigned bytes
120
+ @since v2.0
121
+ */
122
+ void ccDrawColor4B( GLubyte r, GLubyte g, GLubyte b, GLubyte a );
123
+
124
+ /** set the drawing color with 4 floats
125
+ @since v2.0
126
+ */
127
+ void ccDrawColor4F( GLfloat r, GLfloat g, GLfloat b, GLfloat a );
128
+
129
+ /** set the point size in points. Default 1.
130
+ @since v2.0
131
+ */
132
+ void ccPointSize( GLfloat pointSize );
133
+
134
+
135
+ #ifdef __cplusplus
136
+ }
137
+ #endif
138
+
139
+ #endif // __CC_DRAWING_PRIMITIVES_H