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,12 @@
1
+ " \n\
2
+ #ifdef GL_ES \n\
3
+ precision lowp float; \n\
4
+ #endif \n\
5
+ \n\
6
+ varying vec4 v_fragmentColor; \n\
7
+ \n\
8
+ void main() \n\
9
+ { \n\
10
+ gl_FragColor = v_fragmentColor; \n\
11
+ } \n\
12
+ ";
@@ -0,0 +1,17 @@
1
+ " \n\
2
+ attribute vec4 a_position; \n\
3
+ attribute vec4 a_color; \n\
4
+ uniform mat4 u_MVPMatrix; \n\
5
+ \n\
6
+ #ifdef GL_ES \n\
7
+ varying lowp vec4 v_fragmentColor; \n\
8
+ #else \n\
9
+ varying vec4 v_fragmentColor; \n\
10
+ #endif \n\
11
+ \n\
12
+ void main() \n\
13
+ { \n\
14
+ gl_Position = u_MVPMatrix * a_position; \n\
15
+ v_fragmentColor = a_color; \n\
16
+ } \n\
17
+ ";
@@ -0,0 +1,16 @@
1
+ " \n\
2
+ #ifdef GL_ES \n\
3
+ precision lowp float; \n\
4
+ #endif \n\
5
+ \n\
6
+ varying vec4 v_fragmentColor; \n\
7
+ varying vec2 v_texCoord; \n\
8
+ uniform sampler2D u_texture; \n\
9
+ \n\
10
+ void main() \n\
11
+ { \n\
12
+ gl_FragColor = vec4( v_fragmentColor.rgb, // RGB from uniform \n\
13
+ v_fragmentColor.a * texture2D(u_texture, v_texCoord).a // A from texture & uniform \n\
14
+ ); \n\
15
+ } \n\
16
+ ";
@@ -0,0 +1,21 @@
1
+ " \n\
2
+ attribute vec4 a_position; \n\
3
+ attribute vec2 a_texCoord; \n\
4
+ attribute vec4 a_color; \n\
5
+ uniform mat4 u_MVPMatrix; \n\
6
+ \n\
7
+ #ifdef GL_ES \n\
8
+ varying lowp vec4 v_fragmentColor; \n\
9
+ varying mediump vec2 v_texCoord; \n\
10
+ #else \n\
11
+ varying vec4 v_fragmentColor; \n\
12
+ varying vec2 v_texCoord; \n\
13
+ #endif \n\
14
+ \n\
15
+ void main() \n\
16
+ { \n\
17
+ gl_Position = u_MVPMatrix * a_position; \n\
18
+ v_fragmentColor = a_color; \n\
19
+ v_texCoord = a_texCoord; \n\
20
+ } \n\
21
+ ";
@@ -0,0 +1,23 @@
1
+ " \n\
2
+ #ifdef GL_ES \n\
3
+ precision lowp float; \n\
4
+ #endif \n\
5
+ \n\
6
+ varying vec4 v_fragmentColor; \n\
7
+ varying vec2 v_texCoord; \n\
8
+ uniform sampler2D u_texture; \n\
9
+ uniform float u_alpha_value; \n\
10
+ \n\
11
+ void main() \n\
12
+ { \n\
13
+ vec4 texColor = texture2D(u_texture, v_texCoord); \n\
14
+ \n\
15
+ // mimic: glAlphaFunc(GL_GREATER) \n\
16
+ // pass if ( incoming_pixel >= u_alpha_value ) => fail if incoming_pixel < u_alpha_value \n\
17
+ \n\
18
+ if ( texColor.a <= u_alpha_value ) \n\
19
+ discard; \n\
20
+ \n\
21
+ gl_FragColor = texColor * v_fragmentColor; \n\
22
+ } \n\
23
+ ";
@@ -0,0 +1,14 @@
1
+ " \n\
2
+ #ifdef GL_ES \n\
3
+ precision lowp float; \n\
4
+ #endif \n\
5
+ \n\
6
+ varying vec4 v_fragmentColor; \n\
7
+ varying vec2 v_texCoord; \n\
8
+ uniform sampler2D u_texture; \n\
9
+ \n\
10
+ void main() \n\
11
+ { \n\
12
+ gl_FragColor = v_fragmentColor * texture2D(u_texture, v_texCoord); \n\
13
+ } \n\
14
+ ";
@@ -0,0 +1,22 @@
1
+ " \n\
2
+ attribute vec4 a_position; \n\
3
+ attribute vec2 a_texCoord; \n\
4
+ attribute vec4 a_color; \n\
5
+ \n\
6
+ uniform mat4 u_MVPMatrix; \n\
7
+ \n\
8
+ #ifdef GL_ES \n\
9
+ varying lowp vec4 v_fragmentColor; \n\
10
+ varying mediump vec2 v_texCoord; \n\
11
+ #else \n\
12
+ varying vec4 v_fragmentColor; \n\
13
+ varying vec2 v_texCoord; \n\
14
+ #endif \n\
15
+ \n\
16
+ void main() \n\
17
+ { \n\
18
+ gl_Position = u_MVPMatrix * a_position; \n\
19
+ v_fragmentColor = a_color; \n\
20
+ v_texCoord = a_texCoord; \n\
21
+ } \n\
22
+ ";
@@ -0,0 +1,13 @@
1
+ " \n\
2
+ #ifdef GL_ES \n\
3
+ precision lowp float; \n\
4
+ #endif \n\
5
+ \n\
6
+ varying vec2 v_texCoord; \n\
7
+ uniform sampler2D u_texture; \n\
8
+ \n\
9
+ void main() \n\
10
+ { \n\
11
+ gl_FragColor = texture2D(u_texture, v_texCoord); \n\
12
+ } \n\
13
+ ";
@@ -0,0 +1,16 @@
1
+ " \n\
2
+ #ifdef GL_ES \n\
3
+ precision lowp float; \n\
4
+ #endif \n\
5
+ \n\
6
+ uniform vec4 u_color; \n\
7
+ \n\
8
+ varying vec2 v_texCoord; \n\
9
+ \n\
10
+ uniform sampler2D u_texture; \n\
11
+ \n\
12
+ void main() \n\
13
+ { \n\
14
+ gl_FragColor = texture2D(u_texture, v_texCoord) * u_color; \n\
15
+ } \n\
16
+ ";
@@ -0,0 +1,18 @@
1
+ " \n\
2
+ attribute vec4 a_position; \n\
3
+ attribute vec2 a_texCoord; \n\
4
+ \n\
5
+ uniform mat4 u_MVPMatrix; \n\
6
+ \n\
7
+ #ifdef GL_ES \n\
8
+ varying mediump vec2 v_texCoord; \n\
9
+ #else \n\
10
+ varying vec2 v_texCoord; \n\
11
+ #endif \n\
12
+ \n\
13
+ void main() \n\
14
+ { \n\
15
+ gl_Position = u_MVPMatrix * a_position; \n\
16
+ v_texCoord = a_texCoord; \n\
17
+ } \n\
18
+ ";
@@ -0,0 +1,17 @@
1
+ " \n\
2
+ attribute vec4 a_position; \n\
3
+ attribute vec2 a_texCoord; \n\
4
+ uniform mat4 u_MVPMatrix; \n\
5
+ \n\
6
+ #ifdef GL_ES \n\
7
+ varying mediump vec2 v_texCoord; \n\
8
+ #else \n\
9
+ varying vec2 v_texCoord; \n\
10
+ #endif \n\
11
+ \n\
12
+ void main() \n\
13
+ { \n\
14
+ gl_Position = u_MVPMatrix * a_position; \n\
15
+ v_texCoord = a_texCoord; \n\
16
+ } \n\
17
+ ";
@@ -0,0 +1,12 @@
1
+ " \n\
2
+ #ifdef GL_ES \n\
3
+ precision lowp float; \n\
4
+ #endif \n\
5
+ \n\
6
+ varying vec4 v_fragmentColor; \n\
7
+ \n\
8
+ void main() \n\
9
+ { \n\
10
+ gl_FragColor = v_fragmentColor; \n\
11
+ } \n\
12
+ ";
@@ -0,0 +1,19 @@
1
+ " \n\
2
+ attribute vec4 a_position; \n\
3
+ uniform mat4 u_MVPMatrix; \n\
4
+ uniform vec4 u_color; \n\
5
+ uniform float u_pointSize; \n\
6
+ \n\
7
+ #ifdef GL_ES \n\
8
+ varying lowp vec4 v_fragmentColor; \n\
9
+ #else \n\
10
+ varying vec4 v_fragmentColor; \n\
11
+ #endif \n\
12
+ \n\
13
+ void main() \n\
14
+ { \n\
15
+ gl_Position = u_MVPMatrix * a_position; \n\
16
+ gl_PointSize = u_pointSize; \n\
17
+ v_fragmentColor = u_color; \n\
18
+ } \n\
19
+ ";
@@ -0,0 +1,45 @@
1
+ /*
2
+ * cocos2d for iPhone: http://www.cocos2d-iphone.org
3
+ *
4
+ * Copyright (c) 2012 Zynga Inc.
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 "Platforms/CCGL.h"
26
+
27
+ extern const GLchar * ccPosition_uColor_frag;
28
+ extern const GLchar * ccPosition_uColor_vert;
29
+
30
+ extern const GLchar * ccPositionColor_frag;
31
+ extern const GLchar * ccPositionColor_vert;
32
+
33
+ extern const GLchar * ccPositionTexture_frag;
34
+ extern const GLchar * ccPositionTexture_vert;
35
+
36
+ extern const GLchar * ccPositionTextureA8Color_frag;
37
+ extern const GLchar * ccPositionTextureA8Color_vert;
38
+
39
+ extern const GLchar * ccPositionTextureColor_frag;
40
+ extern const GLchar * ccPositionTextureColor_vert;
41
+
42
+ extern const GLchar * ccPositionTextureColorAlphaTest_frag;
43
+
44
+ extern const GLchar * ccPositionTexture_uColor_frag;
45
+ extern const GLchar * ccPositionTexture_uColor_vert;
@@ -0,0 +1,374 @@
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
+ @file
29
+ cocos2d (cc) types
30
+ */
31
+
32
+ #import <Foundation/Foundation.h>
33
+ #import "ccMacros.h"
34
+
35
+ #ifdef __CC_PLATFORM_IOS
36
+ #import <CoreGraphics/CGGeometry.h> // CGPoint
37
+ #endif
38
+
39
+ #import "Platforms/CCGL.h"
40
+
41
+ /** RGB color composed of bytes 3 bytes
42
+ @since v0.8
43
+ */
44
+ typedef struct _ccColor3B
45
+ {
46
+ GLubyte r;
47
+ GLubyte g;
48
+ GLubyte b;
49
+ } ccColor3B;
50
+
51
+ //! helper macro that creates an ccColor3B type
52
+ static inline ccColor3B
53
+ ccc3(const GLubyte r, const GLubyte g, const GLubyte b)
54
+ {
55
+ ccColor3B c = {r, g, b};
56
+ return c;
57
+ }
58
+ //ccColor3B predefined colors
59
+ //! White color (255,255,255)
60
+ static const ccColor3B ccWHITE = {255,255,255};
61
+ //! Yellow color (255,255,0)
62
+ static const ccColor3B ccYELLOW = {255,255,0};
63
+ //! Blue color (0,0,255)
64
+ static const ccColor3B ccBLUE = {0,0,255};
65
+ //! Green Color (0,255,0)
66
+ static const ccColor3B ccGREEN = {0,255,0};
67
+ //! Red Color (255,0,0,)
68
+ static const ccColor3B ccRED = {255,0,0};
69
+ //! Magenta Color (255,0,255)
70
+ static const ccColor3B ccMAGENTA = {255,0,255};
71
+ //! Black Color (0,0,0)
72
+ static const ccColor3B ccBLACK = {0,0,0};
73
+ //! Orange Color (255,127,0)
74
+ static const ccColor3B ccORANGE = {255,127,0};
75
+ //! Gray Color (166,166,166)
76
+ static const ccColor3B ccGRAY = {166,166,166};
77
+
78
+ /** RGBA color composed of 4 bytes
79
+ @since v0.8
80
+ */
81
+ typedef struct _ccColor4B
82
+ {
83
+ GLubyte r;
84
+ GLubyte g;
85
+ GLubyte b;
86
+ GLubyte a;
87
+ } ccColor4B;
88
+ //! helper macro that creates an ccColor4B type
89
+ static inline ccColor4B
90
+ ccc4(const GLubyte r, const GLubyte g, const GLubyte b, const GLubyte o)
91
+ {
92
+ ccColor4B c = {r, g, b, o};
93
+ return c;
94
+ }
95
+
96
+
97
+ /** RGBA color composed of 4 floats
98
+ @since v0.8
99
+ */
100
+ struct ccColor4F {
101
+ GLfloat r;
102
+ GLfloat g;
103
+ GLfloat b;
104
+ GLfloat a;
105
+ };
106
+ typedef struct ccColor4F ccColor4F;
107
+
108
+ //! helper that creates a ccColor4f type
109
+ static inline ccColor4F ccc4f(const GLfloat r, const GLfloat g, const GLfloat b, const GLfloat a)
110
+ {
111
+ return (ccColor4F){r, g, b, a};
112
+ }
113
+
114
+ /** Returns a ccColor4F from a ccColor3B. Alpha will be 1.
115
+ @since v0.99.1
116
+ */
117
+ static inline ccColor4F ccc4FFromccc3B(ccColor3B c)
118
+ {
119
+ return (ccColor4F){c.r/255.f, c.g/255.f, c.b/255.f, 1.f};
120
+ }
121
+
122
+ /** Returns a ccColor4F from a ccColor4B.
123
+ @since v0.99.1
124
+ */
125
+ static inline ccColor4F ccc4FFromccc4B(ccColor4B c)
126
+ {
127
+ return (ccColor4F){c.r/255.f, c.g/255.f, c.b/255.f, c.a/255.f};
128
+ }
129
+
130
+ /** returns YES if both ccColor4F are equal. Otherwise it returns NO.
131
+ @since v0.99.1
132
+ */
133
+ static inline BOOL ccc4FEqual(ccColor4F a, ccColor4F b)
134
+ {
135
+ return a.r == b.r && a.g == b.g && a.b == b.b && a.a == b.a;
136
+ }
137
+
138
+ /** A vertex composed of 2 GLfloats: x, y
139
+ @since v0.8
140
+ */
141
+ typedef struct _ccVertex2F
142
+ {
143
+ GLfloat x;
144
+ GLfloat y;
145
+ } ccVertex2F;
146
+
147
+ /** A vertex composed of 2 floats: x, y
148
+ @since v0.8
149
+ */
150
+ typedef struct _ccVertex3F
151
+ {
152
+ GLfloat x;
153
+ GLfloat y;
154
+ GLfloat z;
155
+ } ccVertex3F;
156
+
157
+ /** A texcoord composed of 2 floats: u, y
158
+ @since v0.8
159
+ */
160
+ typedef struct _ccTex2F {
161
+ GLfloat u;
162
+ GLfloat v;
163
+ } ccTex2F;
164
+
165
+
166
+ //! Point Sprite component
167
+ typedef struct _ccPointSprite
168
+ {
169
+ ccVertex2F pos; // 8 bytes
170
+ ccColor4B color; // 4 bytes
171
+ GLfloat size; // 4 bytes
172
+ } ccPointSprite;
173
+
174
+ //! A 2D Quad. 4 * 2 floats
175
+ typedef struct _ccQuad2 {
176
+ ccVertex2F tl;
177
+ ccVertex2F tr;
178
+ ccVertex2F bl;
179
+ ccVertex2F br;
180
+ } ccQuad2;
181
+
182
+
183
+ //! A 3D Quad. 4 * 3 floats
184
+ typedef struct _ccQuad3 {
185
+ ccVertex3F bl;
186
+ ccVertex3F br;
187
+ ccVertex3F tl;
188
+ ccVertex3F tr;
189
+ } ccQuad3;
190
+
191
+ //! A 2D grid size
192
+ typedef struct _ccGridSize
193
+ {
194
+ NSInteger x;
195
+ NSInteger y;
196
+ } ccGridSize;
197
+
198
+ //! helper function to create a ccGridSize
199
+ static inline ccGridSize
200
+ ccg(const NSInteger x, const NSInteger y)
201
+ {
202
+ ccGridSize v = {x, y};
203
+ return v;
204
+ }
205
+
206
+ //! a Point with a vertex point, a tex coord point and a color 4B
207
+ typedef struct _ccV2F_C4B_T2F
208
+ {
209
+ //! vertices (2F)
210
+ ccVertex2F vertices;
211
+ //! colors (4B)
212
+ ccColor4B colors;
213
+ //! tex coords (2F)
214
+ ccTex2F texCoords;
215
+ } ccV2F_C4B_T2F;
216
+
217
+ //! a Point with a vertex point, a tex coord point and a color 4F
218
+ typedef struct _ccV2F_C4F_T2F
219
+ {
220
+ //! vertices (2F)
221
+ ccVertex2F vertices;
222
+ //! colors (4F)
223
+ ccColor4F colors;
224
+ //! tex coords (2F)
225
+ ccTex2F texCoords;
226
+ } ccV2F_C4F_T2F;
227
+
228
+ //! a Point with a vertex point, a tex coord point and a color 4F
229
+ typedef struct _ccV3F_C4F_T2F
230
+ {
231
+ //! vertices (3F)
232
+ ccVertex3F vertices;
233
+ //! colors (4F)
234
+ ccColor4F colors;
235
+ //! tex coords (2F)
236
+ ccTex2F texCoords;
237
+ } ccV3F_C4F_T2F;
238
+
239
+ //! 4 ccV3F_C4F_T2F
240
+ typedef struct _ccV3F_C4F_T2F_Quad
241
+ {
242
+ //! top left
243
+ ccV3F_C4F_T2F tl;
244
+ //! bottom left
245
+ ccV3F_C4F_T2F bl;
246
+ //! top right
247
+ ccV3F_C4F_T2F tr;
248
+ //! bottom right
249
+ ccV3F_C4F_T2F br;
250
+ } ccV3F_C4F_T2F_Quad;
251
+
252
+ //! a Point with a vertex point, a tex coord point and a color 4B
253
+ typedef struct _ccV3F_C4B_T2F
254
+ {
255
+ //! vertices (3F)
256
+ ccVertex3F vertices; // 12 bytes
257
+ // char __padding__[4];
258
+
259
+ //! colors (4B)
260
+ ccColor4B colors; // 4 bytes
261
+ // char __padding2__[4];
262
+
263
+ // tex coords (2F)
264
+ ccTex2F texCoords; // 8 byts
265
+ } ccV3F_C4B_T2F;
266
+
267
+ //! 4 ccVertex2FTex2FColor4B Quad
268
+ typedef struct _ccV2F_C4B_T2F_Quad
269
+ {
270
+ //! bottom left
271
+ ccV2F_C4B_T2F bl;
272
+ //! bottom right
273
+ ccV2F_C4B_T2F br;
274
+ //! top left
275
+ ccV2F_C4B_T2F tl;
276
+ //! top right
277
+ ccV2F_C4B_T2F tr;
278
+ } ccV2F_C4B_T2F_Quad;
279
+
280
+ //! 4 ccVertex3FTex2FColor4B
281
+ typedef struct _ccV3F_C4B_T2F_Quad
282
+ {
283
+ //! top left
284
+ ccV3F_C4B_T2F tl;
285
+ //! bottom left
286
+ ccV3F_C4B_T2F bl;
287
+ //! top right
288
+ ccV3F_C4B_T2F tr;
289
+ //! bottom right
290
+ ccV3F_C4B_T2F br;
291
+ } ccV3F_C4B_T2F_Quad;
292
+
293
+ //! 4 ccVertex2FTex2FColor4F Quad
294
+ typedef struct _ccV2F_C4F_T2F_Quad
295
+ {
296
+ //! bottom left
297
+ ccV2F_C4F_T2F bl;
298
+ //! bottom right
299
+ ccV2F_C4F_T2F br;
300
+ //! top left
301
+ ccV2F_C4F_T2F tl;
302
+ //! top right
303
+ ccV2F_C4F_T2F tr;
304
+ } ccV2F_C4F_T2F_Quad;
305
+
306
+ //! Blend Function used for textures
307
+ typedef struct _ccBlendFunc
308
+ {
309
+ //! source blend function
310
+ GLenum src;
311
+ //! destination blend function
312
+ GLenum dst;
313
+ } ccBlendFunc;
314
+
315
+ //! ccResolutionType
316
+ typedef enum
317
+ {
318
+ //! Unknonw resolution type
319
+ kCCResolutionUnknown,
320
+ #ifdef __CC_PLATFORM_IOS
321
+ //! iPhone resolution type
322
+ kCCResolutioniPhone,
323
+ //! RetinaDisplay resolution type
324
+ kCCResolutioniPhoneRetinaDisplay,
325
+ //! iPad resolution type
326
+ kCCResolutioniPad,
327
+ //! iPad Retina Display resolution type
328
+ kCCResolutioniPadRetinaDisplay,
329
+
330
+ #elif defined(__CC_PLATFORM_MAC)
331
+ //! Mac resolution type
332
+ kCCResolutionMac,
333
+
334
+ //! Mac RetinaDisplay resolution type (???)
335
+ kCCResolutionMacRetinaDisplay,
336
+ #endif // platform
337
+
338
+ } ccResolutionType;
339
+
340
+ // XXX: If any of these enums are edited and/or reordered, udpate CCTexture2D.m
341
+ //! Vertical text alignment type
342
+ typedef enum
343
+ {
344
+ kCCVerticalTextAlignmentTop,
345
+ kCCVerticalTextAlignmentCenter,
346
+ kCCVerticalTextAlignmentBottom,
347
+ } CCVerticalTextAlignment;
348
+
349
+ // XXX: If any of these enums are edited and/or reordered, udpate CCTexture2D.m
350
+ //! Horizontal text alignment type
351
+ typedef enum
352
+ {
353
+ kCCTextAlignmentLeft,
354
+ kCCTextAlignmentCenter,
355
+ kCCTextAlignmentRight,
356
+ } CCTextAlignment;
357
+
358
+ // XXX: If any of these enums are edited and/or reordered, udpate CCTexture2D.m
359
+ //! Line break modes
360
+ typedef enum {
361
+ kCCLineBreakModeWordWrap,
362
+ kCCLineBreakModeCharacterWrap,
363
+ kCCLineBreakModeClip,
364
+ kCCLineBreakModeHeadTruncation,
365
+ kCCLineBreakModeTailTruncation,
366
+ kCCLineBreakModeMiddleTruncation
367
+ } CCLineBreakMode;
368
+
369
+ //! delta time type
370
+ //! if you want more resolution redefine it as a double
371
+ typedef float ccTime;
372
+ //typedef double ccTime;
373
+
374
+ typedef float ccMat4[16];