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,74 @@
1
+ /*
2
+ * cocos2d for iPhone: http://www.cocos2d-iphone.org
3
+ *
4
+ * Copyright (c) 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 <Foundation/Foundation.h>
28
+
29
+ @class CCAnimation;
30
+
31
+ /** Singleton that manages the CCAnimation objects.
32
+ It saves in a cache the animations. You should use this class if you want to save your animations in a cache.
33
+
34
+ @since v0.99.5
35
+ */
36
+ @interface CCAnimationCache : NSObject
37
+ {
38
+ NSMutableDictionary *animations_;
39
+ }
40
+
41
+ /** Retruns ths shared instance of the Animation cache */
42
+ + (CCAnimationCache *) sharedAnimationCache;
43
+
44
+ /** Purges the cache. It releases all the CCAnimation objects and the shared instance.
45
+ */
46
+ +(void)purgeSharedAnimationCache;
47
+
48
+ /** Adds a CCAnimation with a name.
49
+ */
50
+ -(void) addAnimation:(CCAnimation*)animation name:(NSString*)name;
51
+
52
+ /** Deletes a CCAnimation from the cache.
53
+ */
54
+ -(void) removeAnimationByName:(NSString*)name;
55
+
56
+ /** Returns a CCAnimation that was previously added.
57
+ If the name is not found it will return nil.
58
+ You should retain the returned copy if you are going to use it.
59
+ */
60
+ -(CCAnimation*) animationByName:(NSString*)name;
61
+
62
+ /** Adds an animation from an NSDictionary
63
+ Make sure that the frames were previously loaded in the CCSpriteFrameCache.
64
+ @since v1.1
65
+ */
66
+ -(void)addAnimationsWithDictionary:(NSDictionary *)dictionary;
67
+
68
+ /** Adds an animation from a plist file.
69
+ Make sure that the frames were previously loaded in the CCSpriteFrameCache.
70
+ @since v1.1
71
+ */
72
+ -(void)addAnimationsWithFile:(NSString *)plist;
73
+
74
+ @end
@@ -0,0 +1,119 @@
1
+ /*
2
+ * cocos2d for iPhone: http://www.cocos2d-iphone.org
3
+ *
4
+ * Copyright (c) 2010 ForzeField Studios S.L. http://forzefield.com
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
+ #import "ccCArray.h"
27
+
28
+
29
+ /** A faster alternative of NSArray.
30
+ CCArray uses internally a c-array.
31
+ @since v0.99.4
32
+ */
33
+
34
+
35
+ /** @def CCARRAY_FOREACH
36
+ A convience macro to iterate over a CCArray using. It is faster than the "fast enumeration" interface.
37
+ @since v0.99.4
38
+ */
39
+
40
+ #define CCARRAY_FOREACH(__array__, __object__) \
41
+ if (__array__ && __array__->data->num > 0) \
42
+ for(const CC_ARC_UNSAFE_RETAINED id *__arr__ = __array__->data->arr, *end = __array__->data->arr + __array__->data->num-1; \
43
+ __arr__ <= end && ((__object__ = *__arr__) != nil || true); \
44
+ __arr__++)
45
+
46
+ @interface CCArray : NSObject <NSFastEnumeration, NSCoding, NSCopying>
47
+ {
48
+ @public ccArray *data;
49
+ }
50
+
51
+ + (id) array;
52
+ + (id) arrayWithCapacity:(NSUInteger)capacity;
53
+ + (id) arrayWithArray:(CCArray*)otherArray;
54
+ + (id) arrayWithNSArray:(NSArray*)otherArray;
55
+
56
+
57
+ - (id) initWithCapacity:(NSUInteger)capacity;
58
+ - (id) initWithArray:(CCArray*)otherArray;
59
+ - (id) initWithNSArray:(NSArray*)otherArray;
60
+
61
+
62
+ // Querying an Array
63
+
64
+ - (NSUInteger) count;
65
+ - (NSUInteger) capacity;
66
+ - (NSUInteger) indexOfObject:(id)object;
67
+ - (id) objectAtIndex:(NSUInteger)index;
68
+ - (BOOL) containsObject:(id)object;
69
+ - (id) randomObject;
70
+ - (id) lastObject;
71
+ - (NSArray*) getNSArray;
72
+ /** @since 1.1 */
73
+ - (BOOL) isEqualToArray:(CCArray*)otherArray;
74
+
75
+
76
+ // Adding Objects
77
+
78
+ - (void) addObject:(id)object;
79
+ - (void) addObjectsFromArray:(CCArray*)otherArray;
80
+ - (void) addObjectsFromNSArray:(NSArray*)otherArray;
81
+ - (void) insertObject:(id)object atIndex:(NSUInteger)index;
82
+
83
+
84
+ // Removing Objects
85
+
86
+ - (void) removeLastObject;
87
+ - (void) removeObject:(id)object;
88
+ - (void) removeObjectAtIndex:(NSUInteger)index;
89
+ - (void) removeObjectsInArray:(CCArray*)otherArray;
90
+ - (void) removeAllObjects;
91
+ - (void) fastRemoveObject:(id)object;
92
+ - (void) fastRemoveObjectAtIndex:(NSUInteger)index;
93
+
94
+
95
+ // Rearranging Content
96
+
97
+ - (void) exchangeObject:(id)object1 withObject:(id)object2;
98
+ - (void) exchangeObjectAtIndex:(NSUInteger)index1 withObjectAtIndex:(NSUInteger)index2;
99
+ /** @since 1.1 */
100
+ - (void) replaceObjectAtIndex:(NSUInteger)index withObject:(id)anObject;
101
+ - (void) reverseObjects;
102
+ - (void) reduceMemoryFootprint;
103
+
104
+ // Sorting Array
105
+ /** all since @1.1 */
106
+ - (void) qsortUsingCFuncComparator:(int(*)(const void *, const void *))comparator; // c qsort is used for sorting
107
+ - (void) insertionSortUsingCFuncComparator:(int(*)(const void *, const void *))comparator; // insertion sort
108
+ - (void) mergesortLUsingCFuncComparator:(int(*)(const void *, const void *))comparator; // mergesort
109
+ - (void) insertionSort:(SEL)selector; // It sorts source array in ascending order
110
+ - (void) sortUsingFunction:(NSInteger (*)(id, id, void *))compare context:(void *)context;
111
+
112
+ // Sending Messages to Elements
113
+
114
+ - (void) makeObjectsPerformSelector:(SEL)aSelector;
115
+ - (void) makeObjectsPerformSelector:(SEL)aSelector withObject:(id)object;
116
+ /** @since 1.1 */
117
+ - (void) makeObjectPerformSelectorWithArrayObjects:(id)object selector:(SEL)aSelector;
118
+
119
+ @end
@@ -0,0 +1,96 @@
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
+ *
8
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
9
+ * of this software and associated documentation files (the "Software"), to deal
10
+ * in the Software without restriction, including without limitation the rights
11
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12
+ * copies of the Software, and to permit persons to whom the Software is
13
+ * furnished to do so, subject to the following conditions:
14
+ *
15
+ * The above copyright notice and this permission notice shall be included in
16
+ * all copies or substantial portions of the Software.
17
+ *
18
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24
+ * THE SOFTWARE.
25
+ */
26
+
27
+
28
+ #import "CCTextureAtlas.h"
29
+ #import "CCNode.h"
30
+ #import "CCProtocols.h"
31
+
32
+ /** CCAtlasNode is a subclass of CCNode that implements the CCRGBAProtocol and
33
+ CCTextureProtocol protocol
34
+
35
+ It knows how to render a TextureAtlas object.
36
+ If you are going to render a TextureAtlas consider subclassing CCAtlasNode (or a subclass of CCAtlasNode)
37
+
38
+ All features from CCNode are valid, plus the following features:
39
+ - opacity and RGB colors
40
+ */
41
+ @interface CCAtlasNode : CCNode <CCRGBAProtocol, CCTextureProtocol>
42
+ {
43
+ // texture atlas
44
+ CCTextureAtlas *textureAtlas_;
45
+
46
+ // chars per row
47
+ NSUInteger itemsPerRow_;
48
+ // chars per column
49
+ NSUInteger itemsPerColumn_;
50
+
51
+ // width of each char
52
+ NSUInteger itemWidth_;
53
+ // height of each char
54
+ NSUInteger itemHeight_;
55
+
56
+ // quads to draw
57
+ NSUInteger quadsToDraw_;
58
+
59
+ // blend function
60
+ ccBlendFunc blendFunc_;
61
+
62
+ // texture RGBA.
63
+ GLubyte opacity_;
64
+ ccColor3B color_;
65
+ ccColor3B colorUnmodified_;
66
+ BOOL opacityModifyRGB_;
67
+
68
+ // color uniform
69
+ GLint uniformColor_;
70
+ }
71
+
72
+ /** conforms to CCTextureProtocol protocol */
73
+ @property (nonatomic,readwrite,retain) CCTextureAtlas *textureAtlas;
74
+
75
+ /** conforms to CCTextureProtocol protocol */
76
+ @property (nonatomic,readwrite) ccBlendFunc blendFunc;
77
+
78
+ /** conforms to CCRGBAProtocol protocol */
79
+ @property (nonatomic,readwrite) GLubyte opacity;
80
+ /** conforms to CCRGBAProtocol protocol */
81
+ @property (nonatomic,readwrite) ccColor3B color;
82
+
83
+ /** how many quads to draw */
84
+ @property (nonatomic,readwrite) NSUInteger quadsToDraw;
85
+
86
+ /** creates a CCAtlasNode with an Atlas file the width and height of each item measured in points and the quantity of items to render*/
87
+ +(id) atlasWithTileFile:(NSString*)tile tileWidth:(NSUInteger)w tileHeight:(NSUInteger)h itemsToRender: (NSUInteger) c;
88
+
89
+ /** initializes an CCAtlasNode with an Atlas file the width and height of each item measured in points and the quantity of items to render*/
90
+ -(id) initWithTileFile:(NSString*)tile tileWidth:(NSUInteger)w tileHeight:(NSUInteger)h itemsToRender: (NSUInteger) c;
91
+
92
+ /** updates the Atlas (indexed vertex array).
93
+ * Shall be overriden in subclasses
94
+ */
95
+ -(void) updateAtlasValues;
96
+ @end
@@ -0,0 +1,98 @@
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
+ #import "CCNode.h"
29
+ #import "kazmath/mat4.h"
30
+
31
+ /**
32
+ A CCCamera is used in every CCNode.
33
+ Useful to look at the object from different views.
34
+ The OpenGL gluLookAt() function is used to locate the
35
+ camera.
36
+
37
+ If the object is transformed by any of the scale, rotation or
38
+ position attributes, then they will override the camera.
39
+
40
+ IMPORTANT: Either your use the camera or the rotation/scale/position properties. You can't use both.
41
+ World coordinates won't work if you use the camera.
42
+
43
+ Limitations:
44
+
45
+ - Some nodes, like CCParallaxNode, CCParticle uses world node coordinates, and they won't work properly if you move them (or any of their ancestors)
46
+ using the camera.
47
+
48
+ - It doesn't work on batched nodes like CCSprite objects when they are parented to a CCSpriteBatchNode object.
49
+
50
+ - It is recommended to use it ONLY if you are going to create 3D effects. For 2D effecs, use the action CCFollow or position/scale/rotate.
51
+
52
+ */
53
+
54
+ @interface CCCamera : NSObject
55
+ {
56
+ float eyeX_;
57
+ float eyeY_;
58
+ float eyeZ_;
59
+
60
+ float centerX_;
61
+ float centerY_;
62
+ float centerZ_;
63
+
64
+ float upX_;
65
+ float upY_;
66
+ float upZ_;
67
+
68
+ BOOL dirty_;
69
+
70
+ kmMat4 lookupMatrix_;
71
+ }
72
+
73
+ /** whether of not the camera is dirty */
74
+ @property (nonatomic,readwrite) BOOL dirty;
75
+
76
+ /** returns the Z eye */
77
+ +(float) getZEye;
78
+
79
+ /** sets the camera in the defaul position */
80
+ -(void) restore;
81
+ /** Sets the camera using gluLookAt using its eye, center and up_vector */
82
+ -(void) locate;
83
+ /** sets the eye values in points */
84
+ -(void) setEyeX: (float)x eyeY:(float)y eyeZ:(float)z;
85
+ /** sets the center values in points */
86
+ -(void) setCenterX: (float)x centerY:(float)y centerZ:(float)z;
87
+ /** sets the up values */
88
+ -(void) setUpX: (float)x upY:(float)y upZ:(float)z;
89
+
90
+ /** get the eye vector values in points */
91
+ -(void) eyeX:(float*)x eyeY:(float*)y eyeZ:(float*)z;
92
+ /** get the center vector values in points */
93
+ -(void) centerX:(float*)x centerY:(float*)y centerZ:(float*)z;
94
+ /** get the up vector values */
95
+ -(void) upX:(float*)x upY:(float*)y upZ:(float*)z;
96
+
97
+
98
+ @end
@@ -0,0 +1,126 @@
1
+ /*
2
+ * cocos2d for iPhone: http://www.cocos2d-iphone.org
3
+ *
4
+ * Copyright (c) 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
+ #import <Foundation/Foundation.h>
27
+
28
+ #import "Platforms/CCGL.h"
29
+
30
+ /** OS version definitions. Includes both iOS and Mac OS versions
31
+ */
32
+ enum {
33
+ kCCiOSVersion_4_0 = 0x04000000,
34
+ kCCiOSVersion_4_0_1 = 0x04000100,
35
+ kCCiOSVersion_4_1 = 0x04010000,
36
+ kCCiOSVersion_4_2 = 0x04020000,
37
+ kCCiOSVersion_4_2_1 = 0x04020100,
38
+ kCCiOSVersion_4_3 = 0x04030000,
39
+ kCCiOSVersion_4_3_1 = 0x04030100,
40
+ kCCiOSVersion_4_3_2 = 0x04030200,
41
+ kCCiOSVersion_4_3_3 = 0x04030300,
42
+ kCCiOSVersion_4_3_4 = 0x04030400,
43
+ kCCiOSVersion_4_3_5 = 0x04030500,
44
+ kCCiOSVersion_5_0 = 0x05000000,
45
+ kCCiOSVersion_5_0_1 = 0x05000100,
46
+ kCCiOSVersion_5_1_0 = 0x05010000,
47
+ kCCiOSVersion_6_0_0 = 0x06000000,
48
+
49
+ kCCMacVersion_10_6 = 0x0a060000,
50
+ kCCMacVersion_10_7 = 0x0a070000,
51
+ kCCMacVersion_10_8 = 0x0a080000,
52
+ };
53
+
54
+ /**
55
+ CCConfiguration contains some openGL variables
56
+ @since v0.99.0
57
+ */
58
+ @interface CCConfiguration : NSObject {
59
+
60
+ GLint maxTextureSize_;
61
+ GLint maxModelviewStackDepth_;
62
+ BOOL supportsPVRTC_;
63
+ BOOL supportsNPOT_;
64
+ BOOL supportsBGRA8888_;
65
+ BOOL supportsDiscardFramebuffer_;
66
+ BOOL supportsShareableVAO_;
67
+ unsigned int OSVersion_;
68
+ GLint maxSamplesAllowed_;
69
+ GLint maxTextureUnits_;
70
+ }
71
+
72
+ /** OpenGL Max texture size. */
73
+ @property (nonatomic, readonly) GLint maxTextureSize;
74
+
75
+ /** OpenGL Max Modelview Stack Depth. */
76
+ @property (nonatomic, readonly) GLint maxModelviewStackDepth;
77
+
78
+ /** returns the maximum texture units
79
+ @since v2.0.0
80
+ */
81
+ @property (nonatomic, readonly) GLint maxTextureUnits;
82
+
83
+ /** Whether or not the GPU supports NPOT (Non Power Of Two) textures.
84
+ OpenGL ES 2.0 already supports NPOT (iOS).
85
+
86
+ @since v0.99.2
87
+ */
88
+ @property (nonatomic, readonly) BOOL supportsNPOT;
89
+
90
+ /** Whether or not PVR Texture Compressed is supported */
91
+ @property (nonatomic, readonly) BOOL supportsPVRTC;
92
+
93
+ /** Whether or not BGRA8888 textures are supported.
94
+
95
+ @since v0.99.2
96
+ */
97
+ @property (nonatomic, readonly) BOOL supportsBGRA8888;
98
+
99
+ /** Whether or not glDiscardFramebufferEXT is supported
100
+
101
+ @since v0.99.2
102
+ */
103
+ @property (nonatomic, readonly) BOOL supportsDiscardFramebuffer;
104
+
105
+ /** Whether or not shareable VAOs are supported.
106
+ @since v2.0.0
107
+ */
108
+ @property (nonatomic, readonly) BOOL supportsShareableVAO;
109
+
110
+ /** returns the OS version.
111
+ - On iOS devices it returns the firmware version.
112
+ - On Mac returns the OS version
113
+
114
+ @since v0.99.5
115
+ */
116
+ @property (nonatomic, readonly) unsigned int OSVersion;
117
+
118
+ /** returns a shared instance of the CCConfiguration */
119
+ +(CCConfiguration *) sharedConfiguration;
120
+
121
+ /** returns whether or not an OpenGL is supported */
122
+ - (BOOL) checkForGLExtension:(NSString *)searchName;
123
+
124
+
125
+
126
+ @end