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,83 @@
1
+ /*
2
+ * cocos2d for iPhone: http://www.cocos2d-iphone.org
3
+ *
4
+ * Copyright (c) 2008-2010 Ricardo Quesada
5
+ * Copyright (c) 2011 Zynga Inc.
6
+ *
7
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ * of this software and associated documentation files (the "Software"), to deal
9
+ * in the Software without restriction, including without limitation the rights
10
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ * copies of the Software, and to permit persons to whom the Software is
12
+ * furnished to do so, subject to the following conditions:
13
+ *
14
+ * The above copyright notice and this permission notice shall be included in
15
+ * all copies or substantial portions of the Software.
16
+ *
17
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23
+ * THE SOFTWARE.
24
+ *
25
+ */
26
+
27
+ #import "CCTextureAtlas.h"
28
+ #import "CCAtlasNode.h"
29
+ #import "Support/TGAlib.h"
30
+
31
+ /** CCTileMapAtlas is a subclass of CCAtlasNode.
32
+
33
+ It knows how to render a map based of tiles.
34
+ The tiles must be in a .PNG format while the map must be a .TGA file.
35
+
36
+ For more information regarding the format, please see this post:
37
+ http://www.cocos2d-iphone.org/archives/27
38
+
39
+ All features from CCAtlasNode are valid in CCTileMapAtlas
40
+
41
+ IMPORTANT:
42
+ This class is deprecated. It is maintained for compatibility reasons only.
43
+ You SHOULD not use this class.
44
+ Instead, use the newer TMX file format: CCTMXTiledMap
45
+ */
46
+ @interface CCTileMapAtlas : CCAtlasNode
47
+ {
48
+
49
+ /// info about the map file
50
+ tImageTGA *tgaInfo;
51
+
52
+ /// x,y to altas dicctionary
53
+ NSMutableDictionary *posToAtlasIndex;
54
+
55
+ /// numbers of tiles to render
56
+ int itemsToRender;
57
+ }
58
+
59
+ /** TileMap info */
60
+ @property (nonatomic,readonly) tImageTGA *tgaInfo;
61
+
62
+ /** creates a CCTileMap with a tile file (atlas) with a map file and the width and height of each tile in points.
63
+ The tile file will be loaded using the TextureMgr.
64
+ */
65
+ +(id) tileMapAtlasWithTileFile:(NSString*)tile mapFile:(NSString*)map tileWidth:(int)w tileHeight:(int)h;
66
+
67
+ /** initializes a CCTileMap with a tile file (atlas) with a map file and the width and height of each tile in points.
68
+ The file will be loaded using the TextureMgr.
69
+ */
70
+ -(id) initWithTileFile:(NSString*)tile mapFile:(NSString*)map tileWidth:(int)w tileHeight:(int)h;
71
+
72
+ /** returns a tile from position x,y.
73
+ For the moment only channel R is used
74
+ */
75
+ -(ccColor3B) tileAt: (ccGridSize) position;
76
+
77
+ /** sets a tile at position x,y.
78
+ For the moment only channel R is used
79
+ */
80
+ -(void) setTile:(ccColor3B)tile at:(ccGridSize)position;
81
+ /** dealloc the map from memory */
82
+ -(void) releaseMap;
83
+ @end
@@ -0,0 +1,75 @@
1
+ /*
2
+ * cocos2d for iPhone: http://www.cocos2d-iphone.org
3
+ *
4
+ * Copyright (c) 2009 Valentin Milea
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
+ // Only compile this code on iOS. These files should NOT be included on your Mac project.
27
+ // But in case they are included, it won't be compiled.
28
+ #import "../../ccMacros.h"
29
+ #ifdef __CC_PLATFORM_IOS
30
+
31
+ #import <UIKit/UIKit.h>
32
+
33
+ /**
34
+ CCTargetedTouchDelegate.
35
+
36
+ Using this type of delegate results in two benefits:
37
+ 1. You don't need to deal with NSSets, the dispatcher does the job of splitting
38
+ them. You get exactly one UITouch per call.
39
+ 2. You can *claim* a UITouch by returning YES in ccTouchBegan. Updates of claimed
40
+ touches are sent only to the delegate(s) that claimed them. So if you get a move/
41
+ ended/cancelled update you're sure it is your touch. This frees you from doing a
42
+ lot of checks when doing multi-touch.
43
+
44
+ (The name TargetedTouchDelegate relates to updates "targeting" their specific
45
+ handler, without bothering the other handlers.)
46
+ @since v0.8
47
+ */
48
+ @protocol CCTargetedTouchDelegate <NSObject>
49
+
50
+ /** Return YES to claim the touch.
51
+ @since v0.8
52
+ */
53
+ - (BOOL)ccTouchBegan:(UITouch *)touch withEvent:(UIEvent *)event;
54
+ @optional
55
+ // touch updates:
56
+ - (void)ccTouchMoved:(UITouch *)touch withEvent:(UIEvent *)event;
57
+ - (void)ccTouchEnded:(UITouch *)touch withEvent:(UIEvent *)event;
58
+ - (void)ccTouchCancelled:(UITouch *)touch withEvent:(UIEvent *)event;
59
+ @end
60
+
61
+ /**
62
+ CCStandardTouchDelegate.
63
+
64
+ This type of delegate is the same one used by CocoaTouch. You will receive all the events (Began,Moved,Ended,Cancelled).
65
+ @since v0.8
66
+ */
67
+ @protocol CCStandardTouchDelegate <NSObject>
68
+ @optional
69
+ - (void)ccTouchesBegan:(NSSet *)touches withEvent:(UIEvent *)event;
70
+ - (void)ccTouchesMoved:(NSSet *)touches withEvent:(UIEvent *)event;
71
+ - (void)ccTouchesEnded:(NSSet *)touches withEvent:(UIEvent *)event;
72
+ - (void)ccTouchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event;
73
+ @end
74
+
75
+ #endif // __CC_PLATFORM_IOS
@@ -0,0 +1,120 @@
1
+ /*
2
+ * cocos2d for iPhone: http://www.cocos2d-iphone.org
3
+ *
4
+ * Copyright (c) 2009 Valentin Milea
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
+ // Only compile this code on iOS. These files should NOT be included on your Mac project.
27
+ // But in case they are included, it won't be compiled.
28
+ #import "../../ccMacros.h"
29
+ #ifdef __CC_PLATFORM_IOS
30
+
31
+ #import "CCTouchDelegateProtocol.h"
32
+ #import "CCGLView.h"
33
+
34
+
35
+ typedef enum
36
+ {
37
+ kCCTouchSelectorBeganBit = 1 << 0,
38
+ kCCTouchSelectorMovedBit = 1 << 1,
39
+ kCCTouchSelectorEndedBit = 1 << 2,
40
+ kCCTouchSelectorCancelledBit = 1 << 3,
41
+ kCCTouchSelectorAllBits = ( kCCTouchSelectorBeganBit | kCCTouchSelectorMovedBit | kCCTouchSelectorEndedBit | kCCTouchSelectorCancelledBit),
42
+ } ccTouchSelectorFlag;
43
+
44
+
45
+ enum {
46
+ kCCTouchBegan,
47
+ kCCTouchMoved,
48
+ kCCTouchEnded,
49
+ kCCTouchCancelled,
50
+
51
+ kCCTouchMax,
52
+ };
53
+
54
+ struct ccTouchHandlerHelperData {
55
+ SEL touchesSel;
56
+ SEL touchSel;
57
+ ccTouchSelectorFlag type;
58
+ };
59
+
60
+ /** CCTouchDispatcher.
61
+ Object that handles all the touch events.
62
+ The dispatcher dispatches events to the registered TouchHandlers.
63
+ There are 2 different type of touch handlers:
64
+ - Standard Touch Handlers
65
+ - Targeted Touch Handlers
66
+
67
+ The Standard Touch Handlers work like the CocoaTouch touch handler: a set of touches is passed to the delegate.
68
+ On the other hand, the Targeted Touch Handlers only receive 1 touch at the time, and they can "swallow" touches (avoid the propagation of the event).
69
+
70
+ Firstly, the dispatcher sends the received touches to the targeted touches.
71
+ These touches can be swallowed by the Targeted Touch Handlers. If there are still remaining touches, then the remaining touches will be sent
72
+ to the Standard Touch Handlers.
73
+
74
+ @since v0.8.0
75
+ */
76
+ @interface CCTouchDispatcher : NSObject <CCTouchDelegate>
77
+ {
78
+ NSMutableArray *targetedHandlers;
79
+ NSMutableArray *standardHandlers;
80
+
81
+ BOOL locked;
82
+ BOOL toAdd;
83
+ BOOL toRemove;
84
+ NSMutableArray *handlersToAdd;
85
+ NSMutableArray *handlersToRemove;
86
+ BOOL toQuit;
87
+
88
+ BOOL dispatchEvents;
89
+
90
+ // 4, 1 for each type of event
91
+ struct ccTouchHandlerHelperData handlerHelperData[kCCTouchMax];
92
+ }
93
+
94
+ /** Whether or not the events are going to be dispatched. Default: YES */
95
+ @property (nonatomic,readwrite, assign) BOOL dispatchEvents;
96
+
97
+ /** Adds a standard touch delegate to the dispatcher's list.
98
+ See StandardTouchDelegate description.
99
+ IMPORTANT: The delegate will be retained.
100
+ */
101
+ -(void) addStandardDelegate:(id<CCStandardTouchDelegate>) delegate priority:(int)priority;
102
+ /** Adds a targeted touch delegate to the dispatcher's list.
103
+ See TargetedTouchDelegate description.
104
+ IMPORTANT: The delegate will be retained.
105
+ */
106
+ -(void) addTargetedDelegate:(id<CCTargetedTouchDelegate>) delegate priority:(int)priority swallowsTouches:(BOOL)swallowsTouches;
107
+ /** Removes a touch delegate.
108
+ The delegate will be released
109
+ */
110
+ -(void) removeDelegate:(id) delegate;
111
+ /** Removes all touch delegates, releasing all the delegates */
112
+ -(void) removeAllDelegates;
113
+ /** Changes the priority of a previously added delegate. The lower the number,
114
+ the higher the priority */
115
+ -(void) setPriority:(int) priority forDelegate:(id) delegate;
116
+
117
+ NSComparisonResult sortByPriority(id first, id second, void *context);
118
+ @end
119
+
120
+ #endif // __CC_PLATFORM_IOS
@@ -0,0 +1,93 @@
1
+ /*
2
+ * cocos2d for iPhone: http://www.cocos2d-iphone.org
3
+ *
4
+ * Copyright (c) 2009 Valentin Milea
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
+ // Only compile this code on iOS. These files should NOT be included on your Mac project.
27
+ // But in case they are included, it won't be compiled.
28
+ #import "../../ccMacros.h"
29
+ #ifdef __CC_PLATFORM_IOS
30
+
31
+ /*
32
+ * This file contains the delegates of the touches
33
+ * There are 2 possible delegates:
34
+ * - CCStandardTouchHandler: propagates all the events at once
35
+ * - CCTargetedTouchHandler: propagates 1 event at the time
36
+ */
37
+
38
+ #import "CCTouchDelegateProtocol.h"
39
+ #import "CCTouchDispatcher.h"
40
+
41
+ /**
42
+ CCTouchHandler
43
+ Object than contains the delegate and priority of the event handler.
44
+ */
45
+ @interface CCTouchHandler : NSObject {
46
+ id delegate;
47
+ int priority;
48
+ ccTouchSelectorFlag enabledSelectors_;
49
+ }
50
+
51
+ /** delegate */
52
+ @property(nonatomic, readwrite, retain) id delegate;
53
+ /** priority */
54
+ @property(nonatomic, readwrite) int priority; // default 0
55
+ /** enabled selectors */
56
+ @property(nonatomic,readwrite) ccTouchSelectorFlag enabledSelectors;
57
+
58
+ /** allocates a TouchHandler with a delegate and a priority */
59
+ + (id)handlerWithDelegate:(id)aDelegate priority:(int)priority;
60
+ /** initializes a TouchHandler with a delegate and a priority */
61
+ - (id)initWithDelegate:(id)aDelegate priority:(int)priority;
62
+ @end
63
+
64
+ /** CCStandardTouchHandler
65
+ It forwardes each event to the delegate.
66
+ */
67
+ @interface CCStandardTouchHandler : CCTouchHandler
68
+ {
69
+ }
70
+ @end
71
+
72
+ /**
73
+ CCTargetedTouchHandler
74
+ Object than contains the claimed touches and if it swallos touches.
75
+ Used internally by TouchDispatcher
76
+ */
77
+ @interface CCTargetedTouchHandler : CCTouchHandler {
78
+ BOOL swallowsTouches;
79
+ NSMutableSet *claimedTouches;
80
+ }
81
+ /** whether or not the touches are swallowed */
82
+ @property(nonatomic, readwrite) BOOL swallowsTouches; // default NO
83
+ /** MutableSet that contains the claimed touches */
84
+ @property(nonatomic, readonly) NSMutableSet *claimedTouches;
85
+
86
+ /** allocates a TargetedTouchHandler with a delegate, a priority and whether or not it swallows touches or not */
87
+ + (id)handlerWithDelegate:(id) aDelegate priority:(int)priority swallowsTouches:(BOOL)swallowsTouches;
88
+ /** initializes a TargetedTouchHandler with a delegate, a priority and whether or not it swallows touches or not */
89
+ - (id)initWithDelegate:(id) aDelegate priority:(int)priority swallowsTouches:(BOOL)swallowsTouches;
90
+
91
+ @end
92
+
93
+ #endif // __CC_PLATFORM_IOS
@@ -0,0 +1,296 @@
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 "CCScene.h"
29
+ @class CCActionInterval;
30
+ @class CCNode;
31
+
32
+ /** CCTransitionEaseScene can ease the actions of the scene protocol.
33
+ @since v0.8.2
34
+ */
35
+ @protocol CCTransitionEaseScene <NSObject>
36
+ /** returns the Ease action that will be performed on a linear action.
37
+ @since v0.8.2
38
+ */
39
+ -(CCActionInterval*) easeActionWithAction:(CCActionInterval*)action;
40
+ @end
41
+
42
+ /** Orientation Type used by some transitions
43
+ */
44
+ typedef enum {
45
+ /// An horizontal orientation where the Left is nearer
46
+ kOrientationLeftOver = 0,
47
+ /// An horizontal orientation where the Right is nearer
48
+ kOrientationRightOver = 1,
49
+ /// A vertical orientation where the Up is nearer
50
+ kOrientationUpOver = 0,
51
+ /// A vertical orientation where the Bottom is nearer
52
+ kOrientationDownOver = 1,
53
+ } tOrientation;
54
+
55
+ /** Base class for CCTransition scenes
56
+ */
57
+ @interface CCTransitionScene : CCScene
58
+ {
59
+ CCScene *inScene_;
60
+ CCScene *outScene_;
61
+ ccTime duration_;
62
+ BOOL inSceneOnTop_;
63
+ BOOL sendCleanupToScene_;
64
+ }
65
+ /** creates a base transition with duration and incoming scene */
66
+ +(id) transitionWithDuration:(ccTime) t scene:(CCScene*)s;
67
+ /** initializes a transition with duration and incoming scene */
68
+ -(id) initWithDuration:(ccTime) t scene:(CCScene*)s;
69
+ /** called after the transition finishes */
70
+ -(void) finish;
71
+ /** used by some transitions to hide the outter scene */
72
+ -(void) hideOutShowIn;
73
+ @end
74
+
75
+ /** A CCTransition that supports orientation like.
76
+ * Possible orientation: LeftOver, RightOver, UpOver, DownOver
77
+ */
78
+ @interface CCTransitionSceneOriented : CCTransitionScene
79
+ {
80
+ tOrientation orientation;
81
+ }
82
+ /** creates a base transition with duration and incoming scene */
83
+ +(id) transitionWithDuration:(ccTime) t scene:(CCScene*)s orientation:(tOrientation)o;
84
+ /** initializes a transition with duration and incoming scene */
85
+ -(id) initWithDuration:(ccTime) t scene:(CCScene*)s orientation:(tOrientation)o;
86
+ @end
87
+
88
+
89
+ /** CCTransitionRotoZoom:
90
+ Rotate and zoom out the outgoing scene, and then rotate and zoom in the incoming
91
+ */
92
+ @interface CCTransitionRotoZoom : CCTransitionScene
93
+ {}
94
+ @end
95
+
96
+ /** CCTransitionJumpZoom:
97
+ Zoom out and jump the outgoing scene, and then jump and zoom in the incoming
98
+ */
99
+ @interface CCTransitionJumpZoom : CCTransitionScene
100
+ {}
101
+ @end
102
+
103
+ /** CCTransitionMoveInL:
104
+ Move in from to the left the incoming scene.
105
+ */
106
+ @interface CCTransitionMoveInL : CCTransitionScene <CCTransitionEaseScene>
107
+ {}
108
+ /** initializes the scenes */
109
+ -(void) initScenes;
110
+ /** returns the action that will be performed */
111
+ -(CCActionInterval*) action;
112
+ @end
113
+
114
+ /** CCTransitionMoveInR:
115
+ Move in from to the right the incoming scene.
116
+ */
117
+ @interface CCTransitionMoveInR : CCTransitionMoveInL
118
+ {}
119
+ @end
120
+
121
+ /** CCTransitionMoveInT:
122
+ Move in from to the top the incoming scene.
123
+ */
124
+ @interface CCTransitionMoveInT : CCTransitionMoveInL
125
+ {}
126
+ @end
127
+
128
+ /** CCTransitionMoveInB:
129
+ Move in from to the bottom the incoming scene.
130
+ */
131
+ @interface CCTransitionMoveInB : CCTransitionMoveInL
132
+ {}
133
+ @end
134
+
135
+ /** CCTransitionSlideInL:
136
+ Slide in the incoming scene from the left border.
137
+ */
138
+ @interface CCTransitionSlideInL : CCTransitionScene <CCTransitionEaseScene>
139
+ {}
140
+ /** initializes the scenes */
141
+ -(void) initScenes;
142
+ /** returns the action that will be performed by the incomming and outgoing scene */
143
+ -(CCActionInterval*) action;
144
+ @end
145
+
146
+ /** CCTransitionSlideInR:
147
+ Slide in the incoming scene from the right border.
148
+ */
149
+ @interface CCTransitionSlideInR : CCTransitionSlideInL
150
+ {}
151
+ @end
152
+
153
+ /** CCTransitionSlideInB:
154
+ Slide in the incoming scene from the bottom border.
155
+ */
156
+ @interface CCTransitionSlideInB : CCTransitionSlideInL
157
+ {}
158
+ @end
159
+
160
+ /** CCTransitionSlideInT:
161
+ Slide in the incoming scene from the top border.
162
+ */
163
+ @interface CCTransitionSlideInT : CCTransitionSlideInL
164
+ {}
165
+ @end
166
+
167
+ /**
168
+ Shrink the outgoing scene while grow the incoming scene
169
+ */
170
+ @interface CCTransitionShrinkGrow : CCTransitionScene <CCTransitionEaseScene>
171
+ {}
172
+ @end
173
+
174
+ /** CCTransitionFlipX:
175
+ Flips the screen horizontally.
176
+ The front face is the outgoing scene and the back face is the incoming scene.
177
+ */
178
+ @interface CCTransitionFlipX : CCTransitionSceneOriented
179
+ {}
180
+ @end
181
+
182
+ /** CCTransitionFlipY:
183
+ Flips the screen vertically.
184
+ The front face is the outgoing scene and the back face is the incoming scene.
185
+ */
186
+ @interface CCTransitionFlipY : CCTransitionSceneOriented
187
+ {}
188
+ @end
189
+
190
+ /** CCTransitionFlipAngular:
191
+ Flips the screen half horizontally and half vertically.
192
+ The front face is the outgoing scene and the back face is the incoming scene.
193
+ */
194
+ @interface CCTransitionFlipAngular : CCTransitionSceneOriented
195
+ {}
196
+ @end
197
+
198
+ /** CCTransitionZoomFlipX:
199
+ Flips the screen horizontally doing a zoom out/in
200
+ The front face is the outgoing scene and the back face is the incoming scene.
201
+ */
202
+ @interface CCTransitionZoomFlipX : CCTransitionSceneOriented
203
+ {}
204
+ @end
205
+
206
+ /** CCTransitionZoomFlipY:
207
+ Flips the screen vertically doing a little zooming out/in
208
+ The front face is the outgoing scene and the back face is the incoming scene.
209
+ */
210
+ @interface CCTransitionZoomFlipY : CCTransitionSceneOriented
211
+ {}
212
+ @end
213
+
214
+ /** CCTransitionZoomFlipAngular:
215
+ Flips the screen half horizontally and half vertically doing a little zooming out/in.
216
+ The front face is the outgoing scene and the back face is the incoming scene.
217
+ */
218
+ @interface CCTransitionZoomFlipAngular : CCTransitionSceneOriented
219
+ {}
220
+ @end
221
+
222
+ /** CCTransitionFade:
223
+ Fade out the outgoing scene and then fade in the incoming scene.'''
224
+ */
225
+ @interface CCTransitionFade : CCTransitionScene
226
+ {
227
+ ccColor4B color;
228
+ }
229
+ /** creates the transition with a duration and with an RGB color
230
+ * Example: [FadeTransition transitionWithDuration:2 scene:s withColor:ccc3(255,0,0)]; // red color
231
+ */
232
+ +(id) transitionWithDuration:(ccTime)duration scene:(CCScene*)scene withColor:(ccColor3B)color;
233
+ /** initializes the transition with a duration and with an RGB color */
234
+ -(id) initWithDuration:(ccTime)duration scene:(CCScene*)scene withColor:(ccColor3B)color;
235
+ @end
236
+
237
+
238
+ /**
239
+ CCTransitionCrossFade:
240
+ Cross fades two scenes using the CCRenderTexture object.
241
+ */
242
+ @class CCRenderTexture;
243
+ @interface CCTransitionCrossFade : CCTransitionScene
244
+ {}
245
+ @end
246
+
247
+ /** CCTransitionTurnOffTiles:
248
+ Turn off the tiles of the outgoing scene in random order
249
+ */
250
+ @interface CCTransitionTurnOffTiles : CCTransitionScene <CCTransitionEaseScene>
251
+ {}
252
+ @end
253
+
254
+ /** CCTransitionSplitCols:
255
+ The odd columns goes upwards while the even columns goes downwards.
256
+ */
257
+ @interface CCTransitionSplitCols : CCTransitionScene <CCTransitionEaseScene>
258
+ {}
259
+ -(CCActionInterval*) action;
260
+ @end
261
+
262
+ /** CCTransitionSplitRows:
263
+ The odd rows goes to the left while the even rows goes to the right.
264
+ */
265
+ @interface CCTransitionSplitRows : CCTransitionSplitCols
266
+ {}
267
+ @end
268
+
269
+ /** CCTransitionFadeTR:
270
+ Fade the tiles of the outgoing scene from the left-bottom corner the to top-right corner.
271
+ */
272
+ @interface CCTransitionFadeTR : CCTransitionScene <CCTransitionEaseScene>
273
+ {}
274
+ -(CCActionInterval*) actionWithSize:(ccGridSize) vector;
275
+ @end
276
+
277
+ /** CCTransitionFadeBL:
278
+ Fade the tiles of the outgoing scene from the top-right corner to the bottom-left corner.
279
+ */
280
+ @interface CCTransitionFadeBL : CCTransitionFadeTR
281
+ {}
282
+ @end
283
+
284
+ /** CCTransitionFadeUp:
285
+ * Fade the tiles of the outgoing scene from the bottom to the top.
286
+ */
287
+ @interface CCTransitionFadeUp : CCTransitionFadeTR
288
+ {}
289
+ @end
290
+
291
+ /** CCTransitionFadeDown:
292
+ * Fade the tiles of the outgoing scene from the top to the bottom.
293
+ */
294
+ @interface CCTransitionFadeDown : CCTransitionFadeTR
295
+ {}
296
+ @end