joybox 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (393) hide show
  1. checksums.yaml +8 -8
  2. data/Gemfile.lock +1 -1
  3. data/LICENSE +1 -1
  4. data/LICENSE_Box2D +20 -0
  5. data/LICENSE_Cocos2D +24 -0
  6. data/README.md +34 -66
  7. data/Rakefile +2 -3
  8. data/bin/joybox +49 -0
  9. data/command/joybox/USAGE +24 -0
  10. data/command/joybox/templates/layer.erb +11 -0
  11. data/command/joybox/templates/layer_spec.erb +3 -0
  12. data/command/joybox/templates/scene.erb +11 -0
  13. data/command/joybox/templates/scene_spec.erb +3 -0
  14. data/command/joybox/templates/sprite.erb +11 -0
  15. data/command/joybox/templates/sprite_spec.erb +3 -0
  16. data/command/joybox_generate_command.rb +114 -0
  17. data/joybox.gemspec +44 -0
  18. data/lib/joybox/joybox-ios.rb +47 -0
  19. data/lib/joybox/joybox-osx.rb +47 -0
  20. data/lib/joybox/version.rb +1 -1
  21. data/lib/joybox.rb +18 -36
  22. data/{lib/joybox/cocos2d → motion/joybox}/actions/actions.rb +0 -0
  23. data/motion/joybox/actions/animate.rb +22 -0
  24. data/motion/joybox/actions/bezier.rb +33 -0
  25. data/motion/joybox/actions/blink.rb +24 -0
  26. data/motion/joybox/actions/ease.rb +149 -0
  27. data/motion/joybox/actions/fade.rb +38 -0
  28. data/motion/joybox/actions/jump.rb +39 -0
  29. data/{lib/joybox/cocos2d → motion/joybox}/actions/move.rb +4 -2
  30. data/motion/joybox/actions/place.rb +22 -0
  31. data/{lib/joybox/cocos2d → motion/joybox}/actions/repeat.rb +10 -1
  32. data/{lib/joybox/cocos2d → motion/joybox}/actions/rotate.rb +4 -2
  33. data/{lib/joybox/cocos2d → motion/joybox}/actions/scale.rb +4 -2
  34. data/{lib/joybox/cocos2d → motion/joybox}/actions/sequence.rb +3 -3
  35. data/{lib/joybox/cocos2d → motion/joybox}/actions/skew.rb +0 -0
  36. data/motion/joybox/actions/spawn.rb +22 -0
  37. data/motion/joybox/actions/tint.rb +37 -0
  38. data/motion/joybox/animations/animation.rb +60 -0
  39. data/{lib/joybox/cocos2d → motion/joybox}/common/color.rb +12 -1
  40. data/{lib/joybox/cocos2d → motion/joybox}/common/gc_size.rb +4 -4
  41. data/{lib/joybox/cocos2d → motion/joybox}/common/ns_set.rb +0 -0
  42. data/{lib/joybox/cocos2d → motion/joybox}/common/numeric.rb +0 -0
  43. data/{lib/joybox/cocos2d → motion/joybox}/common/screen.rb +4 -4
  44. data/motion/joybox/core/layer.rb +51 -0
  45. data/{lib/joybox/cocos2d → motion/joybox}/core/node.rb +0 -0
  46. data/{lib/joybox/cocos2d → motion/joybox}/core/scene.rb +0 -0
  47. data/{lib/joybox/cocos2d → motion/joybox}/core/sprite.rb +22 -3
  48. data/{lib/joybox/cocos2d → motion/joybox}/core/sprite_batch.rb +0 -0
  49. data/motion/joybox/core/sprite_frame_cache.rb +147 -0
  50. data/{lib/joybox/cocos2d/cocos2d.rb → motion/joybox/joybox.rb} +3 -1
  51. data/{lib/joybox/cocos2d → motion/joybox}/macros.rb +0 -0
  52. data/{lib/joybox/box2d → motion/joybox/physics}/body.rb +44 -17
  53. data/{lib/joybox/cocos2d/core → motion/joybox/physics}/physics_sprite.rb +1 -1
  54. data/motion/joybox/physics/world.rb +79 -0
  55. data/{lib/joybox/cocos2d → motion/joybox}/ui/label.rb +3 -2
  56. data/{lib/joybox/cocos2d → motion/joybox}/ui/menu.rb +0 -0
  57. data/{lib/joybox/cocos2d → motion/joybox}/ui/menu_image.rb +0 -0
  58. data/{lib/joybox/cocos2d → motion/joybox}/ui/menu_label.rb +0 -0
  59. data/{lib/joybox/cocos2d → motion/joybox}/ui/ui.rb +0 -0
  60. data/{lib/joybox/cocos2d → motion/joybox-ios}/common/cg_point.rb +9 -2
  61. data/{lib/joybox/cocos2d → motion/joybox-ios}/common/ui_touch.rb +1 -1
  62. data/{lib/joybox/cocos2d → motion/joybox-ios}/configuration/configuration.rb +0 -0
  63. data/{lib/joybox/cocos2d → motion/joybox-ios}/configuration/file_utils.rb +0 -3
  64. data/{lib/joybox/cocos2d → motion/joybox-ios}/configuration/gl_view.rb +0 -0
  65. data/{lib/joybox/cocos2d → motion/joybox-ios}/configuration/texture_2d.rb +0 -0
  66. data/{lib/joybox/cocos2d → motion/joybox-ios}/core/layer.rb +1 -45
  67. data/{lib/joybox/cocos2d → motion/joybox-ios}/director.rb +6 -6
  68. data/motion/joybox-osx/common/ats_point.rb +48 -0
  69. data/motion/joybox-osx/common/ns_event.rb +8 -0
  70. data/motion/joybox-osx/configuration/configuration.rb +46 -0
  71. data/motion/joybox-osx/configuration/gl_view.rb +57 -0
  72. data/motion/joybox-osx/core/layer.rb +135 -0
  73. data/motion/joybox-osx/director.rb +42 -0
  74. data/template/joybox-ios/files/Rakefile.erb +9 -0
  75. data/{app → template/joybox-ios/files/app}/app_delegate.rb +1 -5
  76. data/{resources → template/joybox-ios/files/resources}/fps_images-hd.png +0 -0
  77. data/{resources → template/joybox-ios/files/resources}/fps_images-ipadhd.png +0 -0
  78. data/{resources → template/joybox-ios/files/resources}/fps_images.png +0 -0
  79. data/template/joybox-ios/files/spec/main_spec.rb.erb +9 -0
  80. data/template/joybox-osx/files/Rakefile.erb +9 -0
  81. data/template/joybox-osx/files/app/app_delegate.rb +23 -0
  82. data/template/joybox-osx/files/app/layers/default_layer.rb +5 -0
  83. data/template/joybox-osx/files/app/menu.rb +51 -0
  84. data/template/joybox-osx/files/resources/Credits.rtf +29 -0
  85. data/template/joybox-osx/files/resources/fps_images-hd.png +0 -0
  86. data/template/joybox-osx/files/resources/fps_images-ipadhd.png +0 -0
  87. data/template/joybox-osx/files/resources/fps_images.png +0 -0
  88. data/template/joybox-osx/files/spec/main_spec.rb.erb +9 -0
  89. data/vendor/{Box2D.framework → vendor-ios/Box2D.framework}/Box2D +0 -0
  90. data/vendor/{Box2D.framework → vendor-ios/Box2D.framework}/Box2D.framework.bridgesupport +47 -37
  91. data/vendor/{Box2D.framework → vendor-ios/Box2D.framework}/Versions/A/Box2D +0 -0
  92. data/vendor/{Box2D.framework → vendor-ios/Box2D.framework}/Versions/A/Headers/Collision/B2DContactListener.h +0 -0
  93. data/vendor/vendor-ios/Box2D.framework/Versions/A/Headers/Collision/Shapes/B2DCircleShape.h +16 -0
  94. data/vendor/{Box2D.framework → vendor-ios/Box2D.framework}/Versions/A/Headers/Collision/Shapes/B2DEdgeShape.h +0 -0
  95. data/vendor/{Box2D.framework → vendor-ios/Box2D.framework}/Versions/A/Headers/Collision/Shapes/B2DPolygonShape.h +0 -0
  96. data/vendor/{Box2D.framework → vendor-ios/Box2D.framework}/Versions/A/Headers/Collision/Shapes/B2DShape.h +0 -0
  97. data/vendor/{Box2D.framework → vendor-ios/Box2D.framework}/Versions/A/Headers/Dynamics/B2DBody.h +6 -6
  98. data/vendor/{Box2D.framework → vendor-ios/Box2D.framework}/Versions/A/Headers/Dynamics/B2DWorld.h +0 -0
  99. data/vendor/{Box2D.framework → vendor-ios/Box2D.framework}/Versions/A/Resources/Box2DConfig.cmake +0 -0
  100. data/vendor/{Box2D.framework → vendor-ios/Box2D.framework}/Versions/A/Resources/CMakeLists.txt +0 -0
  101. data/vendor/vendor-ios/Box2D.framework/Versions/A/Resources/LICENSE +22 -0
  102. data/vendor/vendor-ios/cocos_2d/cocos_2d.bridgesupport +9154 -0
  103. data/vendor/vendor-ios/cocos_2d/cocos_2d_exceptions.bridgesupport +39 -0
  104. data/vendor/{Cocos2D → vendor-ios/cocos_2d}/include/CCAction.h +23 -23
  105. data/vendor/{Cocos2D → vendor-ios/cocos_2d}/include/CCActionCamera.h +21 -19
  106. data/vendor/{Cocos2D → vendor-ios/cocos_2d}/include/CCActionCatmullRom.h +18 -6
  107. data/vendor/{Cocos2D → vendor-ios/cocos_2d}/include/CCActionEase.h +117 -31
  108. data/vendor/{Cocos2D → vendor-ios/cocos_2d}/include/CCActionGrid.h +19 -17
  109. data/vendor/{Cocos2D → vendor-ios/cocos_2d}/include/CCActionGrid3D.h +45 -42
  110. data/vendor/{Cocos2D → vendor-ios/cocos_2d}/include/CCActionInstant.h +21 -13
  111. data/vendor/{Cocos2D → vendor-ios/cocos_2d}/include/CCActionInterval.h +123 -81
  112. data/vendor/{Cocos2D → vendor-ios/cocos_2d}/include/CCActionManager.h +2 -2
  113. data/vendor/{Cocos2D → vendor-ios/cocos_2d}/include/CCActionPageTurn3D.h +2 -1
  114. data/vendor/{Cocos2D → vendor-ios/cocos_2d}/include/CCActionProgressTimer.h +4 -4
  115. data/vendor/{Cocos2D → vendor-ios/cocos_2d}/include/CCActionTiledGrid.h +46 -38
  116. data/vendor/{Cocos2D → vendor-ios/cocos_2d}/include/CCActionTween.h +3 -3
  117. data/vendor/{Cocos2D → vendor-ios/cocos_2d}/include/CCAnimation.h +8 -8
  118. data/vendor/{Cocos2D → vendor-ios/cocos_2d}/include/CCAnimationCache.h +2 -2
  119. data/vendor/{Cocos2D → vendor-ios/cocos_2d}/include/CCAtlasNode.h +19 -17
  120. data/vendor/{Cocos2D → vendor-ios/cocos_2d}/include/CCCamera.h +12 -12
  121. data/vendor/vendor-ios/cocos_2d/include/CCClippingNode.h +77 -0
  122. data/vendor/{Cocos2D → vendor-ios/cocos_2d}/include/CCConfiguration.h +31 -13
  123. data/vendor/{Cocos2D → vendor-ios/cocos_2d}/include/CCDirector.h +51 -42
  124. data/vendor/vendor-ios/cocos_2d/include/CCDrawNode.h +65 -0
  125. data/vendor/{Cocos2D → vendor-ios/cocos_2d}/include/CCDrawingPrimitives.h +42 -8
  126. data/vendor/{Cocos2D → vendor-ios/cocos_2d}/include/CCGLProgram.h +56 -21
  127. data/vendor/{Cocos2D → vendor-ios/cocos_2d}/include/CCGrabber.h +2 -2
  128. data/vendor/{Cocos2D → vendor-ios/cocos_2d}/include/CCGrid.h +29 -29
  129. data/vendor/{Cocos2D → vendor-ios/cocos_2d}/include/CCLabelAtlas.h +5 -2
  130. data/vendor/{Cocos2D → vendor-ios/cocos_2d}/include/CCLabelBMFont.h +56 -32
  131. data/vendor/{Cocos2D → vendor-ios/cocos_2d}/include/CCLabelTTF.h +20 -20
  132. data/vendor/{Cocos2D → vendor-ios/cocos_2d}/include/CCLayer.h +107 -79
  133. data/vendor/{Cocos2D → vendor-ios/cocos_2d}/include/CCMenu.h +10 -14
  134. data/vendor/{Cocos2D → vendor-ios/cocos_2d}/include/CCMenuItem.h +37 -32
  135. data/vendor/{Cocos2D → vendor-ios/cocos_2d}/include/CCMotionStreak.h +18 -19
  136. data/vendor/{Cocos2D → vendor-ios/cocos_2d}/include/CCNode+Debug.h +0 -0
  137. data/vendor/{Cocos2D → vendor-ios/cocos_2d}/include/CCNode.h +87 -37
  138. data/vendor/{Cocos2D → vendor-ios/cocos_2d}/include/CCParallaxNode.h +2 -2
  139. data/vendor/{Cocos2D → vendor-ios/cocos_2d}/include/CCParticleBatchNode.h +2 -2
  140. data/vendor/{Cocos2D → vendor-ios/cocos_2d}/include/CCParticleExamples.h +22 -0
  141. data/vendor/{Cocos2D → vendor-ios/cocos_2d}/include/CCParticleSystem.h +51 -40
  142. data/vendor/{Cocos2D → vendor-ios/cocos_2d}/include/CCParticleSystemQuad.h +4 -4
  143. data/vendor/vendor-ios/cocos_2d/include/CCPhysicsDebugNode.h +58 -0
  144. data/vendor/vendor-ios/cocos_2d/include/CCPhysicsSprite.h +82 -0
  145. data/vendor/{Cocos2D → vendor-ios/cocos_2d}/include/CCProgressTimer.h +9 -11
  146. data/vendor/{Cocos2D → vendor-ios/cocos_2d}/include/CCProtocols.h +54 -26
  147. data/vendor/{Cocos2D → vendor-ios/cocos_2d}/include/CCRenderTexture.h +29 -9
  148. data/vendor/{Cocos2D → vendor-ios/cocos_2d}/include/CCScene.h +4 -0
  149. data/vendor/{Cocos2D → vendor-ios/cocos_2d}/include/CCScheduler.h +94 -40
  150. data/vendor/{Cocos2D → vendor-ios/cocos_2d}/include/CCShaderCache.h +1 -1
  151. data/vendor/{Cocos2D → vendor-ios/cocos_2d}/include/CCSprite.h +21 -28
  152. data/vendor/{Cocos2D → vendor-ios/cocos_2d}/include/CCSpriteBatchNode.h +16 -9
  153. data/vendor/{Cocos2D → vendor-ios/cocos_2d}/include/CCSpriteFrame.h +10 -10
  154. data/vendor/{Cocos2D → vendor-ios/cocos_2d}/include/CCSpriteFrameCache.h +6 -6
  155. data/vendor/{Cocos2D → vendor-ios/cocos_2d}/include/CCTMXLayer.h +16 -16
  156. data/vendor/{Cocos2D → vendor-ios/cocos_2d}/include/CCTMXObjectGroup.h +4 -4
  157. data/vendor/{Cocos2D → vendor-ios/cocos_2d}/include/CCTMXTiledMap.h +9 -9
  158. data/vendor/{Cocos2D → vendor-ios/cocos_2d}/include/CCTMXXMLParser.h +44 -33
  159. data/vendor/{Cocos2D → vendor-ios/cocos_2d}/include/CCTexture2D.h +17 -25
  160. data/vendor/{Cocos2D → vendor-ios/cocos_2d}/include/CCTextureAtlas.h +10 -10
  161. data/vendor/{Cocos2D → vendor-ios/cocos_2d}/include/CCTextureCache.h +4 -4
  162. data/vendor/{Cocos2D → vendor-ios/cocos_2d}/include/CCTexturePVR.h +25 -8
  163. data/vendor/{Cocos2D → vendor-ios/cocos_2d}/include/CCTileMapAtlas.h +6 -6
  164. data/vendor/{Cocos2D → vendor-ios/cocos_2d}/include/CCTransition.h +57 -12
  165. data/vendor/{Cocos2D → vendor-ios/cocos_2d}/include/CCTransitionPageTurn.h +2 -2
  166. data/vendor/{Cocos2D → vendor-ios/cocos_2d}/include/CCTransitionProgress.h +27 -5
  167. data/vendor/{Cocos2D/include → vendor-ios/cocos_2d/include/Platforms}/CCGL.h +4 -2
  168. data/vendor/{Cocos2D/include → vendor-ios/cocos_2d/include/Platforms}/CCNS.h +0 -0
  169. data/vendor/vendor-ios/cocos_2d/include/Platforms/Mac/CCDirectorMac.h +110 -0
  170. data/vendor/vendor-ios/cocos_2d/include/Platforms/Mac/CCEventDispatcher.h +343 -0
  171. data/vendor/vendor-ios/cocos_2d/include/Platforms/Mac/CCGLView.h +103 -0
  172. data/vendor/vendor-ios/cocos_2d/include/Platforms/Mac/CCWindow.h +41 -0
  173. data/vendor/{Cocos2D/include → vendor-ios/cocos_2d/include/Platforms/iOS}/CCDirectorIOS.h +12 -5
  174. data/vendor/{Cocos2D/include → vendor-ios/cocos_2d/include/Platforms/iOS}/CCES2Renderer.h +12 -12
  175. data/vendor/{Cocos2D/include → vendor-ios/cocos_2d/include/Platforms/iOS}/CCESRenderer.h +0 -0
  176. data/vendor/{Cocos2D/include → vendor-ios/cocos_2d/include/Platforms/iOS}/CCGLView.h +28 -13
  177. data/vendor/{Cocos2D/include → vendor-ios/cocos_2d/include/Platforms/iOS}/CCTouchDelegateProtocol.h +4 -4
  178. data/vendor/{Cocos2D/include → vendor-ios/cocos_2d/include/Platforms/iOS}/CCTouchDispatcher.h +2 -2
  179. data/vendor/{Cocos2D/include → vendor-ios/cocos_2d/include/Platforms/iOS}/CCTouchHandler.h +7 -7
  180. data/vendor/{Cocos2D/include → vendor-ios/cocos_2d/include/Support}/CCArray.h +1 -1
  181. data/vendor/vendor-ios/cocos_2d/include/Support/CCFileUtils.h +394 -0
  182. data/vendor/{Cocos2D/include → vendor-ios/cocos_2d/include/Support}/CCProfiling.h +0 -0
  183. data/vendor/{Cocos2D/include → vendor-ios/cocos_2d/include/Support}/CCVertex.h +1 -1
  184. data/vendor/{Cocos2D/include → vendor-ios/cocos_2d/include/Support}/CGPointExtension.h +4 -2
  185. data/vendor/{Cocos2D/include → vendor-ios/cocos_2d/include/Support}/NSThread+performBlock.h +0 -0
  186. data/vendor/{Cocos2D/include → vendor-ios/cocos_2d/include/Support}/OpenGL_Internal.h +0 -0
  187. data/vendor/{Cocos2D/include → vendor-ios/cocos_2d/include/Support}/TGAlib.h +0 -0
  188. data/vendor/{Cocos2D/include → vendor-ios/cocos_2d/include/Support}/TransformUtils.h +0 -0
  189. data/vendor/{Cocos2D/include → vendor-ios/cocos_2d/include/Support}/ZipUtils.h +4 -4
  190. data/vendor/{Cocos2D/include → vendor-ios/cocos_2d/include/Support}/base64.h +0 -0
  191. data/vendor/{Cocos2D/include → vendor-ios/cocos_2d/include/Support}/ccCArray.h +15 -15
  192. data/vendor/{Cocos2D/include → vendor-ios/cocos_2d/include/Support}/ccUtils.h +0 -0
  193. data/vendor/{Cocos2D/include → vendor-ios/cocos_2d/include/Support}/uthash.h +129 -184
  194. data/vendor/{Cocos2D/include → vendor-ios/cocos_2d/include/Support}/utlist.h +298 -55
  195. data/vendor/{Cocos2D → vendor-ios/cocos_2d}/include/ccConfig.h +56 -9
  196. data/vendor/{Cocos2D → vendor-ios/cocos_2d}/include/ccDeprecated.h +131 -0
  197. data/vendor/vendor-ios/cocos_2d/include/ccFPSImages.h +39 -0
  198. data/vendor/{Cocos2D → vendor-ios/cocos_2d}/include/ccGLStateCache.h +44 -26
  199. data/vendor/{Cocos2D → vendor-ios/cocos_2d}/include/ccMacros.h +9 -9
  200. data/vendor/vendor-ios/cocos_2d/include/ccShader_PositionColorLengthTexture_frag.h +41 -0
  201. data/vendor/vendor-ios/cocos_2d/include/ccShader_PositionColorLengthTexture_vert.h +47 -0
  202. data/vendor/vendor-ios/cocos_2d/include/ccShader_PositionColor_frag.h +37 -0
  203. data/vendor/vendor-ios/cocos_2d/include/ccShader_PositionColor_vert.h +40 -0
  204. data/vendor/vendor-ios/cocos_2d/include/ccShader_PositionTextureA8Color_frag.h +41 -0
  205. data/vendor/vendor-ios/cocos_2d/include/ccShader_PositionTextureA8Color_vert.h +45 -0
  206. data/vendor/vendor-ios/cocos_2d/include/ccShader_PositionTextureColorAlphaTest_frag.h +47 -0
  207. data/vendor/vendor-ios/cocos_2d/include/ccShader_PositionTextureColor_frag.h +39 -0
  208. data/vendor/vendor-ios/cocos_2d/include/ccShader_PositionTextureColor_vert.h +45 -0
  209. data/vendor/vendor-ios/cocos_2d/include/ccShader_PositionTexture_frag.h +38 -0
  210. data/vendor/vendor-ios/cocos_2d/include/ccShader_PositionTexture_uColor_frag.h +41 -0
  211. data/vendor/vendor-ios/cocos_2d/include/ccShader_PositionTexture_uColor_vert.h +41 -0
  212. data/vendor/vendor-ios/cocos_2d/include/ccShader_PositionTexture_vert.h +41 -0
  213. data/vendor/vendor-ios/cocos_2d/include/ccShader_Position_uColor_frag.h +37 -0
  214. data/vendor/vendor-ios/cocos_2d/include/ccShader_Position_uColor_vert.h +43 -0
  215. data/vendor/{Cocos2D → vendor-ios/cocos_2d}/include/ccShaders.h +11 -0
  216. data/vendor/vendor-ios/cocos_2d/include/ccTypes.h +392 -0
  217. data/vendor/vendor-ios/cocos_2d/include/cocos2d-ios-exceptions.bridgesupport +39 -0
  218. data/vendor/{Cocos2D → vendor-ios/cocos_2d}/include/cocos2d.h +28 -3
  219. data/vendor/vendor-ios/cocos_2d/include/gen_cocos2d_bridgesupport.sh +17 -0
  220. data/vendor/vendor-ios/cocos_2d/include/gen_cocos2d_complement.sh +17 -0
  221. data/vendor/vendor-ios/cocos_2d/libcocos2d.a +0 -0
  222. data/vendor/vendor-osx/box_2d/box_2d.bridgesupport +176 -0
  223. data/vendor/vendor-osx/box_2d/include/B2DBody.h +46 -0
  224. data/vendor/vendor-osx/box_2d/include/B2DCircleShape.h +16 -0
  225. data/vendor/vendor-osx/box_2d/include/B2DContactListener.h +30 -0
  226. data/vendor/vendor-osx/box_2d/include/B2DEdgeShape.h +17 -0
  227. data/vendor/vendor-osx/box_2d/include/B2DPolygonShape.h +16 -0
  228. data/vendor/vendor-osx/box_2d/include/B2DShape.h +18 -0
  229. data/vendor/vendor-osx/box_2d/include/B2DWorld.h +44 -0
  230. data/vendor/vendor-osx/box_2d/libBox2D.a +0 -0
  231. data/vendor/vendor-osx/cocos_2d/cocos_2d.bridgesupport +8292 -0
  232. data/vendor/vendor-osx/cocos_2d/cocos_2d_include/CCAction.h +195 -0
  233. data/vendor/vendor-osx/cocos_2d/cocos_2d_include/CCActionCamera.h +75 -0
  234. data/vendor/vendor-osx/cocos_2d/cocos_2d_include/CCActionCatmullRom.h +151 -0
  235. data/vendor/vendor-osx/cocos_2d/cocos_2d_include/CCActionEase.h +245 -0
  236. data/vendor/vendor-osx/cocos_2d/cocos_2d_include/CCActionGrid.h +167 -0
  237. data/vendor/vendor-osx/cocos_2d/cocos_2d_include/CCActionGrid3D.h +208 -0
  238. data/vendor/vendor-osx/cocos_2d/cocos_2d_include/CCActionInstant.h +235 -0
  239. data/vendor/vendor-osx/cocos_2d/cocos_2d_include/CCActionInterval.h +473 -0
  240. data/vendor/vendor-osx/cocos_2d/cocos_2d_include/CCActionManager.h +113 -0
  241. data/vendor/vendor-osx/cocos_2d/cocos_2d_include/CCActionPageTurn3D.h +43 -0
  242. data/vendor/vendor-osx/cocos_2d/cocos_2d_include/CCActionProgressTimer.h +59 -0
  243. data/vendor/vendor-osx/cocos_2d/cocos_2d_include/CCActionTiledGrid.h +219 -0
  244. data/vendor/vendor-osx/cocos_2d/cocos_2d_include/CCActionTween.h +62 -0
  245. data/vendor/vendor-osx/cocos_2d/cocos_2d_include/CCAnimation.h +150 -0
  246. data/vendor/vendor-osx/cocos_2d/cocos_2d_include/CCAnimationCache.h +74 -0
  247. data/vendor/vendor-osx/cocos_2d/cocos_2d_include/CCAtlasNode.h +98 -0
  248. data/vendor/vendor-osx/cocos_2d/cocos_2d_include/CCCamera.h +98 -0
  249. data/vendor/vendor-osx/cocos_2d/cocos_2d_include/CCClippingNode.h +77 -0
  250. data/vendor/vendor-osx/cocos_2d/cocos_2d_include/CCConfiguration.h +144 -0
  251. data/vendor/vendor-osx/cocos_2d/cocos_2d_include/CCDirector.h +353 -0
  252. data/vendor/vendor-osx/cocos_2d/cocos_2d_include/CCDrawNode.h +65 -0
  253. data/vendor/vendor-osx/cocos_2d/cocos_2d_include/CCDrawingPrimitives.h +173 -0
  254. data/vendor/vendor-osx/cocos_2d/cocos_2d_include/CCGLProgram.h +185 -0
  255. data/vendor/vendor-osx/cocos_2d/cocos_2d_include/CCGrabber.h +44 -0
  256. data/vendor/vendor-osx/cocos_2d/cocos_2d_include/CCGrid.h +130 -0
  257. data/vendor/vendor-osx/cocos_2d/cocos_2d_include/CCLabelAtlas.h +71 -0
  258. data/vendor/vendor-osx/cocos_2d/cocos_2d_include/CCLabelBMFont.h +240 -0
  259. data/vendor/vendor-osx/cocos_2d/cocos_2d_include/CCLabelTTF.h +132 -0
  260. data/vendor/vendor-osx/cocos_2d/cocos_2d_include/CCLayer.h +308 -0
  261. data/vendor/vendor-osx/cocos_2d/cocos_2d_include/CCMenu.h +96 -0
  262. data/vendor/vendor-osx/cocos_2d/cocos_2d_include/CCMenuItem.h +428 -0
  263. data/vendor/vendor-osx/cocos_2d/cocos_2d_include/CCMotionStreak.h +86 -0
  264. data/vendor/vendor-osx/cocos_2d/cocos_2d_include/CCNode+Debug.h +39 -0
  265. data/vendor/vendor-osx/cocos_2d/cocos_2d_include/CCNode.h +619 -0
  266. data/vendor/vendor-osx/cocos_2d/cocos_2d_include/CCParallaxNode.h +50 -0
  267. data/vendor/vendor-osx/cocos_2d/cocos_2d_include/CCParticleBatchNode.h +99 -0
  268. data/vendor/vendor-osx/cocos_2d/cocos_2d_include/CCParticleExamples.h +117 -0
  269. data/vendor/vendor-osx/cocos_2d/cocos_2d_include/CCParticleSystem.h +464 -0
  270. data/vendor/vendor-osx/cocos_2d/cocos_2d_include/CCParticleSystemQuad.h +73 -0
  271. data/vendor/vendor-osx/cocos_2d/cocos_2d_include/CCPhysicsDebugNode.h +58 -0
  272. data/vendor/vendor-osx/cocos_2d/cocos_2d_include/CCPhysicsSprite.h +82 -0
  273. data/vendor/vendor-osx/cocos_2d/cocos_2d_include/CCProgressTimer.h +92 -0
  274. data/vendor/vendor-osx/cocos_2d/cocos_2d_include/CCProtocols.h +160 -0
  275. data/vendor/vendor-osx/cocos_2d/cocos_2d_include/CCRenderTexture.h +159 -0
  276. data/vendor/vendor-osx/cocos_2d/cocos_2d_include/CCScene.h +47 -0
  277. data/vendor/vendor-osx/cocos_2d/cocos_2d_include/CCScheduler.h +284 -0
  278. data/vendor/vendor-osx/cocos_2d/cocos_2d_include/CCShaderCache.h +60 -0
  279. data/vendor/vendor-osx/cocos_2d/cocos_2d_include/CCSprite.h +281 -0
  280. data/vendor/vendor-osx/cocos_2d/cocos_2d_include/CCSpriteBatchNode.h +145 -0
  281. data/vendor/vendor-osx/cocos_2d/cocos_2d_include/CCSpriteFrame.h +126 -0
  282. data/vendor/vendor-osx/cocos_2d/cocos_2d_include/CCSpriteFrameCache.h +121 -0
  283. data/vendor/vendor-osx/cocos_2d/cocos_2d_include/CCTMXLayer.h +164 -0
  284. data/vendor/vendor-osx/cocos_2d/cocos_2d_include/CCTMXObjectGroup.h +67 -0
  285. data/vendor/vendor-osx/cocos_2d/cocos_2d_include/CCTMXTiledMap.h +145 -0
  286. data/vendor/vendor-osx/cocos_2d/cocos_2d_include/CCTMXXMLParser.h +228 -0
  287. data/vendor/vendor-osx/cocos_2d/cocos_2d_include/CCTexture2D.h +349 -0
  288. data/vendor/vendor-osx/cocos_2d/cocos_2d_include/CCTextureAtlas.h +188 -0
  289. data/vendor/vendor-osx/cocos_2d/cocos_2d_include/CCTextureCache.h +146 -0
  290. data/vendor/vendor-osx/cocos_2d/cocos_2d_include/CCTexturePVR.h +146 -0
  291. data/vendor/vendor-osx/cocos_2d/cocos_2d_include/CCTileMapAtlas.h +83 -0
  292. data/vendor/vendor-osx/cocos_2d/cocos_2d_include/CCTransition.h +341 -0
  293. data/vendor/vendor-osx/cocos_2d/cocos_2d_include/CCTransitionPageTurn.h +60 -0
  294. data/vendor/vendor-osx/cocos_2d/cocos_2d_include/CCTransitionProgress.h +84 -0
  295. data/vendor/vendor-osx/cocos_2d/cocos_2d_include/Platforms/CCGL.h +74 -0
  296. data/vendor/vendor-osx/cocos_2d/cocos_2d_include/Platforms/CCNS.h +54 -0
  297. data/vendor/vendor-osx/cocos_2d/cocos_2d_include/Platforms/Mac/CCDirectorMac.h +110 -0
  298. data/vendor/vendor-osx/cocos_2d/cocos_2d_include/Platforms/Mac/CCEventDispatcher.h +343 -0
  299. data/vendor/vendor-osx/cocos_2d/cocos_2d_include/Platforms/Mac/CCGLView.h +103 -0
  300. data/vendor/vendor-osx/cocos_2d/cocos_2d_include/Platforms/Mac/CCWindow.h +41 -0
  301. data/vendor/vendor-osx/cocos_2d/cocos_2d_include/Support/CCArray.h +119 -0
  302. data/vendor/vendor-osx/cocos_2d/cocos_2d_include/Support/CCFileUtils.h +394 -0
  303. data/vendor/vendor-osx/cocos_2d/cocos_2d_include/Support/CCProfiling.h +89 -0
  304. data/vendor/vendor-osx/cocos_2d/cocos_2d_include/Support/CCVertex.h +36 -0
  305. data/vendor/vendor-osx/cocos_2d/cocos_2d_include/Support/CGPointExtension.h +346 -0
  306. data/vendor/vendor-osx/cocos_2d/cocos_2d_include/Support/NSThread+performBlock.h +22 -0
  307. data/vendor/vendor-osx/cocos_2d/cocos_2d_include/Support/OpenGL_Internal.h +86 -0
  308. data/vendor/vendor-osx/cocos_2d/cocos_2d_include/Support/TGAlib.h +55 -0
  309. data/vendor/vendor-osx/cocos_2d/cocos_2d_include/Support/TransformUtils.h +36 -0
  310. data/vendor/vendor-osx/cocos_2d/cocos_2d_include/Support/ZipUtils.h +91 -0
  311. data/vendor/vendor-osx/cocos_2d/cocos_2d_include/Support/base64.h +33 -0
  312. data/vendor/vendor-osx/cocos_2d/cocos_2d_include/Support/ccCArray.h +229 -0
  313. data/vendor/vendor-osx/cocos_2d/cocos_2d_include/Support/ccUtils.h +36 -0
  314. data/vendor/vendor-osx/cocos_2d/cocos_2d_include/Support/uthash.h +917 -0
  315. data/vendor/vendor-osx/cocos_2d/cocos_2d_include/Support/utlist.h +733 -0
  316. data/vendor/vendor-osx/cocos_2d/cocos_2d_include/ccConfig.h +292 -0
  317. data/vendor/vendor-osx/cocos_2d/cocos_2d_include/ccDeprecated.h +431 -0
  318. data/vendor/vendor-osx/cocos_2d/cocos_2d_include/ccFPSImages.h +39 -0
  319. data/vendor/vendor-osx/cocos_2d/cocos_2d_include/ccGLStateCache.h +156 -0
  320. data/vendor/vendor-osx/cocos_2d/cocos_2d_include/ccMacros.h +353 -0
  321. data/vendor/vendor-osx/cocos_2d/cocos_2d_include/ccShader_PositionColorLengthTexture_frag.h +41 -0
  322. data/vendor/vendor-osx/cocos_2d/cocos_2d_include/ccShader_PositionColorLengthTexture_vert.h +47 -0
  323. data/vendor/vendor-osx/cocos_2d/cocos_2d_include/ccShader_PositionColor_frag.h +37 -0
  324. data/vendor/vendor-osx/cocos_2d/cocos_2d_include/ccShader_PositionColor_vert.h +40 -0
  325. data/vendor/vendor-osx/cocos_2d/cocos_2d_include/ccShader_PositionTextureA8Color_frag.h +41 -0
  326. data/vendor/vendor-osx/cocos_2d/cocos_2d_include/ccShader_PositionTextureA8Color_vert.h +45 -0
  327. data/vendor/vendor-osx/cocos_2d/cocos_2d_include/ccShader_PositionTextureColorAlphaTest_frag.h +47 -0
  328. data/vendor/vendor-osx/cocos_2d/cocos_2d_include/ccShader_PositionTextureColor_frag.h +39 -0
  329. data/vendor/vendor-osx/cocos_2d/cocos_2d_include/ccShader_PositionTextureColor_vert.h +45 -0
  330. data/vendor/vendor-osx/cocos_2d/cocos_2d_include/ccShader_PositionTexture_frag.h +38 -0
  331. data/vendor/vendor-osx/cocos_2d/cocos_2d_include/ccShader_PositionTexture_uColor_frag.h +41 -0
  332. data/vendor/vendor-osx/cocos_2d/cocos_2d_include/ccShader_PositionTexture_uColor_vert.h +41 -0
  333. data/vendor/vendor-osx/cocos_2d/cocos_2d_include/ccShader_PositionTexture_vert.h +41 -0
  334. data/vendor/vendor-osx/cocos_2d/cocos_2d_include/ccShader_Position_uColor_frag.h +37 -0
  335. data/vendor/vendor-osx/cocos_2d/cocos_2d_include/ccShader_Position_uColor_vert.h +43 -0
  336. data/vendor/vendor-osx/cocos_2d/cocos_2d_include/ccShaders.h +56 -0
  337. data/vendor/{Cocos2D/include → vendor-osx/cocos_2d/cocos_2d_include}/ccTypes.h +39 -35
  338. data/vendor/vendor-osx/cocos_2d/cocos_2d_include/cocos2d.h +203 -0
  339. data/vendor/vendor-osx/cocos_2d/libcocos2d.a +0 -0
  340. metadata +363 -195
  341. data/app/layers/box2d_layer.rb +0 -109
  342. data/app/layers/cocos2d_layer.rb +0 -14
  343. data/app/layers/cocos_motion_layer.rb +0 -145
  344. data/app/layers/menu_layer.rb +0 -59
  345. data/lib/joybox/box2d/world.rb +0 -79
  346. data/resources/box2d/blocks_sprite_sheet.png +0 -0
  347. data/resources/cocos_motion/dot.png +0 -0
  348. data/resources/cocos_motion/dot_selected.png +0 -0
  349. data/resources/cocos_motion/grossini.png +0 -0
  350. data/resources/cocos_motion/grossinis_sister.png +0 -0
  351. data/resources/cocos_motion/grossinis_sister_two.png +0 -0
  352. data/resources/cocos_motion/left_arrow.png +0 -0
  353. data/resources/cocos_motion/left_arrow_selected.png +0 -0
  354. data/resources/cocos_motion/right_arrow.png +0 -0
  355. data/resources/cocos_motion/right_arrow_selected.png +0 -0
  356. data/vendor/Cocos2D/Cocos2D.bridgesupport +0 -7808
  357. data/vendor/Cocos2D/include/CCFileUtils.h +0 -188
  358. data/vendor/Cocos2D/include/CocosDenshion/CDAudioManager.h +0 -243
  359. data/vendor/Cocos2D/include/CocosDenshion/CDConfig.h +0 -60
  360. data/vendor/Cocos2D/include/CocosDenshion/CDOpenALSupport.h +0 -77
  361. data/vendor/Cocos2D/include/CocosDenshion/CDXPropertyModifierAction.h +0 -45
  362. data/vendor/Cocos2D/include/CocosDenshion/CocosDenshion.h +0 -440
  363. data/vendor/Cocos2D/include/CocosDenshion/SimpleAudioEngine.h +0 -90
  364. data/vendor/Cocos2D/include/RubyMotionSchedule.h +0 -7
  365. data/vendor/Cocos2D/include/ccShader_PositionColor_frag.h +0 -12
  366. data/vendor/Cocos2D/include/ccShader_PositionColor_vert.h +0 -17
  367. data/vendor/Cocos2D/include/ccShader_PositionTextureA8Color_frag.h +0 -16
  368. data/vendor/Cocos2D/include/ccShader_PositionTextureA8Color_vert.h +0 -21
  369. data/vendor/Cocos2D/include/ccShader_PositionTextureColorAlphaTest_frag.h +0 -23
  370. data/vendor/Cocos2D/include/ccShader_PositionTextureColor_frag.h +0 -14
  371. data/vendor/Cocos2D/include/ccShader_PositionTextureColor_vert.h +0 -22
  372. data/vendor/Cocos2D/include/ccShader_PositionTexture_frag.h +0 -13
  373. data/vendor/Cocos2D/include/ccShader_PositionTexture_uColor_frag.h +0 -16
  374. data/vendor/Cocos2D/include/ccShader_PositionTexture_uColor_vert.h +0 -18
  375. data/vendor/Cocos2D/include/ccShader_PositionTexture_vert.h +0 -17
  376. data/vendor/Cocos2D/include/ccShader_Position_uColor_frag.h +0 -12
  377. data/vendor/Cocos2D/include/ccShader_Position_uColor_vert.h +0 -19
  378. data/vendor/Cocos2D/include/kazmath/GL/mat4stack.h +0 -51
  379. data/vendor/Cocos2D/include/kazmath/GL/matrix.h +0 -58
  380. data/vendor/Cocos2D/include/kazmath/aabb.h +0 -53
  381. data/vendor/Cocos2D/include/kazmath/kazmath.h +0 -39
  382. data/vendor/Cocos2D/include/kazmath/mat3.h +0 -75
  383. data/vendor/Cocos2D/include/kazmath/mat4.h +0 -93
  384. data/vendor/Cocos2D/include/kazmath/neon_matrix_impl.h +0 -41
  385. data/vendor/Cocos2D/include/kazmath/plane.h +0 -70
  386. data/vendor/Cocos2D/include/kazmath/quaternion.h +0 -113
  387. data/vendor/Cocos2D/include/kazmath/ray2.h +0 -50
  388. data/vendor/Cocos2D/include/kazmath/utility.h +0 -74
  389. data/vendor/Cocos2D/include/kazmath/vec2.h +0 -64
  390. data/vendor/Cocos2D/include/kazmath/vec3.h +0 -68
  391. data/vendor/Cocos2D/include/kazmath/vec4.h +0 -68
  392. data/vendor/Cocos2D/libCocosDenshion.a +0 -0
  393. data/vendor/Cocos2D/libcocos2d.a +0 -0
@@ -0,0 +1,89 @@
1
+ /*
2
+ * cocos2d for iPhone: http://www.cocos2d-iphone.org
3
+ *
4
+ * Copyright (c) 2010 Stuart Carnie
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 <sys/time.h>
29
+
30
+ @class CCProfilingTimer;
31
+
32
+ /** CCProfiler
33
+ cocos2d builtin profiler.
34
+
35
+ To use it, enable set the CC_ENABLE_PROFILERS=1 in the ccConfig.h file
36
+ */
37
+ @interface CCProfiler : NSObject {
38
+ @public
39
+ NSMutableDictionary* activeTimers;
40
+ }
41
+
42
+ /** shared instance */
43
+ + (CCProfiler*)sharedProfiler;
44
+
45
+ /** Creates and adds a new timer */
46
+ - (CCProfilingTimer*) createAndAddTimerWithName:(NSString*)timerName;
47
+
48
+ /** releases a timer */
49
+ - (void)releaseTimer:(NSString*)timerName;
50
+
51
+ /** releases all timers */
52
+ - (void) releaseAllTimers;
53
+
54
+ /** display the timers */
55
+ - (void)displayTimers;
56
+
57
+ @end
58
+
59
+ /** CCProfilingTimer
60
+ Profiling timers used by CCProfiler
61
+ */
62
+ @interface CCProfilingTimer : NSObject {
63
+
64
+ @public
65
+ NSString *name;
66
+ struct timeval startTime;
67
+ double averageTime;
68
+ double minTime;
69
+ double maxTime;
70
+ double totalTime;
71
+ NSUInteger numberOfCalls;
72
+ }
73
+
74
+ /** resets the timer properties */
75
+ -(void) reset;
76
+ @end
77
+
78
+ extern void CCProfilingBeginTimingBlock(NSString *timerName);
79
+ extern void CCProfilingEndTimingBlock(NSString *timerName);
80
+ extern void CCProfilingResetTimingBlock(NSString *timerName);
81
+
82
+ /*
83
+ * cocos2d profiling categories
84
+ * used to enable / disable profilers with granularity
85
+ */
86
+
87
+ extern BOOL kCCProfilerCategorySprite;
88
+ extern BOOL kCCProfilerCategoryBatchSprite;
89
+ extern BOOL kCCProfilerCategoryParticles;
@@ -0,0 +1,36 @@
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
+ #import "ccTypes.h"
26
+
27
+ /** @file CCVertex.h */
28
+
29
+ /** converts a line to a polygon */
30
+ void ccVertexLineToPolygon(CGPoint *points, float stroke, ccVertex2F *vertices, NSUInteger offset, NSUInteger nuPoints);
31
+
32
+ /** returns whether or not the line intersects */
33
+ BOOL ccVertexLineIntersect(float Ax, float Ay,
34
+ float Bx, float By,
35
+ float Cx, float Cy,
36
+ float Dx, float Dy, float *T);
@@ -0,0 +1,346 @@
1
+ /* cocos2d for iPhone
2
+ * http://www.cocos2d-iphone.org
3
+ *
4
+ * Copyright (c) 2007 Scott Lembcke
5
+ *
6
+ * Copyright (c) 2010 Lam Pham
7
+ *
8
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
9
+ * of this software and associated documentation files (the "Software"), to deal
10
+ * in the Software without restriction, including without limitation the rights
11
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12
+ * copies of the Software, and to permit persons to whom the Software is
13
+ * furnished to do so, subject to the following conditions:
14
+ *
15
+ * The above copyright notice and this permission notice shall be included in
16
+ * all copies or substantial portions of the Software.
17
+ *
18
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24
+ * SOFTWARE.
25
+ */
26
+
27
+ /*
28
+ * Some of the functions were based on Chipmunk's cpVect.h.
29
+ */
30
+
31
+ /**
32
+ @file
33
+ CGPoint extensions based on Chipmunk's cpVect file.
34
+ These extensions work both with CGPoint and cpVect.
35
+
36
+ The "ccp" prefix means: "CoCos2d Point"
37
+
38
+ Examples:
39
+ - ccpAdd( ccp(1,1), ccp(2,2) ); // preferred cocos2d way
40
+ - ccpAdd( CGPointMake(1,1), CGPointMake(2,2) ); // also ok but more verbose
41
+
42
+ - cpvadd( cpv(1,1), cpv(2,2) ); // way of the chipmunk
43
+ - ccpAdd( cpv(1,1), cpv(2,2) ); // mixing chipmunk and cocos2d (avoid)
44
+ - cpvadd( CGPointMake(1,1), CGPointMake(2,2) ); // mixing chipmunk and CG (avoid)
45
+ */
46
+
47
+ #import "ccMacros.h"
48
+
49
+ #ifdef __CC_PLATFORM_IOS
50
+ #import <CoreGraphics/CGGeometry.h>
51
+ #elif defined(__CC_PLATFORM_MAC)
52
+ #import <Foundation/Foundation.h>
53
+ #endif
54
+
55
+ #import <math.h>
56
+ #import <objc/objc.h>
57
+
58
+ #ifdef __cplusplus
59
+ extern "C" {
60
+ #endif
61
+
62
+ /** Helper macro that creates a CGPoint
63
+ @return CGPoint
64
+ @since v0.7.2
65
+ */
66
+ static inline CGPoint ccp( CGFloat x, CGFloat y )
67
+ {
68
+ return CGPointMake(x, y);
69
+ }
70
+
71
+ /** Returns opposite of point.
72
+ @return CGPoint
73
+ @since v0.7.2
74
+ */
75
+ static inline CGPoint
76
+ ccpNeg(const CGPoint v)
77
+ {
78
+ return ccp(-v.x, -v.y);
79
+ }
80
+
81
+ /** Calculates sum of two points.
82
+ @return CGPoint
83
+ @since v0.7.2
84
+ */
85
+ static inline CGPoint
86
+ ccpAdd(const CGPoint v1, const CGPoint v2)
87
+ {
88
+ return ccp(v1.x + v2.x, v1.y + v2.y);
89
+ }
90
+
91
+ /** Calculates difference of two points.
92
+ @return CGPoint
93
+ @since v0.7.2
94
+ */
95
+ static inline CGPoint
96
+ ccpSub(const CGPoint v1, const CGPoint v2)
97
+ {
98
+ return ccp(v1.x - v2.x, v1.y - v2.y);
99
+ }
100
+
101
+ /** Returns point multiplied by given factor.
102
+ @return CGPoint
103
+ @since v0.7.2
104
+ */
105
+ static inline CGPoint
106
+ ccpMult(const CGPoint v, const CGFloat s)
107
+ {
108
+ return ccp(v.x*s, v.y*s);
109
+ }
110
+
111
+ /** Calculates midpoint between two points.
112
+ @return CGPoint
113
+ @since v0.7.2
114
+ */
115
+ static inline CGPoint
116
+ ccpMidpoint(const CGPoint v1, const CGPoint v2)
117
+ {
118
+ return ccpMult(ccpAdd(v1, v2), 0.5f);
119
+ }
120
+
121
+ /** Calculates dot product of two points.
122
+ @return CGFloat
123
+ @since v0.7.2
124
+ */
125
+ static inline CGFloat
126
+ ccpDot(const CGPoint v1, const CGPoint v2)
127
+ {
128
+ return v1.x*v2.x + v1.y*v2.y;
129
+ }
130
+
131
+ /** Calculates cross product of two points.
132
+ @return CGFloat
133
+ @since v0.7.2
134
+ */
135
+ static inline CGFloat
136
+ ccpCross(const CGPoint v1, const CGPoint v2)
137
+ {
138
+ return v1.x*v2.y - v1.y*v2.x;
139
+ }
140
+
141
+ /** Calculates perpendicular of v, rotated 90 degrees counter-clockwise -- cross(v, perp(v)) >= 0
142
+ @return CGPoint
143
+ @since v0.7.2
144
+ */
145
+ static inline CGPoint
146
+ ccpPerp(const CGPoint v)
147
+ {
148
+ return ccp(-v.y, v.x);
149
+ }
150
+
151
+ /** Calculates perpendicular of v, rotated 90 degrees clockwise -- cross(v, rperp(v)) <= 0
152
+ @return CGPoint
153
+ @since v0.7.2
154
+ */
155
+ static inline CGPoint
156
+ ccpRPerp(const CGPoint v)
157
+ {
158
+ return ccp(v.y, -v.x);
159
+ }
160
+
161
+ /** Calculates the projection of v1 over v2.
162
+ @return CGPoint
163
+ @since v0.7.2
164
+ */
165
+ static inline CGPoint
166
+ ccpProject(const CGPoint v1, const CGPoint v2)
167
+ {
168
+ return ccpMult(v2, ccpDot(v1, v2)/ccpDot(v2, v2));
169
+ }
170
+
171
+ /** Rotates two points.
172
+ @return CGPoint
173
+ @since v0.7.2
174
+ */
175
+ static inline CGPoint
176
+ ccpRotate(const CGPoint v1, const CGPoint v2)
177
+ {
178
+ return ccp(v1.x*v2.x - v1.y*v2.y, v1.x*v2.y + v1.y*v2.x);
179
+ }
180
+
181
+ /** Unrotates two points.
182
+ @return CGPoint
183
+ @since v0.7.2
184
+ */
185
+ static inline CGPoint
186
+ ccpUnrotate(const CGPoint v1, const CGPoint v2)
187
+ {
188
+ return ccp(v1.x*v2.x + v1.y*v2.y, v1.y*v2.x - v1.x*v2.y);
189
+ }
190
+
191
+ /** Calculates the square length of a CGPoint (not calling sqrt() )
192
+ @return CGFloat
193
+ @since v0.7.2
194
+ */
195
+ static inline CGFloat
196
+ ccpLengthSQ(const CGPoint v)
197
+ {
198
+ return ccpDot(v, v);
199
+ }
200
+
201
+ /** Calculates the square distance between two points (not calling sqrt() )
202
+ @return CGFloat
203
+ @since v1.1
204
+ */
205
+ static inline CGFloat
206
+ ccpDistanceSQ(const CGPoint p1, const CGPoint p2)
207
+ {
208
+ return ccpLengthSQ(ccpSub(p1, p2));
209
+ }
210
+
211
+ /** Calculates distance between point an origin
212
+ @return CGFloat
213
+ @since v0.7.2
214
+ */
215
+ CGFloat ccpLength(const CGPoint v);
216
+
217
+ /** Calculates the distance between two points
218
+ @return CGFloat
219
+ @since v0.7.2
220
+ */
221
+ CGFloat ccpDistance(const CGPoint v1, const CGPoint v2);
222
+
223
+ /** Returns point multiplied to a length of 1.
224
+ @return CGPoint
225
+ @since v0.7.2
226
+ */
227
+ CGPoint ccpNormalize(const CGPoint v);
228
+
229
+ /** Converts radians to a normalized vector.
230
+ @return CGPoint
231
+ @since v0.7.2
232
+ */
233
+ CGPoint ccpForAngle(const CGFloat a);
234
+
235
+ /** Converts a vector to radians.
236
+ @return CGFloat
237
+ @since v0.7.2
238
+ */
239
+ CGFloat ccpToAngle(const CGPoint v);
240
+
241
+
242
+ /** Clamp a value between from and to.
243
+ @since v0.99.1
244
+ */
245
+ float clampf(float value, float min_inclusive, float max_inclusive);
246
+
247
+ /** Clamp a point between from and to.
248
+ @since v0.99.1
249
+ */
250
+ CGPoint ccpClamp(CGPoint p, CGPoint from, CGPoint to);
251
+
252
+ /** Quickly convert CGSize to a CGPoint
253
+ @since v0.99.1
254
+ */
255
+ CGPoint ccpFromSize(CGSize s);
256
+
257
+ /** Run a math operation function on each point component
258
+ * absf, fllorf, ceilf, roundf
259
+ * any function that has the signature: float func(float);
260
+ * For example: let's try to take the floor of x,y
261
+ * ccpCompOp(p,floorf);
262
+ @since v0.99.1
263
+ */
264
+ CGPoint ccpCompOp(CGPoint p, float (*opFunc)(float));
265
+
266
+ /** Linear Interpolation between two points a and b
267
+ @returns
268
+ alpha == 0 ? a
269
+ alpha == 1 ? b
270
+ otherwise a value between a..b
271
+ @since v0.99.1
272
+ */
273
+ CGPoint ccpLerp(CGPoint a, CGPoint b, float alpha);
274
+
275
+
276
+ /** @returns if points have fuzzy equality which means equal with some degree of variance.
277
+ @since v0.99.1
278
+ */
279
+ BOOL ccpFuzzyEqual(CGPoint a, CGPoint b, float variance);
280
+
281
+
282
+ /** Multiplies a nd b components, a.x*b.x, a.y*b.y
283
+ @returns a component-wise multiplication
284
+ @since v0.99.1
285
+ */
286
+ CGPoint ccpCompMult(CGPoint a, CGPoint b);
287
+
288
+ /** @returns the signed angle in radians between two vector directions
289
+ @since v0.99.1
290
+ */
291
+ float ccpAngleSigned(CGPoint a, CGPoint b);
292
+
293
+ /** @returns the angle in radians between two vector directions
294
+ @since v0.99.1
295
+ */
296
+ float ccpAngle(CGPoint a, CGPoint b);
297
+
298
+ /** Rotates a point counter clockwise by the angle around a pivot
299
+ @param v is the point to rotate
300
+ @param pivot is the pivot, naturally
301
+ @param angle is the angle of rotation cw in radians
302
+ @returns the rotated point
303
+ @since v0.99.1
304
+ */
305
+ CGPoint ccpRotateByAngle(CGPoint v, CGPoint pivot, float angle);
306
+
307
+ /** A general line-line intersection test
308
+ @param p1
309
+ is the startpoint for the first line P1 = (p1 - p2)
310
+ @param p2
311
+ is the endpoint for the first line P1 = (p1 - p2)
312
+ @param p3
313
+ is the startpoint for the second line P2 = (p3 - p4)
314
+ @param p4
315
+ is the endpoint for the second line P2 = (p3 - p4)
316
+ @param s
317
+ is the range for a hitpoint in P1 (pa = p1 + s*(p2 - p1))
318
+ @param t
319
+ is the range for a hitpoint in P3 (pa = p2 + t*(p4 - p3))
320
+ @return bool
321
+ indicating successful intersection of a line
322
+ note that to truly test intersection for segments we have to make
323
+ sure that s & t lie within [0..1] and for rays, make sure s & t > 0
324
+ the hit point is p3 + t * (p4 - p3);
325
+ the hit point also is p1 + s * (p2 - p1);
326
+ @since v0.99.1
327
+ */
328
+ BOOL ccpLineIntersect(CGPoint p1, CGPoint p2,
329
+ CGPoint p3, CGPoint p4,
330
+ float *s, float *t);
331
+
332
+ /*
333
+ ccpSegmentIntersect returns YES if Segment A-B intersects with segment C-D
334
+ @since v1.0.0
335
+ */
336
+ BOOL ccpSegmentIntersect(CGPoint A, CGPoint B, CGPoint C, CGPoint D);
337
+
338
+ /*
339
+ ccpIntersectPoint returns the intersection point of line A-B, C-D
340
+ @since v1.0.0
341
+ */
342
+ CGPoint ccpIntersectPoint(CGPoint A, CGPoint B, CGPoint C, CGPoint D);
343
+
344
+ #ifdef __cplusplus
345
+ }
346
+ #endif
@@ -0,0 +1,22 @@
1
+ /* cocos2d for iPhone
2
+ *
3
+ * http://www.cocos2d-iphone.org
4
+ *
5
+ *
6
+ * Idea taken from: http://stackoverflow.com/a/3940757
7
+ *
8
+ */
9
+
10
+ #import <Foundation/Foundation.h>
11
+
12
+ @interface NSThread (sendBlockToBackground)
13
+ /** performs a block on the thread. It won't wait until it is done. */
14
+ - (void) performBlock:(void (^)(void))block;
15
+
16
+ /** performs a block on the thread. */
17
+ - (void) performBlock:(void (^)(void))block waitUntilDone:(BOOL)wait;
18
+
19
+ /** performs a block on the thread. */
20
+ - (void) performBlock:(void (^)(id param))block withObject:(id)object waitUntilDone:(BOOL)wait;
21
+
22
+ @end
@@ -0,0 +1,86 @@
1
+ /*
2
+
3
+ ===== IMPORTANT =====
4
+
5
+ This is sample code demonstrating API, technology or techniques in development.
6
+ Although this sample code has been reviewed for technical accuracy, it is not
7
+ final. Apple is supplying this information to help you plan for the adoption of
8
+ the technologies and programming interfaces described herein. This information
9
+ is subject to change, and software implemented based on this sample code should
10
+ be tested with final operating system software and final documentation. Newer
11
+ versions of this sample code may be provided with future seeds of the API or
12
+ technology. For information about updates to this and other developer
13
+ documentation, view the New & Updated sidebars in subsequent documentation
14
+ seeds.
15
+
16
+ =====================
17
+
18
+ File: OpenGL_Internal.h
19
+ Abstract: This file is included for support purposes and isn't necessary for
20
+ understanding this sample.
21
+
22
+ Version: 1.0
23
+
24
+ Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple Inc.
25
+ ("Apple") in consideration of your agreement to the following terms, and your
26
+ use, installation, modification or redistribution of this Apple software
27
+ constitutes acceptance of these terms. If you do not agree with these terms,
28
+ please do not use, install, modify or redistribute this Apple software.
29
+
30
+ In consideration of your agreement to abide by the following terms, and subject
31
+ to these terms, Apple grants you a personal, non-exclusive license, under
32
+ Apple's copyrights in this original Apple software (the "Apple Software"), to
33
+ use, reproduce, modify and redistribute the Apple Software, with or without
34
+ modifications, in source and/or binary forms; provided that if you redistribute
35
+ the Apple Software in its entirety and without modifications, you must retain
36
+ this notice and the following text and disclaimers in all such redistributions
37
+ of the Apple Software.
38
+ Neither the name, trademarks, service marks or logos of Apple Inc. may be used
39
+ to endorse or promote products derived from the Apple Software without specific
40
+ prior written permission from Apple. Except as expressly stated in this notice,
41
+ no other rights or licenses, express or implied, are granted by Apple herein,
42
+ including but not limited to any patent rights that may be infringed by your
43
+ derivative works or by other works in which the Apple Software may be
44
+ incorporated.
45
+
46
+ The Apple Software is provided by Apple on an "AS IS" basis. APPLE MAKES NO
47
+ WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED
48
+ WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
49
+ PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND OPERATION ALONE OR IN
50
+ COMBINATION WITH YOUR PRODUCTS.
51
+
52
+ IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR
53
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
54
+ GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
55
+ ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR
56
+ DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF
57
+ CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF
58
+ APPLE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
59
+
60
+ Copyright (C) 2008 Apple Inc. All Rights Reserved.
61
+
62
+ */
63
+
64
+ /* Generic error reporting */
65
+ #define REPORT_ERROR(__FORMAT__, ...) printf("%s: %s\n", __FUNCTION__, [[NSString stringWithFormat:__FORMAT__, __VA_ARGS__] UTF8String])
66
+
67
+ /* EAGL and GL functions calling wrappers that log on error */
68
+ #define CALL_EAGL_FUNCTION(__FUNC__, ...) ({ EAGLError __error = __FUNC__( __VA_ARGS__ ); if(__error != kEAGLErrorSuccess) printf("%s() called from %s returned error %i\n", #__FUNC__, __FUNCTION__, __error); (__error ? NO : YES); })
69
+ //#define CHECK_GL_ERROR() ({ GLenum __error = glGetError(); if(__error) printf("OpenGL error 0x%04X in %s\n", __error, __FUNCTION__); (__error ? NO : YES); })
70
+ #define CHECK_GL_ERROR() ({ GLenum __error = glGetError(); if(__error) printf("OpenGL error 0x%04X in %s %d\n", __error, __FUNCTION__, __LINE__); })
71
+
72
+ #if DEBUG
73
+ #define CHECK_GL_ERROR_DEBUG() ({ GLenum __error = glGetError(); if(__error) printf("OpenGL error 0x%04X in %s %d\n", __error, __FUNCTION__, __LINE__); })
74
+ #else
75
+ #define CHECK_GL_ERROR_DEBUG()
76
+ #endif
77
+
78
+ /* Optional delegate methods support */
79
+ #ifndef __DELEGATE_IVAR__
80
+ #define __DELEGATE_IVAR__ _delegate
81
+ #endif
82
+ #ifndef __DELEGATE_METHODS_IVAR__
83
+ #define __DELEGATE_METHODS_IVAR__ _delegateMethods
84
+ #endif
85
+ #define TEST_DELEGATE_METHOD_BIT(__BIT__) (self->__DELEGATE_METHODS_IVAR__ & (1 << __BIT__))
86
+ #define SET_DELEGATE_METHOD_BIT(__BIT__, __NAME__) { if([self->__DELEGATE_IVAR__ respondsToSelector:@selector(__NAME__)]) self->__DELEGATE_METHODS_IVAR__ |= (1 << __BIT__); else self->__DELEGATE_METHODS_IVAR__ &= ~(1 << __BIT__); }
@@ -0,0 +1,55 @@
1
+ //
2
+ // TGA lib for cocos2d-iphone
3
+ //
4
+ // sources from: http://www.lighthouse3d.com/opengl/terrain/index.php3?tgasource
5
+ //
6
+
7
+ //#ifndef TGA_LIB
8
+ //#define TGA_LIB
9
+
10
+ /**
11
+ @file
12
+ TGA image support
13
+ */
14
+
15
+ enum {
16
+ TGA_OK,
17
+ TGA_ERROR_FILE_OPEN,
18
+ TGA_ERROR_READING_FILE,
19
+ TGA_ERROR_INDEXED_COLOR,
20
+ TGA_ERROR_MEMORY,
21
+ TGA_ERROR_COMPRESSED_FILE,
22
+ };
23
+
24
+ /** TGA format */
25
+ typedef struct sImageTGA {
26
+ int status;
27
+ unsigned char type, pixelDepth;
28
+
29
+ /** map width */
30
+ short int width;
31
+
32
+ /** map height */
33
+ short int height;
34
+
35
+ /** raw data */
36
+ unsigned char *imageData;
37
+ int flipped;
38
+ } tImageTGA;
39
+
40
+ /// load the image header fields. We only keep those that matter!
41
+ void tgaLoadHeader(FILE *file, tImageTGA *info);
42
+
43
+ /// loads the image pixels. You shouldn't call this function directly
44
+ void tgaLoadImageData(FILE *file, tImageTGA *info);
45
+
46
+ /// this is the function to call when we want to load an image
47
+ tImageTGA * tgaLoad(const char *filename);
48
+
49
+ // /converts RGB to greyscale
50
+ void tgaRGBtogreyscale(tImageTGA *info);
51
+
52
+ /// releases the memory used for the image
53
+ void tgaDestroy(tImageTGA *info);
54
+
55
+ //#endif // TGA_LIB
@@ -0,0 +1,36 @@
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
+ #import "../ccMacros.h"
27
+ #import "../Platforms/CCGL.h"
28
+
29
+ #ifdef __CC_PLATFORM_IOS
30
+ #import <UIKit/UIKit.h>
31
+ #elif defined(__CC_PLATFORM_MAC)
32
+ #import <Foundation/Foundation.h>
33
+ #endif
34
+
35
+ void CGAffineToGL(const CGAffineTransform *t, GLfloat *m);
36
+ void GLToCGAffine(const GLfloat *m, CGAffineTransform *t);