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,423 @@
1
+ /*
2
+ * cocos2d for iPhone: http://www.cocos2d-iphone.org
3
+ *
4
+ * Copyright (c) 2008-2011 Ricardo Quesada
5
+ * Copyright (c) 2011 Zynga Inc.
6
+ *
7
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ * of this software and associated documentation files (the "Software"), to deal
9
+ * in the Software without restriction, including without limitation the rights
10
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ * copies of the Software, and to permit persons to whom the Software is
12
+ * furnished to do so, subject to the following conditions:
13
+ *
14
+ * The above copyright notice and this permission notice shall be included in
15
+ * all copies or substantial portions of the Software.
16
+ *
17
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23
+ * THE SOFTWARE.
24
+ *
25
+ */
26
+
27
+ #import "CCNode.h"
28
+ #import "CCProtocols.h"
29
+
30
+ @class CCSprite;
31
+ @class CCSpriteFrame;
32
+
33
+ #define kCCItemSize 32
34
+
35
+ #pragma mark -
36
+ #pragma mark CCMenuItem
37
+ /** CCMenuItem base class
38
+ *
39
+ * Subclass CCMenuItem (or any subclass) to create your custom CCMenuItem objects.
40
+ */
41
+ @interface CCMenuItem : CCNode
42
+ {
43
+ // used for menu items using a block
44
+ void (^block_)(id sender);
45
+
46
+ BOOL isEnabled_;
47
+ BOOL isSelected_;
48
+ }
49
+
50
+ /** returns whether or not the item is selected
51
+ @since v0.8.2
52
+ */
53
+ @property (nonatomic,readonly) BOOL isSelected;
54
+
55
+ /** Creates a CCMenuItem with a target/selector.
56
+ target/selector will be implemented using blocks.
57
+ "target" won't be retained.
58
+ */
59
+ +(id) itemWithTarget:(id)target selector:(SEL)selector;
60
+
61
+ /** Creates a CCMenuItem with the specified block.
62
+ The block will be "copied".
63
+ */
64
+ +(id) itemWithBlock:(void(^)(id sender))block;
65
+
66
+ /** Initializes a CCMenuItem with a target/selector */
67
+ -(id) initWithTarget:(id)target selector:(SEL)selector;
68
+
69
+ /** Initializes a CCMenuItem with the specified block.
70
+ The block will be "copied".
71
+ */
72
+ -(id) initWithBlock:(void(^)(id sender))block;
73
+
74
+ /** Returns the outside box in points */
75
+ -(CGRect) rect;
76
+
77
+ /** Activate the item */
78
+ -(void) activate;
79
+
80
+ /** The item was selected (not activated), similar to "mouse-over" */
81
+ -(void) selected;
82
+
83
+ /** The item was unselected */
84
+ -(void) unselected;
85
+
86
+ /** Enable or disabled the CCMenuItem */
87
+ -(void) setIsEnabled:(BOOL)enabled;
88
+
89
+ /** Returns whether or not the CCMenuItem is enabled */
90
+ -(BOOL) isEnabled;
91
+
92
+ /** Sets the block that is called when the item is tapped.
93
+ The block will be "copied".
94
+ */
95
+ -(void) setBlock:(void(^)(id sender))block;
96
+
97
+ /** Sets the target and selector that is called when the item is tapped.
98
+ target/selector will be implemented using blocks.
99
+ "target" won't be retained.
100
+ */
101
+ -(void) setTarget:(id)target selector:(SEL)selector;
102
+
103
+ /** cleanup event. It will release the block and call [super cleanup] */
104
+ -(void) cleanup;
105
+
106
+ @end
107
+
108
+ #pragma mark -
109
+ #pragma mark CCMenuItemLabel
110
+
111
+ /** An abstract class for "label" CCMenuItemLabel items
112
+ Any CCNode that supports the CCLabelProtocol protocol can be added.
113
+ Supported nodes:
114
+ - CCLabelBMFont
115
+ - CCLabelAtlas
116
+ - CCLabelTTF
117
+ */
118
+ @interface CCMenuItemLabel : CCMenuItem <CCRGBAProtocol>
119
+ {
120
+ CCNode<CCLabelProtocol, CCRGBAProtocol> *label_;
121
+ ccColor3B colorBackup;
122
+ ccColor3B disabledColor_;
123
+ float originalScale_;
124
+ }
125
+
126
+ /** the color that will be used to disable the item */
127
+ @property (nonatomic,readwrite) ccColor3B disabledColor;
128
+
129
+ /** Label that is rendered. It can be any CCNode that implements the CCLabelProtocol */
130
+ @property (nonatomic,readwrite,assign) CCNode<CCLabelProtocol, CCRGBAProtocol>* label;
131
+
132
+ /** creates a CCMenuItemLabel with a Label. Block will benil */
133
+ +(id) itemWithLabel:(CCNode<CCLabelProtocol,CCRGBAProtocol>*)label;
134
+
135
+ /** creates a CCMenuItemLabel with a Label, target and selector.
136
+ The "target" won't be retained.
137
+ */
138
+ +(id) itemWithLabel:(CCNode<CCLabelProtocol,CCRGBAProtocol>*)label target:(id)target selector:(SEL)selector;
139
+
140
+ /** creates a CCMenuItemLabel with a Label and a block to execute.
141
+ The block will be "copied".
142
+ */
143
+ +(id) itemWithLabel:(CCNode<CCLabelProtocol,CCRGBAProtocol>*)label block:(void(^)(id sender))block;
144
+
145
+ /** initializes a CCMenuItemLabel with a Label, target and selector.
146
+ Internally it will create a block that executes the target/selector.
147
+ The "target" won't be retained.
148
+ */
149
+ -(id) initWithLabel:(CCNode<CCLabelProtocol,CCRGBAProtocol>*)label target:(id)target selector:(SEL)selector;
150
+
151
+ /** initializes a CCMenuItemLabel with a Label and a block to execute.
152
+ The block will be "copied".
153
+ This is the designated initializer.
154
+ */
155
+ -(id) initWithLabel:(CCNode<CCLabelProtocol,CCRGBAProtocol>*)label block:(void(^)(id sender))block;
156
+
157
+ /** sets a new string to the inner label */
158
+ -(void) setString:(NSString*)label;
159
+
160
+ /** Enable or disabled the CCMenuItemFont
161
+ @warning setIsEnabled changes the RGB color of the font
162
+ */
163
+ -(void) setIsEnabled: (BOOL)enabled;
164
+ @end
165
+
166
+ #pragma mark -
167
+ #pragma mark CCMenuItemAtlasFont
168
+
169
+ /** A CCMenuItemAtlasFont
170
+ Helper class that creates a CCMenuItemLabel class with a CCLabelAtlas
171
+ */
172
+ @interface CCMenuItemAtlasFont : CCMenuItemLabel
173
+ {
174
+ }
175
+
176
+ /** creates a menu item from a string and atlas with a target/selector */
177
+ +(id) itemWithString: (NSString*) value charMapFile:(NSString*) charMapFile itemWidth:(int)itemWidth itemHeight:(int)itemHeight startCharMap:(char)startCharMap;
178
+
179
+ /** creates a menu item from a string and atlas. Use it with CCMenuItemToggle.
180
+ The "target" won't be retained.
181
+ */
182
+ +(id) itemWithString: (NSString*) value charMapFile:(NSString*) charMapFile itemWidth:(int)itemWidth itemHeight:(int)itemHeight startCharMap:(char)startCharMap target:(id)target selector:(SEL)selector;
183
+
184
+ /** initializes a menu item from a string and atlas with a target/selector.
185
+ The "target" won't be retained.
186
+ */
187
+ -(id) initWithString: (NSString*) value charMapFile:(NSString*) charMapFile itemWidth:(int)itemWidth itemHeight:(int)itemHeight startCharMap:(char)startCharMap target:(id)target selector:(SEL)selector;
188
+
189
+ /** creates a menu item from a string and atlas. Use it with CCMenuItemToggle.
190
+ The block will be "copied".
191
+ */
192
+ +(id) itemWithString: (NSString*) value charMapFile:(NSString*) charMapFile itemWidth:(int)itemWidth itemHeight:(int)itemHeight startCharMap:(char)startCharMap block:(void(^)(id sender))block;
193
+
194
+ /** initializes a menu item from a string and atlas with a block.
195
+ The block will be "copied".
196
+ */
197
+ -(id) initWithString: (NSString*) value charMapFile:(NSString*) charMapFile itemWidth:(int)itemWidth itemHeight:(int)itemHeight startCharMap:(char)startCharMap block:(void(^)(id sender))block;
198
+
199
+ @end
200
+
201
+ #pragma mark -
202
+ #pragma mark CCMenuItemFont
203
+
204
+ /** A CCMenuItemFont
205
+ Helper class that creates a CCMenuItemLabel class with a Label
206
+ */
207
+ @interface CCMenuItemFont : CCMenuItemLabel
208
+ {
209
+ NSUInteger fontSize_;
210
+ NSString *fontName_;
211
+ }
212
+ /** set default font size */
213
+ +(void) setFontSize: (NSUInteger) s;
214
+
215
+ /** get default font size */
216
+ +(NSUInteger) fontSize;
217
+
218
+ /** set default font name */
219
+ +(void) setFontName: (NSString*) n;
220
+
221
+ /** get default font name */
222
+ +(NSString*) fontName;
223
+
224
+ /** creates a menu item from a string without target/selector. To be used with CCMenuItemToggle */
225
+ +(id) itemWithString: (NSString*) value;
226
+
227
+ /** creates a menu item from a string with a target/selector.
228
+ The "target" won't be retained.
229
+ */
230
+ +(id) itemWithString: (NSString*) value target:(id) r selector:(SEL) s;
231
+
232
+ /** creates a menu item from a string with the specified block.
233
+ The block will be "copied".
234
+ */
235
+ +(id) itemWithString: (NSString*) value block:(void(^)(id sender))block;
236
+
237
+ /** initializes a menu item from a string with a target/selector
238
+ The "target" won't be retained.
239
+ */
240
+ -(id) initWithString: (NSString*) value target:(id) r selector:(SEL) s;
241
+
242
+ /** set font size */
243
+ -(void) setFontSize: (NSUInteger) s;
244
+
245
+ /** get font size */
246
+ -(NSUInteger) fontSize;
247
+
248
+ /** set the font name */
249
+ -(void) setFontName: (NSString*) n;
250
+
251
+ /** get the font name */
252
+ -(NSString*) fontName;
253
+
254
+ /** initializes a menu item from a string with the specified block.
255
+ The block will be "copied".
256
+ */
257
+ -(id) initWithString: (NSString*) value block:(void(^)(id sender))block;
258
+
259
+ @end
260
+
261
+ #pragma mark -
262
+ #pragma mark CCMenuItemSprite
263
+
264
+ /** CCMenuItemSprite accepts CCNode<CCRGBAProtocol> objects as items.
265
+ The images has 3 different states:
266
+ - unselected image
267
+ - selected image
268
+ - disabled image
269
+
270
+ @since v0.8.0
271
+ */
272
+ @interface CCMenuItemSprite : CCMenuItem <CCRGBAProtocol>
273
+ {
274
+ CCNode<CCRGBAProtocol> *normalImage_, *selectedImage_, *disabledImage_;
275
+ }
276
+
277
+ // weak references
278
+
279
+ /** the image used when the item is not selected */
280
+ @property (nonatomic,readwrite,assign) CCNode<CCRGBAProtocol> *normalImage;
281
+ /** the image used when the item is selected */
282
+ @property (nonatomic,readwrite,assign) CCNode<CCRGBAProtocol> *selectedImage;
283
+ /** the image used when the item is disabled */
284
+ @property (nonatomic,readwrite,assign) CCNode<CCRGBAProtocol> *disabledImage;
285
+
286
+ /** creates a menu item with a normal and selected image*/
287
+ +(id) itemWithNormalSprite:(CCNode<CCRGBAProtocol>*)normalSprite selectedSprite:(CCNode<CCRGBAProtocol>*)selectedSprite;
288
+ /** creates a menu item with a normal and selected image with target/selector.
289
+ The "target" won't be retained.
290
+ */
291
+ +(id) itemWithNormalSprite:(CCNode<CCRGBAProtocol>*)normalSprite selectedSprite:(CCNode<CCRGBAProtocol>*)selectedSprite target:(id)target selector:(SEL)selector;
292
+
293
+ /** creates a menu item with a normal,selected and disabled image with target/selector.
294
+ The "target" won't be retained.
295
+ */
296
+ +(id) itemWithNormalSprite:(CCNode<CCRGBAProtocol>*)normalSprite selectedSprite:(CCNode<CCRGBAProtocol>*)selectedSprite disabledSprite:(CCNode<CCRGBAProtocol>*)disabledSprite target:(id)target selector:(SEL)selector;
297
+
298
+ /** creates a menu item with a normal and selected image with a block.
299
+ The block will be "copied".
300
+ */
301
+ +(id) itemWithNormalSprite:(CCNode<CCRGBAProtocol>*)normalSprite selectedSprite:(CCNode<CCRGBAProtocol>*)selectedSprite block:(void(^)(id sender))block;
302
+
303
+ /** creates a menu item with a normal,selected and disabled image with a block.
304
+ The block will be "copied".
305
+ */
306
+ +(id) itemWithNormalSprite:(CCNode<CCRGBAProtocol>*)normalSprite selectedSprite:(CCNode<CCRGBAProtocol>*)selectedSprite disabledSprite:(CCNode<CCRGBAProtocol>*)disabledSprite block:(void(^)(id sender))block;
307
+
308
+ /** initializes a menu item with a normal, selected and disabled image with target/selector.
309
+ The "target" won't be retained.
310
+ */
311
+ -(id) initWithNormalSprite:(CCNode<CCRGBAProtocol>*)normalSprite selectedSprite:(CCNode<CCRGBAProtocol>*)selectedSprite disabledSprite:(CCNode<CCRGBAProtocol>*)disabledSprite target:(id)target selector:(SEL)selector;
312
+
313
+ /** initializes a menu item with a normal, selected and disabled image with a block.
314
+ The block will be "copied".
315
+ */
316
+ -(id) initWithNormalSprite:(CCNode<CCRGBAProtocol>*)normalSprite selectedSprite:(CCNode<CCRGBAProtocol>*)selectedSprite disabledSprite:(CCNode<CCRGBAProtocol>*)disabledSprite block:(void(^)(id sender))block;
317
+
318
+ @end
319
+
320
+ #pragma mark -
321
+ #pragma mark CCMenuItemImage
322
+
323
+ /** CCMenuItemImage accepts images as items.
324
+ The images has 3 different states:
325
+ - unselected image
326
+ - selected image
327
+ - disabled image
328
+
329
+ For best results try that all images are of the same size
330
+ */
331
+ @interface CCMenuItemImage : CCMenuItemSprite
332
+ {
333
+ }
334
+
335
+ /** creates a menu item with a normal and selected image*/
336
+ +(id) itemWithNormalImage: (NSString*)value selectedImage:(NSString*) value2;
337
+
338
+ /** creates a menu item with a normal and selected image with target/selector */
339
+ +(id) itemWithNormalImage: (NSString*)value selectedImage:(NSString*) value2 target:(id) r selector:(SEL) s;
340
+
341
+ /** creates a menu item with a normal,selected and disabled image with target/selector.
342
+ The "target" won't be retained.
343
+ */
344
+ +(id) itemWithNormalImage: (NSString*)value selectedImage:(NSString*) value2 disabledImage:(NSString*) value3 target:(id) r selector:(SEL) s;
345
+
346
+ /** creates a menu item with a normal and selected image with a block.
347
+ The block will be "copied".
348
+ */
349
+ +(id) itemWithNormalImage: (NSString*)value selectedImage:(NSString*) value2 block:(void(^)(id sender))block;
350
+
351
+ /** creates a menu item with a normal,selected and disabled image with a block.
352
+ The block will be "copied".
353
+ */
354
+ +(id) itemWithNormalImage: (NSString*)value selectedImage:(NSString*) value2 disabledImage:(NSString*) value3 block:(void(^)(id sender))block;
355
+
356
+ /** initializes a menu item with a normal, selected and disabled image with target/selector.
357
+ The "target" won't be retained.
358
+ */
359
+ -(id) initWithNormalImage: (NSString*) value selectedImage:(NSString*)value2 disabledImage:(NSString*) value3 target:(id) r selector:(SEL) s;
360
+
361
+ /** initializes a menu item with a normal, selected and disabled image with a block.
362
+ The block will be "copied".
363
+ */
364
+ -(id) initWithNormalImage: (NSString*) value selectedImage:(NSString*)value2 disabledImage:(NSString*) value3 block:(void(^)(id sender))block;
365
+
366
+ /** sets the sprite frame for the normal image */
367
+ - (void) setNormalSpriteFrame:(CCSpriteFrame*)frame;
368
+
369
+ /** sets the sprite frame for the selected image */
370
+ - (void) setSelectedSpriteFrame:(CCSpriteFrame*)frame;
371
+
372
+ /** sets the sprite frame for the disabled image */
373
+ - (void) setDisabledSpriteFrame:(CCSpriteFrame*)frame;
374
+
375
+ @end
376
+
377
+ #pragma mark -
378
+ #pragma mark CCMenuItemToggle
379
+
380
+ /** A CCMenuItemToggle
381
+ A simple container class that "toggles" its inner items
382
+ The inner itmes can be any MenuItem
383
+ */
384
+ @interface CCMenuItemToggle : CCMenuItem <CCRGBAProtocol>
385
+ {
386
+ NSUInteger selectedIndex_;
387
+ NSMutableArray* subItems_;
388
+ GLubyte opacity_;
389
+ ccColor3B color_;
390
+ }
391
+
392
+ /** conforms with CCRGBAProtocol protocol */
393
+ @property (nonatomic,readonly) GLubyte opacity;
394
+ /** conforms with CCRGBAProtocol protocol */
395
+ @property (nonatomic,readonly) ccColor3B color;
396
+
397
+ /** returns the selected item */
398
+ @property (nonatomic,readwrite) NSUInteger selectedIndex;
399
+ /** NSMutableArray that contains the subitems. You can add/remove items in runtime, and you can replace the array with a new one.
400
+ @since v0.7.2
401
+ */
402
+ @property (nonatomic,readwrite,retain) NSMutableArray *subItems;
403
+
404
+ /** creates a menu item from a list of items with a target/selector */
405
+ +(id) itemWithTarget:(id)target selector:(SEL)selector items:(CCMenuItem*) item, ... NS_REQUIRES_NIL_TERMINATION;
406
+
407
+ /** creates a menu item from a list of items and executes the given block when the item is selected.
408
+ The block will be "copied".
409
+ */
410
+ +(id) itemWithItems:(NSArray*)arrayOfItems block:(void(^)(id sender))block;
411
+
412
+ /** initializes a menu item from a list of items with a target selector */
413
+ -(id) initWithTarget:(id)target selector:(SEL)selector items:(CCMenuItem*) item vaList:(va_list) args;
414
+
415
+ /** initializes a menu item from a list of items with a block.
416
+ The block will be "copied".
417
+ */
418
+ -(id) initWithItems:(NSArray*)arrayOfItems block:(void (^)(id))block;
419
+
420
+ /** return the selected item */
421
+ -(CCMenuItem*) selectedItem;
422
+ @end
423
+
@@ -0,0 +1,87 @@
1
+ /*
2
+ * cocos2d for iPhone: http://www.cocos2d-iphone.org
3
+ *
4
+ * Copyright (c) 2011 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
+
27
+ #import <Foundation/Foundation.h>
28
+ #import "CCTexture2D.h"
29
+ #import "ccTypes.h"
30
+ #import "CCNode.h"
31
+
32
+ /** MotionStreak.
33
+ Creates a trailing path.
34
+ */
35
+ @interface CCMotionStreak : CCNode <CCTextureProtocol, CCRGBAProtocol>
36
+ {
37
+ CCTexture2D *texture_;
38
+ CGPoint positionR_;
39
+ ccColor3B color_;
40
+ ccBlendFunc blendFunc_;
41
+ float stroke_;
42
+ float fadeDelta_;
43
+ float minSeg_;
44
+
45
+ NSUInteger maxPoints_;
46
+ NSUInteger nuPoints_;
47
+ NSUInteger previousNuPoints_;
48
+
49
+ /** Pointers */
50
+ CGPoint *pointVertexes_;
51
+ float *pointState_;
52
+
53
+ // Opengl
54
+ ccVertex2F *vertices_;
55
+ unsigned char *colorPointer_;
56
+ ccTex2F *texCoords_;
57
+
58
+ BOOL fastMode_;
59
+
60
+ BOOL startingPositionInitialized_;
61
+ }
62
+ /** blending function */
63
+ @property (nonatomic, readwrite, assign) ccBlendFunc blendFunc;
64
+
65
+ /** When fast mode is enbled, new points are added faster but with lower precision */
66
+ @property (nonatomic, readwrite, assign, getter = isFastMode) BOOL fastMode;
67
+
68
+ /** texture used for the motion streak */
69
+ @property (nonatomic, retain) CCTexture2D *texture;
70
+
71
+ /** creates and initializes a motion streak with fade in seconds, minimum segments, stroke's width, color, texture filename */
72
+ + (id) streakWithFade:(float)fade minSeg:(float)minSeg width:(float)stroke color:(ccColor3B)color textureFilename:(NSString*)path;
73
+ /** creates and initializes a motion streak with fade in seconds, minimum segments, stroke's width, color, texture */
74
+ + (id) streakWithFade:(float)fade minSeg:(float)minSeg width:(float)stroke color:(ccColor3B)color texture:(CCTexture2D*)texture;
75
+
76
+ /** initializes a motion streak with fade in seconds, minimum segments, stroke's width, color and texture filename */
77
+ - (id) initWithFade:(float)fade minSeg:(float)minSeg width:(float)stroke color:(ccColor3B)color textureFilename:(NSString*)path;
78
+ /** initializes a motion streak with fade in seconds, minimum segments, stroke's width, color and texture */
79
+ - (id) initWithFade:(float)fade minSeg:(float)minSeg width:(float)stroke color:(ccColor3B)color texture:(CCTexture2D*)texture;
80
+
81
+ /** color used for the tint */
82
+ - (void) tintWithColor:(ccColor3B)colors;
83
+
84
+ /** Remove all living segments of the ribbon */
85
+ - (void) reset;
86
+
87
+ @end