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,73 @@
1
+ /*
2
+ * cocos2d for iPhone: http://www.cocos2d-iphone.org
3
+ *
4
+ * Copyright (c) 2009 Leonardo Kasperavičius
5
+ *
6
+ * Copyright (c) 2008-2010 Ricardo Quesada
7
+ * Copyright (c) 2011 Zynga Inc.
8
+ *
9
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
10
+ * of this software and associated documentation files (the "Software"), to deal
11
+ * in the Software without restriction, including without limitation the rights
12
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13
+ * copies of the Software, and to permit persons to whom the Software is
14
+ * furnished to do so, subject to the following conditions:
15
+ *
16
+ * The above copyright notice and this permission notice shall be included in
17
+ * all copies or substantial portions of the Software.
18
+ *
19
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25
+ * THE SOFTWARE.
26
+ *
27
+ */
28
+
29
+
30
+ #import "CCParticleSystem.h"
31
+ #import "ccConfig.h"
32
+
33
+ @class CCSpriteFrame;
34
+
35
+ /** CCParticleSystemQuad is a subclass of CCParticleSystem
36
+
37
+ It includes all the features of ParticleSystem.
38
+
39
+ Special features and Limitations:
40
+ - Particle size can be any float number.
41
+ - The system can be scaled
42
+ - The particles can be rotated
43
+ - It supports subrects
44
+ - It supports batched rendering since 1.1
45
+ @since v0.8
46
+ */
47
+ @interface CCParticleSystemQuad : CCParticleSystem
48
+ {
49
+ ccV3F_C4B_T2F_Quad *quads_; // quads to be rendered
50
+ GLushort *indices_; // indices
51
+ GLuint VAOname_;
52
+ GLuint buffersVBO_[2]; //0: vertex 1: indices
53
+ }
54
+
55
+ /** initialices the indices for the vertices */
56
+ -(void) initIndices;
57
+
58
+ /** initilizes the texture with a rectangle measured Points */
59
+ -(void) initTexCoordsWithRect:(CGRect)rect;
60
+
61
+ /** Sets a new CCSpriteFrame as particle.
62
+ WARNING: this method is experimental. Use setTexture:withRect instead.
63
+ @since v0.99.4
64
+ */
65
+ -(void)setDisplayFrame:(CCSpriteFrame*)spriteFrame;
66
+
67
+ /** Sets a new texture with a rect. The rect is in Points.
68
+ @since v0.99.4
69
+ */
70
+ -(void) setTexture:(CCTexture2D *)texture withRect:(CGRect)rect;
71
+
72
+ @end
73
+
@@ -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,94 @@
1
+ /*
2
+ * cocos2d for iPhone: http://www.cocos2d-iphone.org
3
+ *
4
+ * Copyright (c) 2010 Lam Pham
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 <Foundation/Foundation.h>
27
+ #import "CCSprite.h"
28
+
29
+ /** Types of progress
30
+ @since v0.99.1
31
+ */
32
+ typedef enum {
33
+ /// Radial Counter-Clockwise
34
+ kCCProgressTimerTypeRadial,
35
+ /// Bar
36
+ kCCProgressTimerTypeBar,
37
+ } CCProgressTimerType;
38
+
39
+ /**
40
+ CCProgresstimer is a subclass of CCNode.
41
+ It renders the inner sprite according to the percentage.
42
+ The progress can be Radial, Horizontal or vertical.
43
+ @since v0.99.1
44
+ */
45
+ @interface CCProgressTimer : CCNode<CCRGBAProtocol> {
46
+ CCProgressTimerType type_;
47
+ float percentage_;
48
+ CCSprite *sprite_;
49
+
50
+ int vertexDataCount_;
51
+ ccV2F_C4B_T2F *vertexData_;
52
+ CGPoint midpoint_;
53
+ CGPoint barChangeRate_;
54
+ BOOL reverseDirection_;
55
+ }
56
+ @property (nonatomic) ccColor3B color;
57
+ @property (nonatomic) GLubyte opacity;
58
+ /** Change the percentage to change progress. */
59
+ @property (nonatomic, readwrite) CCProgressTimerType type;
60
+ @property (nonatomic, readwrite) BOOL reverseDirection;
61
+ @property (nonatomic, readonly) ccV2F_C4B_T2F *vertexData;
62
+ @property (nonatomic, readonly) int vertexDataCount;
63
+
64
+ /**
65
+ * Midpoint is used to modify the progress start position.
66
+ * If you're using radials type then the midpoint changes the center point
67
+ * If you're using bar type the the midpoint changes the bar growth
68
+ * it expands from the center but clamps to the sprites edge so:
69
+ * you want a left to right then set the midpoint all the way to ccp(0,y)
70
+ * you want a right to left then set the midpoint all the way to ccp(1,y)
71
+ * you want a bottom to top then set the midpoint all the way to ccp(x,0)
72
+ * you want a top to bottom then set the midpoint all the way to ccp(x,1)
73
+ */
74
+ @property (nonatomic, readwrite) CGPoint midpoint;
75
+
76
+ /**
77
+ * This allows the bar type to move the component at a specific rate
78
+ * Set the component to 0 to make sure it stays at 100%.
79
+ * For example you want a left to right bar but not have the height stay 100%
80
+ * Set the rate to be ccp(0,1); and set the midpoint to = ccp(0,.5f);
81
+ */
82
+ @property (nonatomic, readwrite) CGPoint barChangeRate;
83
+
84
+ /** Percentages are from 0 to 100 */
85
+ @property (nonatomic, readwrite) float percentage;
86
+
87
+ /** The image to show the progress percentage */
88
+ @property (nonatomic, readwrite, retain) CCSprite *sprite;
89
+
90
+ /** Creates a progress timer with the sprite as the shape the timer goes through */
91
+ + (id) progressWithSprite:(CCSprite*) sprite;
92
+ /** Initializes a progress timer with the sprite as the shape the timer goes through */
93
+ - (id) initWithSprite:(CCSprite*) sprite;
94
+ @end
@@ -0,0 +1,132 @@
1
+ /*
2
+ * cocos2d for iPhone: http://www.cocos2d-iphone.org
3
+ *
4
+ * Copyright (c) 2008-2010 Ricardo Quesada
5
+ * Copyright (c) 2011 Zynga Inc.
6
+ *
7
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ * of this software and associated documentation files (the "Software"), to deal
9
+ * in the Software without restriction, including without limitation the rights
10
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ * copies of the Software, and to permit persons to whom the Software is
12
+ * furnished to do so, subject to the following conditions:
13
+ *
14
+ * The above copyright notice and this permission notice shall be included in
15
+ * all copies or substantial portions of the Software.
16
+ *
17
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23
+ * THE SOFTWARE.
24
+ */
25
+
26
+ #import "ccMacros.h"
27
+ #import "ccTypes.h"
28
+ #import "CCTexture2D.h"
29
+
30
+ #pragma mark -
31
+ #pragma mark CCRGBAProtocol
32
+
33
+ /// CC RGBA protocol
34
+ @protocol CCRGBAProtocol <NSObject>
35
+ /** sets Color
36
+ @since v0.8
37
+ */
38
+ -(void) setColor:(ccColor3B)color;
39
+ /** returns the color
40
+ @since v0.8
41
+ */
42
+ -(ccColor3B) color;
43
+
44
+ /// returns the opacity
45
+ -(GLubyte) opacity;
46
+ /** sets the opacity.
47
+ @warning If the the texture has premultiplied alpha then, the R, G and B channels will be modifed.
48
+ Values goes from 0 to 255, where 255 means fully opaque.
49
+ */
50
+ -(void) setOpacity: (GLubyte) opacity;
51
+ @optional
52
+ /** sets the premultipliedAlphaOpacity property.
53
+ If set to NO then opacity will be applied as: glColor(R,G,B,opacity);
54
+ If set to YES then oapcity will be applied as: glColor(opacity, opacity, opacity, opacity );
55
+ Textures with premultiplied alpha will have this property by default on YES. Otherwise the default value is NO
56
+ @since v0.8
57
+ */
58
+ -(void) setOpacityModifyRGB:(BOOL)boolean;
59
+ /** returns whether or not the opacity will be applied using glColor(R,G,B,opacity) or glColor(opacity, opacity, opacity, opacity);
60
+ @since v0.8
61
+ */
62
+ -(BOOL) doesOpacityModifyRGB;
63
+ @end
64
+
65
+ #pragma mark -
66
+ #pragma mark CCBlendProtocol
67
+ /**
68
+ You can specify the blending fuction.
69
+ @since v0.99.0
70
+ */
71
+ @protocol CCBlendProtocol <NSObject>
72
+ /** set the source blending function for the texture */
73
+ -(void) setBlendFunc:(ccBlendFunc)blendFunc;
74
+ /** returns the blending function used for the texture */
75
+ -(ccBlendFunc) blendFunc;
76
+ @end
77
+
78
+
79
+ #pragma mark -
80
+ #pragma mark CCTextureProtocol
81
+
82
+ /** CCNode objects that uses a Texture2D to render the images.
83
+ The texture can have a blending function.
84
+ If the texture has alpha premultiplied the default blending function is:
85
+ src=GL_ONE dst= GL_ONE_MINUS_SRC_ALPHA
86
+ else
87
+ src=GL_SRC_ALPHA dst= GL_ONE_MINUS_SRC_ALPHA
88
+ But you can change the blending funtion at any time.
89
+ @since v0.8.0
90
+ */
91
+ @protocol CCTextureProtocol <CCBlendProtocol>
92
+ /** returns the used texture */
93
+ -(CCTexture2D*) texture;
94
+ /** sets a new texture. it will be retained */
95
+ -(void) setTexture:(CCTexture2D*)texture;
96
+ @end
97
+
98
+ #pragma mark -
99
+ #pragma mark CCLabelProtocol
100
+ /** Common interface for Labels */
101
+ @protocol CCLabelProtocol <NSObject>
102
+ /** sets a new label using an NSString.
103
+ The string will be copied.
104
+ */
105
+ -(void) setString:(NSString*)label;
106
+ /** returns the string that is rendered */
107
+ -(NSString*) string;
108
+ @optional
109
+ /** sets a new label using a CString.
110
+ It is faster than setString since it doesn't require to alloc/retain/release an NString object.
111
+ @since v0.99.0
112
+ */
113
+ -(void) setCString:(char*)label;
114
+ @end
115
+
116
+
117
+ #pragma mark -
118
+ #pragma mark CCDirectorDelegate
119
+ /** CCDirector delegate */
120
+ @protocol CCDirectorDelegate <NSObject>
121
+
122
+ @optional
123
+ /** Called by CCDirector when the porjection is updated, and "custom" projection is used */
124
+ -(void) updateProjection;
125
+
126
+ #ifdef __CC_PLATFORM_IOS
127
+ /** Returns a Boolean value indicating whether the CCDirector supports the specified orientation. Default value is YES (supports all possible orientations) */
128
+ - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation;
129
+
130
+ #endif // __CC_PLATFORM_IOS
131
+
132
+ @end
@@ -0,0 +1,139 @@
1
+ /*
2
+ * cocos2d for iPhone: http://www.cocos2d-iphone.org
3
+ *
4
+ * Copyright (c) 2009 Jason Booth
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 <Foundation/Foundation.h>
27
+
28
+ #import "ccMacros.h"
29
+ #import "CCNode.h"
30
+ #import "CCSprite.h"
31
+ #import "Support/OpenGL_Internal.h"
32
+ #import "kazmath/mat4.h"
33
+
34
+ #ifdef __CC_PLATFORM_IOS
35
+ #import <UIKit/UIKit.h>
36
+ #endif // iPHone
37
+
38
+ typedef enum
39
+ {
40
+ kCCImageFormatJPEG = 0,
41
+ kCCImageFormatPNG = 1,
42
+ } tCCImageFormat;
43
+
44
+
45
+ /**
46
+ CCRenderTexture is a generic rendering target. To render things into it,
47
+ simply construct a render target, call begin on it, call visit on any cocos2d
48
+ scenes or objects to render them, and call end. For convienience, render texture
49
+ adds a sprite as its display child with the results, so you can simply add
50
+ the render texture to your scene and treat it like any other CCNode.
51
+ There are also functions for saving the render texture to disk in PNG or JPG format.
52
+
53
+ @since v0.8.1
54
+ */
55
+ @interface CCRenderTexture : CCNode
56
+ {
57
+ GLuint fbo_;
58
+ GLuint depthRenderBufffer_;
59
+ GLint oldFBO_;
60
+ CCTexture2D* texture_;
61
+ CCSprite* sprite_;
62
+
63
+ GLenum pixelFormat_;
64
+ }
65
+
66
+ /** The CCSprite being used.
67
+ The sprite, by default, will use the following blending function: GL_ONE, GL_ONE_MINUS_SRC_ALPHA.
68
+ The blending function can be changed in runtime by calling:
69
+ - [[renderTexture sprite] setBlendFunc:(ccBlendFunc){GL_ONE, GL_ONE_MINUS_SRC_ALPHA}];
70
+ */
71
+ @property (nonatomic,readwrite, assign) CCSprite* sprite;
72
+
73
+ /** initializes a RenderTexture object with width and height in Points and a pixel format( only RGB and RGBA formats are valid ) and depthStencil format*/
74
+ +(id)renderTextureWithWidth:(int)w height:(int)h pixelFormat:(CCTexture2DPixelFormat) format depthStencilFormat:(GLuint)depthStencilFormat;
75
+
76
+ /** creates a RenderTexture object with width and height in Points and a pixel format, only RGB and RGBA formats are valid */
77
+ +(id)renderTextureWithWidth:(int)w height:(int)h pixelFormat:(CCTexture2DPixelFormat) format;
78
+
79
+ /** creates a RenderTexture object with width and height in Points, pixel format is RGBA8888 */
80
+ +(id)renderTextureWithWidth:(int)w height:(int)h;
81
+
82
+ /** initializes a RenderTexture object with width and height in Points and a pixel format, only RGB and RGBA formats are valid */
83
+ -(id)initWithWidth:(int)w height:(int)h pixelFormat:(CCTexture2DPixelFormat) format;
84
+
85
+ /** initializes a RenderTexture object with width and height in Points and a pixel format( only RGB and RGBA formats are valid ) and depthStencil format*/
86
+ - (id)initWithWidth:(int)w height:(int)h pixelFormat:(CCTexture2DPixelFormat)format depthStencilFormat:(GLuint)depthStencilFormat;
87
+
88
+ /** starts grabbing */
89
+ -(void)begin;
90
+
91
+ /** starts rendering to the texture while clearing the texture first.
92
+ This is more efficient then calling -clear first and then -begin */
93
+ -(void)beginWithClear:(float)r g:(float)g b:(float)b a:(float)a;
94
+
95
+ /** starts rendering to the texture while clearing the texture first.
96
+ This is more efficient then calling -clear first and then -begin */
97
+ - (void)beginWithClear:(float)r g:(float)g b:(float)b a:(float)a depth:(float)depthValue;
98
+
99
+ /** starts rendering to the texture while clearing the texture first.
100
+ This is more efficient then calling -clear first and then -begin */
101
+ - (void)beginWithClear:(float)r g:(float)g b:(float)b a:(float)a depth:(float)depthValue stencil:(int)stencilValue;
102
+
103
+
104
+ /** ends grabbing */
105
+ -(void)end;
106
+
107
+ /** clears the texture with a color */
108
+ -(void)clear:(float)r g:(float)g b:(float)b a:(float)a;
109
+
110
+ /** clears the texture with a specified depth value */
111
+ - (void)clearDepth:(float)depthValue;
112
+
113
+ /** clears the texture with a specified stencil value */
114
+ - (void)clearStencil:(int)stencilValue;
115
+
116
+ /* creates a new CGImage from with the texture's data.
117
+ Caller is responsible for releasing it by calling CGImageRelease().
118
+ */
119
+ -(CGImageRef) newCGImage;
120
+
121
+ /** saves the texture into a file using JPEG format. The file will be saved in the Documents folder.
122
+ Returns YES if the operation is successful.
123
+ */
124
+ -(BOOL)saveToFile:(NSString*)name;
125
+
126
+ /** saves the texture into a file. The format could be JPG or PNG. The file will be saved in the Documents folder.
127
+ Returns YES if the operation is successful.
128
+ */
129
+ -(BOOL)saveToFile:(NSString*)name format:(tCCImageFormat)format;
130
+
131
+ #ifdef __CC_PLATFORM_IOS
132
+
133
+ /* returns an autoreleased UIImage from the texture */
134
+ -(UIImage *) getUIImage;
135
+
136
+ #endif // __CC_PLATFORM_IOS
137
+
138
+ @end
139
+