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,132 @@
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 "CCTexture2D.h"
29
+ #import "CCSprite.h"
30
+ #import "Platforms/CCNS.h"
31
+
32
+
33
+ /** CCLabel is a subclass of CCTextureNode that knows how to render text labels
34
+ *
35
+ * All features from CCTextureNode are valid in CCLabel
36
+ *
37
+ * CCLabel objects are slow. Consider using CCLabelAtlas or CCLabelBMFont instead.
38
+ */
39
+
40
+ @interface CCLabelTTF : CCSprite <CCLabelProtocol>
41
+ {
42
+ CGSize dimensions_;
43
+ CCTextAlignment hAlignment_;
44
+ CCVerticalTextAlignment vAlignment_;
45
+ NSString * fontName_;
46
+ CGFloat fontSize_;
47
+ CCLineBreakMode lineBreakMode_;
48
+ NSString *string_;
49
+ }
50
+
51
+ /** Font name used in the label */
52
+ @property (nonatomic,retain) NSString* fontName;
53
+ /** Font size of the label */
54
+ @property (nonatomic,assign) float fontSize;
55
+ /** Dimensions of the label in Points */
56
+ @property (nonatomic,assign) CGSize dimensions;
57
+ /** The alignment of the label */
58
+ @property (nonatomic,assign) CCTextAlignment horizontalAlignment;
59
+ /** The vertical alignment of the label */
60
+ @property (nonatomic,assign) CCVerticalTextAlignment verticalAlignment;
61
+
62
+
63
+ /** creates a CCLabelTTF with a font name and font size in points*/
64
+ + (id) labelWithString:(NSString*)string fontName:(NSString*)name fontSize:(CGFloat)size;
65
+
66
+ /** creates a CCLabelTTF from a fontname, horizontal alignment, dimension in points, and font size in points.
67
+ Supported lineBreakModes:
68
+ - iOS: all UILineBreakMode supported modes
69
+ - Mac: Only NSLineBreakByWordWrapping is supported.
70
+ @since v1.0
71
+ */
72
+ + (id) labelWithString:(NSString*)string dimensions:(CGSize)dimensions hAlignment:(CCTextAlignment)alignment fontName:(NSString*)name fontSize:(CGFloat)size;
73
+
74
+ /** creates a CCLabelTTF from a fontname, horizontal alignment, dimension in points, line break mode, and font size in points.
75
+ Supported lineBreakModes:
76
+ - iOS: all UILineBreakMode supported modes
77
+ - Mac: Only NSLineBreakByWordWrapping is supported.
78
+ @since v1.0
79
+ */
80
+ + (id) labelWithString:(NSString*)string dimensions:(CGSize)dimensions hAlignment:(CCTextAlignment)alignment lineBreakMode:(CCLineBreakMode)lineBreakMode fontName:(NSString*)name fontSize:(CGFloat)size;
81
+
82
+ /** creates a CCLabelTTF from a fontname, horizontal aligment, vertical alignment, dimension in points, line break mode, and font size in points.
83
+ Supported lineBreakModes:
84
+ - iOS: all UILineBreakMode supported modes
85
+ - Mac: Only NSLineBreakByWordWrapping is supported.
86
+ @since v1.0
87
+ */
88
+ + (id) labelWithString:(NSString*)string dimensions:(CGSize)dimensions hAlignment:(CCTextAlignment)alignment vAlignment:(CCVerticalTextAlignment)vertAlignment lineBreakMode:(CCLineBreakMode)lineBreakMode fontName:(NSString*)name fontSize:(CGFloat)size;
89
+
90
+ /** creates a CCLabel from a fontname, alignment, dimension in points and font size in points*/
91
+ + (id) labelWithString:(NSString*)string dimensions:(CGSize)dimensions hAlignment:(CCTextAlignment)alignment vAlignment:(CCVerticalTextAlignment)vertAlignment fontName:(NSString*)name fontSize:(CGFloat)size;
92
+
93
+
94
+ /** initializes the CCLabelTTF with a font name and font size in points */
95
+ - (id) initWithString:(NSString*)string fontName:(NSString*)name fontSize:(CGFloat)size;
96
+
97
+ /** initializes the CCLabelTTF with a font name, horizonal alignment, dimension in points, and font size in points.
98
+ Default verticalAlignment: kCCVerticalTextAlignmentTop
99
+ Default lineBreakMode: CCLineBreakModeWordWrap
100
+ @since v1.0
101
+ */
102
+ - (id) initWithString:(NSString*)string dimensions:(CGSize)dimensions hAlignment:(CCTextAlignment)alignment fontName:(NSString*)name fontSize:(CGFloat)size;
103
+
104
+ /** initializes the CCLabelTTF with a font name, horizontal alignment, dimension in points, line break mode and font size in points.
105
+ Default verticalAlignment: kCCVerticalTextAlignmentTop
106
+
107
+ Supported lineBreakModes:
108
+ - iOS: all UILineBreakMode supported modes
109
+ - Mac: Only NSLineBreakByWordWrapping is supported.
110
+ @since v1.0
111
+ */
112
+ - (id) initWithString:(NSString*)str dimensions:(CGSize)dimensions hAlignment:(CCTextAlignment)alignment lineBreakMode:(CCLineBreakMode)lineBreakMode fontName:(NSString*)name fontSize:(CGFloat)size;
113
+
114
+ /** initializes the CCLabelTTF with a font name, horiozntal alignment, vertical alignment, dimension in points and font size in points.
115
+ Default lineBreakMode: CCLineBreakModeWordWrap
116
+ */
117
+ - (id) initWithString:(NSString*)string dimensions:(CGSize)dimensions hAlignment:(CCTextAlignment)alignment vAlignment:(CCVerticalTextAlignment)vertAlignment fontName:(NSString*)name fontSize:(CGFloat)size;
118
+
119
+ /** initializes the CCLabelTTF with a font name, horizontal alignment, vertical aligment, dimension in points, line break mode and font size in points.
120
+ Supported lineBreakModes:
121
+ - iOS: all UILineBreakMode supported modes
122
+ - Mac: Only NSLineBreakByWordWrapping is supported.
123
+ @since v2.0
124
+ */
125
+ - (id) initWithString:(NSString*)str dimensions:(CGSize)dimensions hAlignment:(CCTextAlignment)alignment vAlignment:(CCVerticalTextAlignment)vAlignment lineBreakMode:(CCLineBreakMode)lineBreakMode fontName:(NSString*)name fontSize:(CGFloat)size;
126
+
127
+ /** changes the string to render
128
+ * @warning Changing the string is as expensive as creating a new CCLabelTTF. To obtain better performance use CCLabelAtlas or CCLabelBMFont.
129
+ */
130
+ - (void) setString:(NSString*)str;
131
+
132
+ @end
@@ -0,0 +1,280 @@
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
+
29
+ #import "ccMacros.h"
30
+
31
+ #ifdef __CC_PLATFORM_IOS
32
+ #import <UIKit/UIKit.h> // Needed for UIAccelerometerDelegate
33
+ #import "Platforms/iOS/CCTouchDelegateProtocol.h" // Touches only supported on iOS
34
+ #elif defined(__CC_PLATFORM_MAC)
35
+ #import "Platforms/Mac/CCEventDispatcher.h"
36
+ #endif
37
+
38
+ #import "CCProtocols.h"
39
+ #import "CCNode.h"
40
+
41
+ #pragma mark -
42
+ #pragma mark CCLayer
43
+
44
+ /** CCLayer is a subclass of CCNode that implements the CCTouchEventsDelegate protocol.
45
+
46
+ All features from CCNode are valid, plus the following new features:
47
+ - It can receive iPhone Touches
48
+ - It can receive Accelerometer input
49
+ */
50
+ #ifdef __CC_PLATFORM_IOS
51
+ @interface CCLayer : CCNode <UIAccelerometerDelegate, CCStandardTouchDelegate, CCTargetedTouchDelegate>
52
+ {
53
+ BOOL isTouchEnabled_;
54
+ BOOL isAccelerometerEnabled_;
55
+ }
56
+ /** If isTouchEnabled, this method is called onEnter. Override it to change the
57
+ way CCLayer receives touch events.
58
+ ( Default: [touchDispatcher addStandardDelegate:self priority:0] )
59
+ Example:
60
+ -(void) registerWithTouchDispatcher
61
+ {
62
+ [touchDispatcher addTargetedDelegate:self priority:INT_MIN+1 swallowsTouches:YES];
63
+ }
64
+
65
+ Valid only on iOS. Not valid on Mac.
66
+
67
+ @since v0.8.0
68
+ */
69
+ -(void) registerWithTouchDispatcher;
70
+
71
+ /** whether or not it will receive Touch events.
72
+ You can enable / disable touch events with this property.
73
+ Only the touches of this node will be affected. This "method" is not propagated to its children.
74
+
75
+ Valid on iOS and Mac OS X v10.6 and later.
76
+
77
+ @since v0.8.1
78
+ */
79
+ @property(nonatomic,assign) BOOL isTouchEnabled;
80
+ /** whether or not it will receive Accelerometer events
81
+ You can enable / disable accelerometer events with this property.
82
+
83
+ Valid only on iOS. Not valid on Mac.
84
+
85
+ @since v0.8.1
86
+ */
87
+ @property(nonatomic,assign) BOOL isAccelerometerEnabled;
88
+
89
+ #elif defined(__CC_PLATFORM_MAC)
90
+
91
+
92
+ @interface CCLayer : CCNode <CCKeyboardEventDelegate, CCMouseEventDelegate, CCTouchEventDelegate>
93
+ {
94
+ BOOL isMouseEnabled_;
95
+ BOOL isKeyboardEnabled_;
96
+ BOOL isTouchEnabled_;
97
+ }
98
+
99
+ /** whether or not it will receive mouse events.
100
+
101
+ Valind only Mac. Not valid on iOS
102
+ */
103
+ @property (nonatomic, readwrite) BOOL isMouseEnabled;
104
+
105
+ /** whether or not it will receive keyboard events.
106
+
107
+ Valind only Mac. Not valid on iOS
108
+ */
109
+ @property (nonatomic, readwrite) BOOL isKeyboardEnabled;
110
+
111
+ /** whether or not it will receive touch events.
112
+
113
+ Valid on iOS and Mac OS X v10.6 and later.
114
+ */
115
+ @property (nonatomic, readwrite) BOOL isTouchEnabled;
116
+
117
+ /** priority of the mouse event delegate.
118
+ Default 0.
119
+ Override this method to set another priority.
120
+
121
+ Valind only Mac. Not valid on iOS
122
+ */
123
+ -(NSInteger) mouseDelegatePriority;
124
+
125
+ /** priority of the keyboard event delegate.
126
+ Default 0.
127
+ Override this method to set another priority.
128
+
129
+ Valind only Mac. Not valid on iOS
130
+ */
131
+ -(NSInteger) keyboardDelegatePriority;
132
+
133
+ /** priority of the touch event delegate.
134
+ Default 0.
135
+ Override this method to set another priority.
136
+
137
+ Valind only Mac. Not valid on iOS
138
+ */
139
+ -(NSInteger) touchDelegatePriority;
140
+
141
+ #endif // mac
142
+
143
+
144
+ @end
145
+
146
+ #pragma mark -
147
+ #pragma mark CCLayerColor
148
+
149
+ /** CCLayerColor is a subclass of CCLayer that implements the CCRGBAProtocol protocol.
150
+
151
+ All features from CCLayer are valid, plus the following new features:
152
+ - opacity
153
+ - RGB colors
154
+ */
155
+ @interface CCLayerColor : CCLayer <CCRGBAProtocol, CCBlendProtocol>
156
+ {
157
+ GLubyte opacity_;
158
+ ccColor3B color_;
159
+ ccVertex2F squareVertices_[4];
160
+ ccColor4F squareColors_[4];
161
+
162
+ ccBlendFunc blendFunc_;
163
+ }
164
+
165
+ /** creates a CCLayer with color, width and height in Points*/
166
+ + (id) layerWithColor: (ccColor4B)color width:(GLfloat)w height:(GLfloat)h;
167
+ /** creates a CCLayer with color. Width and height are the window size. */
168
+ + (id) layerWithColor: (ccColor4B)color;
169
+
170
+ /** initializes a CCLayer with color, width and height in Points.
171
+ This is the designated initializer.
172
+ */
173
+ - (id) initWithColor:(ccColor4B)color width:(GLfloat)w height:(GLfloat)h;
174
+ /** initializes a CCLayer with color. Width and height are the window size. */
175
+ - (id) initWithColor:(ccColor4B)color;
176
+
177
+ /** change width in Points */
178
+ -(void) changeWidth: (GLfloat)w;
179
+ /** change height in Points */
180
+ -(void) changeHeight: (GLfloat)h;
181
+ /** change width and height in Points
182
+ @since v0.8
183
+ */
184
+ -(void) changeWidth:(GLfloat)w height:(GLfloat)h;
185
+
186
+ /** Opacity: conforms to CCRGBAProtocol protocol */
187
+ @property (nonatomic,readonly) GLubyte opacity;
188
+ /** Opacity: conforms to CCRGBAProtocol protocol */
189
+ @property (nonatomic,readonly) ccColor3B color;
190
+ /** BlendFunction. Conforms to CCBlendProtocol protocol */
191
+ @property (nonatomic,readwrite) ccBlendFunc blendFunc;
192
+ @end
193
+
194
+ #pragma mark -
195
+ #pragma mark CCLayerGradient
196
+
197
+ /** CCLayerGradient is a subclass of CCLayerColor that draws gradients across
198
+ the background.
199
+
200
+ All features from CCLayerColor are valid, plus the following new features:
201
+ - direction
202
+ - final color
203
+ - interpolation mode
204
+
205
+ Color is interpolated between the startColor and endColor along the given
206
+ vector (starting at the origin, ending at the terminus). If no vector is
207
+ supplied, it defaults to (0, -1) -- a fade from top to bottom.
208
+
209
+ If 'compressedInterpolation' is disabled, you will not see either the start or end color for
210
+ non-cardinal vectors; a smooth gradient implying both end points will be still
211
+ be drawn, however.
212
+
213
+ If ' compressedInterpolation' is enabled (default mode) you will see both the start and end colors of the gradient.
214
+
215
+ @since v0.99.5
216
+ */
217
+ @interface CCLayerGradient : CCLayerColor
218
+ {
219
+ ccColor3B endColor_;
220
+ GLubyte startOpacity_;
221
+ GLubyte endOpacity_;
222
+ CGPoint vector_;
223
+ BOOL compressedInterpolation_;
224
+ }
225
+
226
+ /** Creates a full-screen CCLayer with a gradient between start and end. */
227
+ + (id) layerWithColor: (ccColor4B) start fadingTo: (ccColor4B) end;
228
+ /** Creates a full-screen CCLayer with a gradient between start and end in the direction of v. */
229
+ + (id) layerWithColor: (ccColor4B) start fadingTo: (ccColor4B) end alongVector: (CGPoint) v;
230
+
231
+ /** Initializes the CCLayer with a gradient between start and end. */
232
+ - (id) initWithColor: (ccColor4B) start fadingTo: (ccColor4B) end;
233
+ /** Initializes the CCLayer with a gradient between start and end in the direction of v. */
234
+ - (id) initWithColor: (ccColor4B) start fadingTo: (ccColor4B) end alongVector: (CGPoint) v;
235
+
236
+ /** The starting color. */
237
+ @property (nonatomic, readwrite) ccColor3B startColor;
238
+ /** The ending color. */
239
+ @property (nonatomic, readwrite) ccColor3B endColor;
240
+ /** The starting opacity. */
241
+ @property (nonatomic, readwrite) GLubyte startOpacity;
242
+ /** The ending color. */
243
+ @property (nonatomic, readwrite) GLubyte endOpacity;
244
+ /** The vector along which to fade color. */
245
+ @property (nonatomic, readwrite) CGPoint vector;
246
+ /** Whether or not the interpolation will be compressed in order to display all the colors of the gradient both in canonical and non canonical vectors
247
+ Default: YES
248
+ */
249
+ @property (nonatomic, readwrite) BOOL compressedInterpolation;
250
+
251
+ @end
252
+
253
+ #pragma mark -
254
+ #pragma mark CCLayerMultiplex
255
+
256
+ /** CCLayerMultiplex is a CCLayer with the ability to multiplex its children.
257
+ Features:
258
+ - It supports one or more children
259
+ - Only one children will be active a time
260
+ */
261
+ @interface CCLayerMultiplex : CCLayer
262
+ {
263
+ unsigned int enabledLayer_;
264
+ NSMutableArray *layers_;
265
+ }
266
+
267
+ /** creates a CCMultiplexLayer with one or more layers using a variable argument list. */
268
+ +(id) layerWithLayers: (CCLayer*) layer, ... NS_REQUIRES_NIL_TERMINATION;
269
+ /** initializes a MultiplexLayer with one or more layers using a variable argument list. */
270
+ -(id) initWithLayers: (CCLayer*) layer vaList:(va_list) params;
271
+ /** switches to a certain layer indexed by n.
272
+ The current (old) layer will be removed from its parent with 'cleanup:YES'.
273
+ */
274
+ -(void) switchTo: (unsigned int) n;
275
+ /** release the current layer and switches to another layer indexed by n.
276
+ The current (old) layer will be removed from its parent with 'cleanup:YES'.
277
+ */
278
+ -(void) switchToAndReleaseMe: (unsigned int) n;
279
+ @end
280
+
@@ -0,0 +1,100 @@
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 "CCMenuItem.h"
29
+ #import "CCLayer.h"
30
+
31
+ typedef enum {
32
+ kCCMenuStateWaiting,
33
+ kCCMenuStateTrackingTouch
34
+ } tCCMenuState;
35
+
36
+ enum {
37
+ //* priority used by the menu for the event handler
38
+ kCCMenuHandlerPriority = -128,
39
+ };
40
+
41
+ /** A CCMenu
42
+ *
43
+ * Features and Limitation:
44
+ * - You can add MenuItem objects in runtime using addChild:
45
+ * - But the only accecpted children are MenuItem objects
46
+ */
47
+ @interface CCMenu : CCLayer <CCRGBAProtocol>
48
+ {
49
+ tCCMenuState state_;
50
+ CCMenuItem *selectedItem_;
51
+ GLubyte opacity_;
52
+ ccColor3B color_;
53
+ BOOL enabled_;
54
+ }
55
+
56
+ /** conforms to CCRGBAProtocol protocol */
57
+ @property (nonatomic,readonly) GLubyte opacity;
58
+ /** conforms to CCRGBAProtocol protocol */
59
+ @property (nonatomic,readonly) ccColor3B color;
60
+ /** whether or not the menu will receive events */
61
+ @property (nonatomic, readwrite) BOOL enabled;
62
+
63
+ /** creates a CCMenu with its items */
64
+ + (id) menuWithItems: (CCMenuItem*) item, ... NS_REQUIRES_NIL_TERMINATION;
65
+
66
+ /** creates a CCMenu with a NSArray of CCMenuItem objects */
67
+ + (id) menuWithArray:(NSArray*)arrayOfItems;
68
+
69
+ /** initializes a CCMenu with its items */
70
+ - (id) initWithItems: (CCMenuItem*) item vaList: (va_list) args;
71
+
72
+ /** initializes a CCMenu with a NSArray of CCMenuItem objects */
73
+ - (id) initWithArray:(NSArray*)arrayOfItems;
74
+
75
+ /** align items vertically */
76
+ -(void) alignItemsVertically;
77
+ /** align items vertically with padding
78
+ @since v0.7.2
79
+ */
80
+ -(void) alignItemsVerticallyWithPadding:(float) padding;
81
+
82
+ /** align items horizontally */
83
+ -(void) alignItemsHorizontally;
84
+ /** align items horizontally with padding
85
+ @since v0.7.2
86
+ */
87
+ -(void) alignItemsHorizontallyWithPadding: (float) padding;
88
+
89
+ /** align items in rows of columns */
90
+ -(void) alignItemsInColumns: (NSNumber *) columns, ... NS_REQUIRES_NIL_TERMINATION;
91
+ -(void) alignItemsInColumns: (NSNumber *) columns vaList: (va_list) args;
92
+
93
+ /** align items in columns of rows */
94
+ -(void) alignItemsInRows: (NSNumber *) rows, ... NS_REQUIRES_NIL_TERMINATION;
95
+ -(void) alignItemsInRows: (NSNumber *) rows vaList: (va_list) args;
96
+
97
+ /** set event handler priority. By default it is: kCCMenuTouchPriority */
98
+ -(void) setHandlerPriority:(NSInteger)newPriority;
99
+
100
+ @end