joybox 0.0.5 → 0.0.6
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.
- checksums.yaml +8 -8
- data/Gemfile.lock +1 -1
- data/LICENSE +1 -1
- data/LICENSE_Box2D +20 -0
- data/LICENSE_Cocos2D +24 -0
- data/README.md +34 -66
- data/Rakefile +2 -3
- data/bin/joybox +49 -0
- data/command/joybox/USAGE +24 -0
- data/command/joybox/templates/layer.erb +11 -0
- data/command/joybox/templates/layer_spec.erb +3 -0
- data/command/joybox/templates/scene.erb +11 -0
- data/command/joybox/templates/scene_spec.erb +3 -0
- data/command/joybox/templates/sprite.erb +11 -0
- data/command/joybox/templates/sprite_spec.erb +3 -0
- data/command/joybox_generate_command.rb +114 -0
- data/joybox.gemspec +44 -0
- data/lib/joybox/joybox-ios.rb +47 -0
- data/lib/joybox/joybox-osx.rb +47 -0
- data/lib/joybox/version.rb +1 -1
- data/lib/joybox.rb +18 -36
- data/{lib/joybox/cocos2d → motion/joybox}/actions/actions.rb +0 -0
- data/motion/joybox/actions/animate.rb +22 -0
- data/motion/joybox/actions/bezier.rb +33 -0
- data/motion/joybox/actions/blink.rb +24 -0
- data/motion/joybox/actions/ease.rb +149 -0
- data/motion/joybox/actions/fade.rb +38 -0
- data/motion/joybox/actions/jump.rb +39 -0
- data/{lib/joybox/cocos2d → motion/joybox}/actions/move.rb +4 -2
- data/motion/joybox/actions/place.rb +22 -0
- data/{lib/joybox/cocos2d → motion/joybox}/actions/repeat.rb +10 -1
- data/{lib/joybox/cocos2d → motion/joybox}/actions/rotate.rb +4 -2
- data/{lib/joybox/cocos2d → motion/joybox}/actions/scale.rb +4 -2
- data/{lib/joybox/cocos2d → motion/joybox}/actions/sequence.rb +3 -3
- data/{lib/joybox/cocos2d → motion/joybox}/actions/skew.rb +0 -0
- data/motion/joybox/actions/spawn.rb +22 -0
- data/motion/joybox/actions/tint.rb +37 -0
- data/motion/joybox/animations/animation.rb +60 -0
- data/{lib/joybox/cocos2d → motion/joybox}/common/color.rb +12 -1
- data/{lib/joybox/cocos2d → motion/joybox}/common/gc_size.rb +4 -4
- data/{lib/joybox/cocos2d → motion/joybox}/common/ns_set.rb +0 -0
- data/{lib/joybox/cocos2d → motion/joybox}/common/numeric.rb +0 -0
- data/{lib/joybox/cocos2d → motion/joybox}/common/screen.rb +4 -4
- data/motion/joybox/core/layer.rb +51 -0
- data/{lib/joybox/cocos2d → motion/joybox}/core/node.rb +0 -0
- data/{lib/joybox/cocos2d → motion/joybox}/core/scene.rb +0 -0
- data/{lib/joybox/cocos2d → motion/joybox}/core/sprite.rb +22 -3
- data/{lib/joybox/cocos2d → motion/joybox}/core/sprite_batch.rb +0 -0
- data/motion/joybox/core/sprite_frame_cache.rb +147 -0
- data/{lib/joybox/cocos2d/cocos2d.rb → motion/joybox/joybox.rb} +3 -1
- data/{lib/joybox/cocos2d → motion/joybox}/macros.rb +0 -0
- data/{lib/joybox/box2d → motion/joybox/physics}/body.rb +44 -17
- data/{lib/joybox/cocos2d/core → motion/joybox/physics}/physics_sprite.rb +1 -1
- data/motion/joybox/physics/world.rb +79 -0
- data/{lib/joybox/cocos2d → motion/joybox}/ui/label.rb +3 -2
- data/{lib/joybox/cocos2d → motion/joybox}/ui/menu.rb +0 -0
- data/{lib/joybox/cocos2d → motion/joybox}/ui/menu_image.rb +0 -0
- data/{lib/joybox/cocos2d → motion/joybox}/ui/menu_label.rb +0 -0
- data/{lib/joybox/cocos2d → motion/joybox}/ui/ui.rb +0 -0
- data/{lib/joybox/cocos2d → motion/joybox-ios}/common/cg_point.rb +9 -2
- data/{lib/joybox/cocos2d → motion/joybox-ios}/common/ui_touch.rb +1 -1
- data/{lib/joybox/cocos2d → motion/joybox-ios}/configuration/configuration.rb +0 -0
- data/{lib/joybox/cocos2d → motion/joybox-ios}/configuration/file_utils.rb +0 -3
- data/{lib/joybox/cocos2d → motion/joybox-ios}/configuration/gl_view.rb +0 -0
- data/{lib/joybox/cocos2d → motion/joybox-ios}/configuration/texture_2d.rb +0 -0
- data/{lib/joybox/cocos2d → motion/joybox-ios}/core/layer.rb +1 -45
- data/{lib/joybox/cocos2d → motion/joybox-ios}/director.rb +6 -6
- data/motion/joybox-osx/common/ats_point.rb +48 -0
- data/motion/joybox-osx/common/ns_event.rb +8 -0
- data/motion/joybox-osx/configuration/configuration.rb +46 -0
- data/motion/joybox-osx/configuration/gl_view.rb +57 -0
- data/motion/joybox-osx/core/layer.rb +135 -0
- data/motion/joybox-osx/director.rb +42 -0
- data/template/joybox-ios/files/Rakefile.erb +9 -0
- data/{app → template/joybox-ios/files/app}/app_delegate.rb +1 -5
- data/{resources → template/joybox-ios/files/resources}/fps_images-hd.png +0 -0
- data/{resources → template/joybox-ios/files/resources}/fps_images-ipadhd.png +0 -0
- data/{resources → template/joybox-ios/files/resources}/fps_images.png +0 -0
- data/template/joybox-ios/files/spec/main_spec.rb.erb +9 -0
- data/template/joybox-osx/files/Rakefile.erb +9 -0
- data/template/joybox-osx/files/app/app_delegate.rb +23 -0
- data/template/joybox-osx/files/app/layers/default_layer.rb +5 -0
- data/template/joybox-osx/files/app/menu.rb +51 -0
- data/template/joybox-osx/files/resources/Credits.rtf +29 -0
- data/template/joybox-osx/files/resources/fps_images-hd.png +0 -0
- data/template/joybox-osx/files/resources/fps_images-ipadhd.png +0 -0
- data/template/joybox-osx/files/resources/fps_images.png +0 -0
- data/template/joybox-osx/files/spec/main_spec.rb.erb +9 -0
- data/vendor/{Box2D.framework → vendor-ios/Box2D.framework}/Box2D +0 -0
- data/vendor/{Box2D.framework → vendor-ios/Box2D.framework}/Box2D.framework.bridgesupport +47 -37
- data/vendor/{Box2D.framework → vendor-ios/Box2D.framework}/Versions/A/Box2D +0 -0
- data/vendor/{Box2D.framework → vendor-ios/Box2D.framework}/Versions/A/Headers/Collision/B2DContactListener.h +0 -0
- data/vendor/vendor-ios/Box2D.framework/Versions/A/Headers/Collision/Shapes/B2DCircleShape.h +16 -0
- data/vendor/{Box2D.framework → vendor-ios/Box2D.framework}/Versions/A/Headers/Collision/Shapes/B2DEdgeShape.h +0 -0
- data/vendor/{Box2D.framework → vendor-ios/Box2D.framework}/Versions/A/Headers/Collision/Shapes/B2DPolygonShape.h +0 -0
- data/vendor/{Box2D.framework → vendor-ios/Box2D.framework}/Versions/A/Headers/Collision/Shapes/B2DShape.h +0 -0
- data/vendor/{Box2D.framework → vendor-ios/Box2D.framework}/Versions/A/Headers/Dynamics/B2DBody.h +6 -6
- data/vendor/{Box2D.framework → vendor-ios/Box2D.framework}/Versions/A/Headers/Dynamics/B2DWorld.h +0 -0
- data/vendor/{Box2D.framework → vendor-ios/Box2D.framework}/Versions/A/Resources/Box2DConfig.cmake +0 -0
- data/vendor/{Box2D.framework → vendor-ios/Box2D.framework}/Versions/A/Resources/CMakeLists.txt +0 -0
- data/vendor/vendor-ios/Box2D.framework/Versions/A/Resources/LICENSE +22 -0
- data/vendor/vendor-ios/cocos_2d/cocos_2d.bridgesupport +9154 -0
- data/vendor/vendor-ios/cocos_2d/cocos_2d_exceptions.bridgesupport +39 -0
- data/vendor/{Cocos2D → vendor-ios/cocos_2d}/include/CCAction.h +23 -23
- data/vendor/{Cocos2D → vendor-ios/cocos_2d}/include/CCActionCamera.h +21 -19
- data/vendor/{Cocos2D → vendor-ios/cocos_2d}/include/CCActionCatmullRom.h +18 -6
- data/vendor/{Cocos2D → vendor-ios/cocos_2d}/include/CCActionEase.h +117 -31
- data/vendor/{Cocos2D → vendor-ios/cocos_2d}/include/CCActionGrid.h +19 -17
- data/vendor/{Cocos2D → vendor-ios/cocos_2d}/include/CCActionGrid3D.h +45 -42
- data/vendor/{Cocos2D → vendor-ios/cocos_2d}/include/CCActionInstant.h +21 -13
- data/vendor/{Cocos2D → vendor-ios/cocos_2d}/include/CCActionInterval.h +123 -81
- data/vendor/{Cocos2D → vendor-ios/cocos_2d}/include/CCActionManager.h +2 -2
- data/vendor/{Cocos2D → vendor-ios/cocos_2d}/include/CCActionPageTurn3D.h +2 -1
- data/vendor/{Cocos2D → vendor-ios/cocos_2d}/include/CCActionProgressTimer.h +4 -4
- data/vendor/{Cocos2D → vendor-ios/cocos_2d}/include/CCActionTiledGrid.h +46 -38
- data/vendor/{Cocos2D → vendor-ios/cocos_2d}/include/CCActionTween.h +3 -3
- data/vendor/{Cocos2D → vendor-ios/cocos_2d}/include/CCAnimation.h +8 -8
- data/vendor/{Cocos2D → vendor-ios/cocos_2d}/include/CCAnimationCache.h +2 -2
- data/vendor/{Cocos2D → vendor-ios/cocos_2d}/include/CCAtlasNode.h +19 -17
- data/vendor/{Cocos2D → vendor-ios/cocos_2d}/include/CCCamera.h +12 -12
- data/vendor/vendor-ios/cocos_2d/include/CCClippingNode.h +77 -0
- data/vendor/{Cocos2D → vendor-ios/cocos_2d}/include/CCConfiguration.h +31 -13
- data/vendor/{Cocos2D → vendor-ios/cocos_2d}/include/CCDirector.h +51 -42
- data/vendor/vendor-ios/cocos_2d/include/CCDrawNode.h +65 -0
- data/vendor/{Cocos2D → vendor-ios/cocos_2d}/include/CCDrawingPrimitives.h +42 -8
- data/vendor/{Cocos2D → vendor-ios/cocos_2d}/include/CCGLProgram.h +56 -21
- data/vendor/{Cocos2D → vendor-ios/cocos_2d}/include/CCGrabber.h +2 -2
- data/vendor/{Cocos2D → vendor-ios/cocos_2d}/include/CCGrid.h +29 -29
- data/vendor/{Cocos2D → vendor-ios/cocos_2d}/include/CCLabelAtlas.h +5 -2
- data/vendor/{Cocos2D → vendor-ios/cocos_2d}/include/CCLabelBMFont.h +56 -32
- data/vendor/{Cocos2D → vendor-ios/cocos_2d}/include/CCLabelTTF.h +20 -20
- data/vendor/{Cocos2D → vendor-ios/cocos_2d}/include/CCLayer.h +107 -79
- data/vendor/{Cocos2D → vendor-ios/cocos_2d}/include/CCMenu.h +10 -14
- data/vendor/{Cocos2D → vendor-ios/cocos_2d}/include/CCMenuItem.h +37 -32
- data/vendor/{Cocos2D → vendor-ios/cocos_2d}/include/CCMotionStreak.h +18 -19
- data/vendor/{Cocos2D → vendor-ios/cocos_2d}/include/CCNode+Debug.h +0 -0
- data/vendor/{Cocos2D → vendor-ios/cocos_2d}/include/CCNode.h +87 -37
- data/vendor/{Cocos2D → vendor-ios/cocos_2d}/include/CCParallaxNode.h +2 -2
- data/vendor/{Cocos2D → vendor-ios/cocos_2d}/include/CCParticleBatchNode.h +2 -2
- data/vendor/{Cocos2D → vendor-ios/cocos_2d}/include/CCParticleExamples.h +22 -0
- data/vendor/{Cocos2D → vendor-ios/cocos_2d}/include/CCParticleSystem.h +51 -40
- data/vendor/{Cocos2D → vendor-ios/cocos_2d}/include/CCParticleSystemQuad.h +4 -4
- data/vendor/vendor-ios/cocos_2d/include/CCPhysicsDebugNode.h +58 -0
- data/vendor/vendor-ios/cocos_2d/include/CCPhysicsSprite.h +82 -0
- data/vendor/{Cocos2D → vendor-ios/cocos_2d}/include/CCProgressTimer.h +9 -11
- data/vendor/{Cocos2D → vendor-ios/cocos_2d}/include/CCProtocols.h +54 -26
- data/vendor/{Cocos2D → vendor-ios/cocos_2d}/include/CCRenderTexture.h +29 -9
- data/vendor/{Cocos2D → vendor-ios/cocos_2d}/include/CCScene.h +4 -0
- data/vendor/{Cocos2D → vendor-ios/cocos_2d}/include/CCScheduler.h +94 -40
- data/vendor/{Cocos2D → vendor-ios/cocos_2d}/include/CCShaderCache.h +1 -1
- data/vendor/{Cocos2D → vendor-ios/cocos_2d}/include/CCSprite.h +21 -28
- data/vendor/{Cocos2D → vendor-ios/cocos_2d}/include/CCSpriteBatchNode.h +16 -9
- data/vendor/{Cocos2D → vendor-ios/cocos_2d}/include/CCSpriteFrame.h +10 -10
- data/vendor/{Cocos2D → vendor-ios/cocos_2d}/include/CCSpriteFrameCache.h +6 -6
- data/vendor/{Cocos2D → vendor-ios/cocos_2d}/include/CCTMXLayer.h +16 -16
- data/vendor/{Cocos2D → vendor-ios/cocos_2d}/include/CCTMXObjectGroup.h +4 -4
- data/vendor/{Cocos2D → vendor-ios/cocos_2d}/include/CCTMXTiledMap.h +9 -9
- data/vendor/{Cocos2D → vendor-ios/cocos_2d}/include/CCTMXXMLParser.h +44 -33
- data/vendor/{Cocos2D → vendor-ios/cocos_2d}/include/CCTexture2D.h +17 -25
- data/vendor/{Cocos2D → vendor-ios/cocos_2d}/include/CCTextureAtlas.h +10 -10
- data/vendor/{Cocos2D → vendor-ios/cocos_2d}/include/CCTextureCache.h +4 -4
- data/vendor/{Cocos2D → vendor-ios/cocos_2d}/include/CCTexturePVR.h +25 -8
- data/vendor/{Cocos2D → vendor-ios/cocos_2d}/include/CCTileMapAtlas.h +6 -6
- data/vendor/{Cocos2D → vendor-ios/cocos_2d}/include/CCTransition.h +57 -12
- data/vendor/{Cocos2D → vendor-ios/cocos_2d}/include/CCTransitionPageTurn.h +2 -2
- data/vendor/{Cocos2D → vendor-ios/cocos_2d}/include/CCTransitionProgress.h +27 -5
- data/vendor/{Cocos2D/include → vendor-ios/cocos_2d/include/Platforms}/CCGL.h +4 -2
- data/vendor/{Cocos2D/include → vendor-ios/cocos_2d/include/Platforms}/CCNS.h +0 -0
- data/vendor/vendor-ios/cocos_2d/include/Platforms/Mac/CCDirectorMac.h +110 -0
- data/vendor/vendor-ios/cocos_2d/include/Platforms/Mac/CCEventDispatcher.h +343 -0
- data/vendor/vendor-ios/cocos_2d/include/Platforms/Mac/CCGLView.h +103 -0
- data/vendor/vendor-ios/cocos_2d/include/Platforms/Mac/CCWindow.h +41 -0
- data/vendor/{Cocos2D/include → vendor-ios/cocos_2d/include/Platforms/iOS}/CCDirectorIOS.h +12 -5
- data/vendor/{Cocos2D/include → vendor-ios/cocos_2d/include/Platforms/iOS}/CCES2Renderer.h +12 -12
- data/vendor/{Cocos2D/include → vendor-ios/cocos_2d/include/Platforms/iOS}/CCESRenderer.h +0 -0
- data/vendor/{Cocos2D/include → vendor-ios/cocos_2d/include/Platforms/iOS}/CCGLView.h +28 -13
- data/vendor/{Cocos2D/include → vendor-ios/cocos_2d/include/Platforms/iOS}/CCTouchDelegateProtocol.h +4 -4
- data/vendor/{Cocos2D/include → vendor-ios/cocos_2d/include/Platforms/iOS}/CCTouchDispatcher.h +2 -2
- data/vendor/{Cocos2D/include → vendor-ios/cocos_2d/include/Platforms/iOS}/CCTouchHandler.h +7 -7
- data/vendor/{Cocos2D/include → vendor-ios/cocos_2d/include/Support}/CCArray.h +1 -1
- data/vendor/vendor-ios/cocos_2d/include/Support/CCFileUtils.h +394 -0
- data/vendor/{Cocos2D/include → vendor-ios/cocos_2d/include/Support}/CCProfiling.h +0 -0
- data/vendor/{Cocos2D/include → vendor-ios/cocos_2d/include/Support}/CCVertex.h +1 -1
- data/vendor/{Cocos2D/include → vendor-ios/cocos_2d/include/Support}/CGPointExtension.h +4 -2
- data/vendor/{Cocos2D/include → vendor-ios/cocos_2d/include/Support}/NSThread+performBlock.h +0 -0
- data/vendor/{Cocos2D/include → vendor-ios/cocos_2d/include/Support}/OpenGL_Internal.h +0 -0
- data/vendor/{Cocos2D/include → vendor-ios/cocos_2d/include/Support}/TGAlib.h +0 -0
- data/vendor/{Cocos2D/include → vendor-ios/cocos_2d/include/Support}/TransformUtils.h +0 -0
- data/vendor/{Cocos2D/include → vendor-ios/cocos_2d/include/Support}/ZipUtils.h +4 -4
- data/vendor/{Cocos2D/include → vendor-ios/cocos_2d/include/Support}/base64.h +0 -0
- data/vendor/{Cocos2D/include → vendor-ios/cocos_2d/include/Support}/ccCArray.h +15 -15
- data/vendor/{Cocos2D/include → vendor-ios/cocos_2d/include/Support}/ccUtils.h +0 -0
- data/vendor/{Cocos2D/include → vendor-ios/cocos_2d/include/Support}/uthash.h +129 -184
- data/vendor/{Cocos2D/include → vendor-ios/cocos_2d/include/Support}/utlist.h +298 -55
- data/vendor/{Cocos2D → vendor-ios/cocos_2d}/include/ccConfig.h +56 -9
- data/vendor/{Cocos2D → vendor-ios/cocos_2d}/include/ccDeprecated.h +131 -0
- data/vendor/vendor-ios/cocos_2d/include/ccFPSImages.h +39 -0
- data/vendor/{Cocos2D → vendor-ios/cocos_2d}/include/ccGLStateCache.h +44 -26
- data/vendor/{Cocos2D → vendor-ios/cocos_2d}/include/ccMacros.h +9 -9
- data/vendor/vendor-ios/cocos_2d/include/ccShader_PositionColorLengthTexture_frag.h +41 -0
- data/vendor/vendor-ios/cocos_2d/include/ccShader_PositionColorLengthTexture_vert.h +47 -0
- data/vendor/vendor-ios/cocos_2d/include/ccShader_PositionColor_frag.h +37 -0
- data/vendor/vendor-ios/cocos_2d/include/ccShader_PositionColor_vert.h +40 -0
- data/vendor/vendor-ios/cocos_2d/include/ccShader_PositionTextureA8Color_frag.h +41 -0
- data/vendor/vendor-ios/cocos_2d/include/ccShader_PositionTextureA8Color_vert.h +45 -0
- data/vendor/vendor-ios/cocos_2d/include/ccShader_PositionTextureColorAlphaTest_frag.h +47 -0
- data/vendor/vendor-ios/cocos_2d/include/ccShader_PositionTextureColor_frag.h +39 -0
- data/vendor/vendor-ios/cocos_2d/include/ccShader_PositionTextureColor_vert.h +45 -0
- data/vendor/vendor-ios/cocos_2d/include/ccShader_PositionTexture_frag.h +38 -0
- data/vendor/vendor-ios/cocos_2d/include/ccShader_PositionTexture_uColor_frag.h +41 -0
- data/vendor/vendor-ios/cocos_2d/include/ccShader_PositionTexture_uColor_vert.h +41 -0
- data/vendor/vendor-ios/cocos_2d/include/ccShader_PositionTexture_vert.h +41 -0
- data/vendor/vendor-ios/cocos_2d/include/ccShader_Position_uColor_frag.h +37 -0
- data/vendor/vendor-ios/cocos_2d/include/ccShader_Position_uColor_vert.h +43 -0
- data/vendor/{Cocos2D → vendor-ios/cocos_2d}/include/ccShaders.h +11 -0
- data/vendor/vendor-ios/cocos_2d/include/ccTypes.h +392 -0
- data/vendor/vendor-ios/cocos_2d/include/cocos2d-ios-exceptions.bridgesupport +39 -0
- data/vendor/{Cocos2D → vendor-ios/cocos_2d}/include/cocos2d.h +28 -3
- data/vendor/vendor-ios/cocos_2d/include/gen_cocos2d_bridgesupport.sh +17 -0
- data/vendor/vendor-ios/cocos_2d/include/gen_cocos2d_complement.sh +17 -0
- data/vendor/vendor-ios/cocos_2d/libcocos2d.a +0 -0
- data/vendor/vendor-osx/box_2d/box_2d.bridgesupport +176 -0
- data/vendor/vendor-osx/box_2d/include/B2DBody.h +46 -0
- data/vendor/vendor-osx/box_2d/include/B2DCircleShape.h +16 -0
- data/vendor/vendor-osx/box_2d/include/B2DContactListener.h +30 -0
- data/vendor/vendor-osx/box_2d/include/B2DEdgeShape.h +17 -0
- data/vendor/vendor-osx/box_2d/include/B2DPolygonShape.h +16 -0
- data/vendor/vendor-osx/box_2d/include/B2DShape.h +18 -0
- data/vendor/vendor-osx/box_2d/include/B2DWorld.h +44 -0
- data/vendor/vendor-osx/box_2d/libBox2D.a +0 -0
- data/vendor/vendor-osx/cocos_2d/cocos_2d.bridgesupport +8292 -0
- data/vendor/vendor-osx/cocos_2d/cocos_2d_include/CCAction.h +195 -0
- data/vendor/vendor-osx/cocos_2d/cocos_2d_include/CCActionCamera.h +75 -0
- data/vendor/vendor-osx/cocos_2d/cocos_2d_include/CCActionCatmullRom.h +151 -0
- data/vendor/vendor-osx/cocos_2d/cocos_2d_include/CCActionEase.h +245 -0
- data/vendor/vendor-osx/cocos_2d/cocos_2d_include/CCActionGrid.h +167 -0
- data/vendor/vendor-osx/cocos_2d/cocos_2d_include/CCActionGrid3D.h +208 -0
- data/vendor/vendor-osx/cocos_2d/cocos_2d_include/CCActionInstant.h +235 -0
- data/vendor/vendor-osx/cocos_2d/cocos_2d_include/CCActionInterval.h +473 -0
- data/vendor/vendor-osx/cocos_2d/cocos_2d_include/CCActionManager.h +113 -0
- data/vendor/vendor-osx/cocos_2d/cocos_2d_include/CCActionPageTurn3D.h +43 -0
- data/vendor/vendor-osx/cocos_2d/cocos_2d_include/CCActionProgressTimer.h +59 -0
- data/vendor/vendor-osx/cocos_2d/cocos_2d_include/CCActionTiledGrid.h +219 -0
- data/vendor/vendor-osx/cocos_2d/cocos_2d_include/CCActionTween.h +62 -0
- data/vendor/vendor-osx/cocos_2d/cocos_2d_include/CCAnimation.h +150 -0
- data/vendor/vendor-osx/cocos_2d/cocos_2d_include/CCAnimationCache.h +74 -0
- data/vendor/vendor-osx/cocos_2d/cocos_2d_include/CCAtlasNode.h +98 -0
- data/vendor/vendor-osx/cocos_2d/cocos_2d_include/CCCamera.h +98 -0
- data/vendor/vendor-osx/cocos_2d/cocos_2d_include/CCClippingNode.h +77 -0
- data/vendor/vendor-osx/cocos_2d/cocos_2d_include/CCConfiguration.h +144 -0
- data/vendor/vendor-osx/cocos_2d/cocos_2d_include/CCDirector.h +353 -0
- data/vendor/vendor-osx/cocos_2d/cocos_2d_include/CCDrawNode.h +65 -0
- data/vendor/vendor-osx/cocos_2d/cocos_2d_include/CCDrawingPrimitives.h +173 -0
- data/vendor/vendor-osx/cocos_2d/cocos_2d_include/CCGLProgram.h +185 -0
- data/vendor/vendor-osx/cocos_2d/cocos_2d_include/CCGrabber.h +44 -0
- data/vendor/vendor-osx/cocos_2d/cocos_2d_include/CCGrid.h +130 -0
- data/vendor/vendor-osx/cocos_2d/cocos_2d_include/CCLabelAtlas.h +71 -0
- data/vendor/vendor-osx/cocos_2d/cocos_2d_include/CCLabelBMFont.h +240 -0
- data/vendor/vendor-osx/cocos_2d/cocos_2d_include/CCLabelTTF.h +132 -0
- data/vendor/vendor-osx/cocos_2d/cocos_2d_include/CCLayer.h +308 -0
- data/vendor/vendor-osx/cocos_2d/cocos_2d_include/CCMenu.h +96 -0
- data/vendor/vendor-osx/cocos_2d/cocos_2d_include/CCMenuItem.h +428 -0
- data/vendor/vendor-osx/cocos_2d/cocos_2d_include/CCMotionStreak.h +86 -0
- data/vendor/vendor-osx/cocos_2d/cocos_2d_include/CCNode+Debug.h +39 -0
- data/vendor/vendor-osx/cocos_2d/cocos_2d_include/CCNode.h +619 -0
- data/vendor/vendor-osx/cocos_2d/cocos_2d_include/CCParallaxNode.h +50 -0
- data/vendor/vendor-osx/cocos_2d/cocos_2d_include/CCParticleBatchNode.h +99 -0
- data/vendor/vendor-osx/cocos_2d/cocos_2d_include/CCParticleExamples.h +117 -0
- data/vendor/vendor-osx/cocos_2d/cocos_2d_include/CCParticleSystem.h +464 -0
- data/vendor/vendor-osx/cocos_2d/cocos_2d_include/CCParticleSystemQuad.h +73 -0
- data/vendor/vendor-osx/cocos_2d/cocos_2d_include/CCPhysicsDebugNode.h +58 -0
- data/vendor/vendor-osx/cocos_2d/cocos_2d_include/CCPhysicsSprite.h +82 -0
- data/vendor/vendor-osx/cocos_2d/cocos_2d_include/CCProgressTimer.h +92 -0
- data/vendor/vendor-osx/cocos_2d/cocos_2d_include/CCProtocols.h +160 -0
- data/vendor/vendor-osx/cocos_2d/cocos_2d_include/CCRenderTexture.h +159 -0
- data/vendor/vendor-osx/cocos_2d/cocos_2d_include/CCScene.h +47 -0
- data/vendor/vendor-osx/cocos_2d/cocos_2d_include/CCScheduler.h +284 -0
- data/vendor/vendor-osx/cocos_2d/cocos_2d_include/CCShaderCache.h +60 -0
- data/vendor/vendor-osx/cocos_2d/cocos_2d_include/CCSprite.h +281 -0
- data/vendor/vendor-osx/cocos_2d/cocos_2d_include/CCSpriteBatchNode.h +145 -0
- data/vendor/vendor-osx/cocos_2d/cocos_2d_include/CCSpriteFrame.h +126 -0
- data/vendor/vendor-osx/cocos_2d/cocos_2d_include/CCSpriteFrameCache.h +121 -0
- data/vendor/vendor-osx/cocos_2d/cocos_2d_include/CCTMXLayer.h +164 -0
- data/vendor/vendor-osx/cocos_2d/cocos_2d_include/CCTMXObjectGroup.h +67 -0
- data/vendor/vendor-osx/cocos_2d/cocos_2d_include/CCTMXTiledMap.h +145 -0
- data/vendor/vendor-osx/cocos_2d/cocos_2d_include/CCTMXXMLParser.h +228 -0
- data/vendor/vendor-osx/cocos_2d/cocos_2d_include/CCTexture2D.h +349 -0
- data/vendor/vendor-osx/cocos_2d/cocos_2d_include/CCTextureAtlas.h +188 -0
- data/vendor/vendor-osx/cocos_2d/cocos_2d_include/CCTextureCache.h +146 -0
- data/vendor/vendor-osx/cocos_2d/cocos_2d_include/CCTexturePVR.h +146 -0
- data/vendor/vendor-osx/cocos_2d/cocos_2d_include/CCTileMapAtlas.h +83 -0
- data/vendor/vendor-osx/cocos_2d/cocos_2d_include/CCTransition.h +341 -0
- data/vendor/vendor-osx/cocos_2d/cocos_2d_include/CCTransitionPageTurn.h +60 -0
- data/vendor/vendor-osx/cocos_2d/cocos_2d_include/CCTransitionProgress.h +84 -0
- data/vendor/vendor-osx/cocos_2d/cocos_2d_include/Platforms/CCGL.h +74 -0
- data/vendor/vendor-osx/cocos_2d/cocos_2d_include/Platforms/CCNS.h +54 -0
- data/vendor/vendor-osx/cocos_2d/cocos_2d_include/Platforms/Mac/CCDirectorMac.h +110 -0
- data/vendor/vendor-osx/cocos_2d/cocos_2d_include/Platforms/Mac/CCEventDispatcher.h +343 -0
- data/vendor/vendor-osx/cocos_2d/cocos_2d_include/Platforms/Mac/CCGLView.h +103 -0
- data/vendor/vendor-osx/cocos_2d/cocos_2d_include/Platforms/Mac/CCWindow.h +41 -0
- data/vendor/vendor-osx/cocos_2d/cocos_2d_include/Support/CCArray.h +119 -0
- data/vendor/vendor-osx/cocos_2d/cocos_2d_include/Support/CCFileUtils.h +394 -0
- data/vendor/vendor-osx/cocos_2d/cocos_2d_include/Support/CCProfiling.h +89 -0
- data/vendor/vendor-osx/cocos_2d/cocos_2d_include/Support/CCVertex.h +36 -0
- data/vendor/vendor-osx/cocos_2d/cocos_2d_include/Support/CGPointExtension.h +346 -0
- data/vendor/vendor-osx/cocos_2d/cocos_2d_include/Support/NSThread+performBlock.h +22 -0
- data/vendor/vendor-osx/cocos_2d/cocos_2d_include/Support/OpenGL_Internal.h +86 -0
- data/vendor/vendor-osx/cocos_2d/cocos_2d_include/Support/TGAlib.h +55 -0
- data/vendor/vendor-osx/cocos_2d/cocos_2d_include/Support/TransformUtils.h +36 -0
- data/vendor/vendor-osx/cocos_2d/cocos_2d_include/Support/ZipUtils.h +91 -0
- data/vendor/vendor-osx/cocos_2d/cocos_2d_include/Support/base64.h +33 -0
- data/vendor/vendor-osx/cocos_2d/cocos_2d_include/Support/ccCArray.h +229 -0
- data/vendor/vendor-osx/cocos_2d/cocos_2d_include/Support/ccUtils.h +36 -0
- data/vendor/vendor-osx/cocos_2d/cocos_2d_include/Support/uthash.h +917 -0
- data/vendor/vendor-osx/cocos_2d/cocos_2d_include/Support/utlist.h +733 -0
- data/vendor/vendor-osx/cocos_2d/cocos_2d_include/ccConfig.h +292 -0
- data/vendor/vendor-osx/cocos_2d/cocos_2d_include/ccDeprecated.h +431 -0
- data/vendor/vendor-osx/cocos_2d/cocos_2d_include/ccFPSImages.h +39 -0
- data/vendor/vendor-osx/cocos_2d/cocos_2d_include/ccGLStateCache.h +156 -0
- data/vendor/vendor-osx/cocos_2d/cocos_2d_include/ccMacros.h +353 -0
- data/vendor/vendor-osx/cocos_2d/cocos_2d_include/ccShader_PositionColorLengthTexture_frag.h +41 -0
- data/vendor/vendor-osx/cocos_2d/cocos_2d_include/ccShader_PositionColorLengthTexture_vert.h +47 -0
- data/vendor/vendor-osx/cocos_2d/cocos_2d_include/ccShader_PositionColor_frag.h +37 -0
- data/vendor/vendor-osx/cocos_2d/cocos_2d_include/ccShader_PositionColor_vert.h +40 -0
- data/vendor/vendor-osx/cocos_2d/cocos_2d_include/ccShader_PositionTextureA8Color_frag.h +41 -0
- data/vendor/vendor-osx/cocos_2d/cocos_2d_include/ccShader_PositionTextureA8Color_vert.h +45 -0
- data/vendor/vendor-osx/cocos_2d/cocos_2d_include/ccShader_PositionTextureColorAlphaTest_frag.h +47 -0
- data/vendor/vendor-osx/cocos_2d/cocos_2d_include/ccShader_PositionTextureColor_frag.h +39 -0
- data/vendor/vendor-osx/cocos_2d/cocos_2d_include/ccShader_PositionTextureColor_vert.h +45 -0
- data/vendor/vendor-osx/cocos_2d/cocos_2d_include/ccShader_PositionTexture_frag.h +38 -0
- data/vendor/vendor-osx/cocos_2d/cocos_2d_include/ccShader_PositionTexture_uColor_frag.h +41 -0
- data/vendor/vendor-osx/cocos_2d/cocos_2d_include/ccShader_PositionTexture_uColor_vert.h +41 -0
- data/vendor/vendor-osx/cocos_2d/cocos_2d_include/ccShader_PositionTexture_vert.h +41 -0
- data/vendor/vendor-osx/cocos_2d/cocos_2d_include/ccShader_Position_uColor_frag.h +37 -0
- data/vendor/vendor-osx/cocos_2d/cocos_2d_include/ccShader_Position_uColor_vert.h +43 -0
- data/vendor/vendor-osx/cocos_2d/cocos_2d_include/ccShaders.h +56 -0
- data/vendor/{Cocos2D/include → vendor-osx/cocos_2d/cocos_2d_include}/ccTypes.h +39 -35
- data/vendor/vendor-osx/cocos_2d/cocos_2d_include/cocos2d.h +203 -0
- data/vendor/vendor-osx/cocos_2d/libcocos2d.a +0 -0
- metadata +363 -195
- data/app/layers/box2d_layer.rb +0 -109
- data/app/layers/cocos2d_layer.rb +0 -14
- data/app/layers/cocos_motion_layer.rb +0 -145
- data/app/layers/menu_layer.rb +0 -59
- data/lib/joybox/box2d/world.rb +0 -79
- data/resources/box2d/blocks_sprite_sheet.png +0 -0
- data/resources/cocos_motion/dot.png +0 -0
- data/resources/cocos_motion/dot_selected.png +0 -0
- data/resources/cocos_motion/grossini.png +0 -0
- data/resources/cocos_motion/grossinis_sister.png +0 -0
- data/resources/cocos_motion/grossinis_sister_two.png +0 -0
- data/resources/cocos_motion/left_arrow.png +0 -0
- data/resources/cocos_motion/left_arrow_selected.png +0 -0
- data/resources/cocos_motion/right_arrow.png +0 -0
- data/resources/cocos_motion/right_arrow_selected.png +0 -0
- data/vendor/Cocos2D/Cocos2D.bridgesupport +0 -7808
- data/vendor/Cocos2D/include/CCFileUtils.h +0 -188
- data/vendor/Cocos2D/include/CocosDenshion/CDAudioManager.h +0 -243
- data/vendor/Cocos2D/include/CocosDenshion/CDConfig.h +0 -60
- data/vendor/Cocos2D/include/CocosDenshion/CDOpenALSupport.h +0 -77
- data/vendor/Cocos2D/include/CocosDenshion/CDXPropertyModifierAction.h +0 -45
- data/vendor/Cocos2D/include/CocosDenshion/CocosDenshion.h +0 -440
- data/vendor/Cocos2D/include/CocosDenshion/SimpleAudioEngine.h +0 -90
- data/vendor/Cocos2D/include/RubyMotionSchedule.h +0 -7
- data/vendor/Cocos2D/include/ccShader_PositionColor_frag.h +0 -12
- data/vendor/Cocos2D/include/ccShader_PositionColor_vert.h +0 -17
- data/vendor/Cocos2D/include/ccShader_PositionTextureA8Color_frag.h +0 -16
- data/vendor/Cocos2D/include/ccShader_PositionTextureA8Color_vert.h +0 -21
- data/vendor/Cocos2D/include/ccShader_PositionTextureColorAlphaTest_frag.h +0 -23
- data/vendor/Cocos2D/include/ccShader_PositionTextureColor_frag.h +0 -14
- data/vendor/Cocos2D/include/ccShader_PositionTextureColor_vert.h +0 -22
- data/vendor/Cocos2D/include/ccShader_PositionTexture_frag.h +0 -13
- data/vendor/Cocos2D/include/ccShader_PositionTexture_uColor_frag.h +0 -16
- data/vendor/Cocos2D/include/ccShader_PositionTexture_uColor_vert.h +0 -18
- data/vendor/Cocos2D/include/ccShader_PositionTexture_vert.h +0 -17
- data/vendor/Cocos2D/include/ccShader_Position_uColor_frag.h +0 -12
- data/vendor/Cocos2D/include/ccShader_Position_uColor_vert.h +0 -19
- data/vendor/Cocos2D/include/kazmath/GL/mat4stack.h +0 -51
- data/vendor/Cocos2D/include/kazmath/GL/matrix.h +0 -58
- data/vendor/Cocos2D/include/kazmath/aabb.h +0 -53
- data/vendor/Cocos2D/include/kazmath/kazmath.h +0 -39
- data/vendor/Cocos2D/include/kazmath/mat3.h +0 -75
- data/vendor/Cocos2D/include/kazmath/mat4.h +0 -93
- data/vendor/Cocos2D/include/kazmath/neon_matrix_impl.h +0 -41
- data/vendor/Cocos2D/include/kazmath/plane.h +0 -70
- data/vendor/Cocos2D/include/kazmath/quaternion.h +0 -113
- data/vendor/Cocos2D/include/kazmath/ray2.h +0 -50
- data/vendor/Cocos2D/include/kazmath/utility.h +0 -74
- data/vendor/Cocos2D/include/kazmath/vec2.h +0 -64
- data/vendor/Cocos2D/include/kazmath/vec3.h +0 -68
- data/vendor/Cocos2D/include/kazmath/vec4.h +0 -68
- data/vendor/Cocos2D/libCocosDenshion.a +0 -0
- data/vendor/Cocos2D/libcocos2d.a +0 -0
@@ -0,0 +1,240 @@
|
|
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
|
+
* Portions of this code are based and inspired on:
|
26
|
+
* http://www.71squared.co.uk/2009/04/iphone-game-programming-tutorial-4-bitmap-font-class
|
27
|
+
* by Michael Daley
|
28
|
+
*
|
29
|
+
* Use any of these editors to generate BMFonts:
|
30
|
+
* http://glyphdesigner.71squared.com/ (Commercial, Mac OS X)
|
31
|
+
* http://www.n4te.com/hiero/hiero.jnlp (Free, Java)
|
32
|
+
* http://slick.cokeandcode.com/demos/hiero.jnlp (Free, Java)
|
33
|
+
* http://www.angelcode.com/products/bmfont/ (Free, Windows only)
|
34
|
+
*/
|
35
|
+
|
36
|
+
#import "CCSpriteBatchNode.h"
|
37
|
+
#import "Support/uthash.h"
|
38
|
+
|
39
|
+
enum {
|
40
|
+
kCCLabelAutomaticWidth = -1,
|
41
|
+
};
|
42
|
+
|
43
|
+
/** @struct ccBMFontDef
|
44
|
+
BMFont definition
|
45
|
+
*/
|
46
|
+
typedef struct _BMFontDef {
|
47
|
+
//! ID of the character
|
48
|
+
unichar charID;
|
49
|
+
//! origin and size of the font
|
50
|
+
CGRect rect;
|
51
|
+
//! The X amount the image should be offset when drawing the image (in pixels)
|
52
|
+
short xOffset;
|
53
|
+
//! The Y amount the image should be offset when drawing the image (in pixels)
|
54
|
+
short yOffset;
|
55
|
+
//! The amount to move the current position after drawing the character (in pixels)
|
56
|
+
short xAdvance;
|
57
|
+
} ccBMFontDef;
|
58
|
+
|
59
|
+
/** @struct ccBMFontPadding
|
60
|
+
BMFont padding
|
61
|
+
@since v0.8.2
|
62
|
+
*/
|
63
|
+
typedef struct _BMFontPadding {
|
64
|
+
/// padding left
|
65
|
+
int left;
|
66
|
+
/// padding top
|
67
|
+
int top;
|
68
|
+
/// padding right
|
69
|
+
int right;
|
70
|
+
/// padding bottom
|
71
|
+
int bottom;
|
72
|
+
} ccBMFontPadding;
|
73
|
+
|
74
|
+
#pragma mark - Hash Element
|
75
|
+
typedef struct _FontDefHashElement
|
76
|
+
{
|
77
|
+
NSUInteger key; // key. Font Unicode value
|
78
|
+
ccBMFontDef fontDef; // font definition
|
79
|
+
UT_hash_handle hh;
|
80
|
+
} tCCFontDefHashElement;
|
81
|
+
|
82
|
+
// Equal function for targetSet.
|
83
|
+
typedef struct _KerningHashElement
|
84
|
+
{
|
85
|
+
int key; // key for the hash. 16-bit for 1st element, 16-bit for 2nd element
|
86
|
+
int amount;
|
87
|
+
UT_hash_handle hh;
|
88
|
+
} tCCKerningHashElement;
|
89
|
+
#pragma mark -
|
90
|
+
|
91
|
+
/** CCBMFontConfiguration has parsed configuration of the the .fnt file
|
92
|
+
@since v0.8
|
93
|
+
*/
|
94
|
+
@interface CCBMFontConfiguration : NSObject
|
95
|
+
{
|
96
|
+
// Character Set defines the letters that actually exist in the font
|
97
|
+
NSCharacterSet *_characterSet;
|
98
|
+
|
99
|
+
// atlas name
|
100
|
+
NSString *_atlasName;
|
101
|
+
|
102
|
+
// XXX: Creating a public interface so that the bitmapFontArray[] is accessible
|
103
|
+
@public
|
104
|
+
|
105
|
+
// BMFont definitions
|
106
|
+
tCCFontDefHashElement *_fontDefDictionary;
|
107
|
+
|
108
|
+
// FNTConfig: Common Height. Should be signed (issue #1343)
|
109
|
+
NSInteger _commonHeight;
|
110
|
+
|
111
|
+
// Padding
|
112
|
+
ccBMFontPadding _padding;
|
113
|
+
|
114
|
+
// values for kerning
|
115
|
+
tCCKerningHashElement *_kerningDictionary;
|
116
|
+
}
|
117
|
+
|
118
|
+
// Character set
|
119
|
+
@property (nonatomic, retain, readonly) NSCharacterSet *characterSet;
|
120
|
+
|
121
|
+
// atlasName
|
122
|
+
@property (nonatomic, readwrite, retain) NSString *atlasName;
|
123
|
+
|
124
|
+
/** allocates a CCBMFontConfiguration with a FNT file */
|
125
|
+
+(id) configurationWithFNTFile:(NSString*)FNTfile;
|
126
|
+
/** initializes a CCBMFontConfiguration with a FNT file */
|
127
|
+
-(id) initWithFNTfile:(NSString*)FNTfile;
|
128
|
+
@end
|
129
|
+
|
130
|
+
|
131
|
+
/** CCLabelBMFont is a subclass of CCSpriteBatchNode
|
132
|
+
|
133
|
+
Features:
|
134
|
+
- Treats each character like a CCSprite. This means that each individual character can be:
|
135
|
+
- rotated
|
136
|
+
- scaled
|
137
|
+
- translated
|
138
|
+
- tinted
|
139
|
+
- chage the opacity
|
140
|
+
- It can be used as part of a menu item.
|
141
|
+
- anchorPoint can be used to align the "label"
|
142
|
+
- Supports AngelCode text format
|
143
|
+
|
144
|
+
Limitations:
|
145
|
+
- All inner characters are using an anchorPoint of (0.5f, 0.5f) and it is not recommend to change it
|
146
|
+
because it might affect the rendering
|
147
|
+
|
148
|
+
CCLabelBMFont implements the protocol CCLabelProtocol, like CCLabel and CCLabelAtlas.
|
149
|
+
CCLabelBMFont has the flexibility of CCLabel, the speed of CCLabelAtlas and all the features of CCSprite.
|
150
|
+
If in doubt, use CCLabelBMFont instead of CCLabelAtlas / CCLabel.
|
151
|
+
|
152
|
+
Supported editors:
|
153
|
+
- http://glyphdesigner.71squared.com/
|
154
|
+
- http://www.bmglyph.com/
|
155
|
+
- http://www.n4te.com/hiero/hiero.jnlp
|
156
|
+
- http://slick.cokeandcode.com/demos/hiero.jnlp
|
157
|
+
- http://www.angelcode.com/products/bmfont/
|
158
|
+
|
159
|
+
@since v0.8
|
160
|
+
*/
|
161
|
+
|
162
|
+
@interface CCLabelBMFont : CCSpriteBatchNode <CCLabelProtocol, CCRGBAProtocol>
|
163
|
+
{
|
164
|
+
// string to render
|
165
|
+
NSString *_string;
|
166
|
+
|
167
|
+
// name of fntFile
|
168
|
+
NSString *_fntFile;
|
169
|
+
|
170
|
+
// initial string without line breaks
|
171
|
+
NSString *_initialString;
|
172
|
+
// max width until a line break is added
|
173
|
+
float _width;
|
174
|
+
// alignment of all lines
|
175
|
+
CCTextAlignment _alignment;
|
176
|
+
|
177
|
+
CCBMFontConfiguration *_configuration;
|
178
|
+
|
179
|
+
// texture RGBA
|
180
|
+
GLubyte _displayedOpacity, _realOpacity;
|
181
|
+
ccColor3B _displayedColor, _realColor;
|
182
|
+
BOOL _cascadeOpacityEnabled, _cascadeColorEnabled;
|
183
|
+
BOOL _opacityModifyRGB;
|
184
|
+
|
185
|
+
// offset of the texture atlas
|
186
|
+
CGPoint _imageOffset;
|
187
|
+
|
188
|
+
// reused char
|
189
|
+
CCSprite *_reusedChar;
|
190
|
+
}
|
191
|
+
|
192
|
+
/** Purges the cached data.
|
193
|
+
Removes from memory the cached configurations and the atlas name dictionary.
|
194
|
+
@since v0.99.3
|
195
|
+
*/
|
196
|
+
+(void) purgeCachedData;
|
197
|
+
|
198
|
+
/** alignment used for the label */
|
199
|
+
@property (nonatomic,assign,readonly) CCTextAlignment alignment;
|
200
|
+
/** fntFile used for the font */
|
201
|
+
@property (nonatomic,retain) NSString* fntFile;
|
202
|
+
/** conforms to CCRGBAProtocol protocol */
|
203
|
+
@property (nonatomic,readwrite) GLubyte opacity;
|
204
|
+
/** conforms to CCRGBAProtocol protocol */
|
205
|
+
@property (nonatomic,readwrite) ccColor3B color;
|
206
|
+
|
207
|
+
|
208
|
+
/** creates a BMFont label with an initial string and the FNT file. */
|
209
|
+
+(id) labelWithString:(NSString*)string fntFile:(NSString*)fntFile;
|
210
|
+
/** creates a BMFont label with an initial string, the FNT file, width, and alignment option */
|
211
|
+
+(id) labelWithString:(NSString*)string fntFile:(NSString*)fntFile width:(float)width alignment:(CCTextAlignment)alignment;
|
212
|
+
/** creates a BMFont label with an initial string, the FNT file, width, alignment option and the offset of where the glyphs start on the .PNG image */
|
213
|
+
+(id) labelWithString:(NSString*)string fntFile:(NSString*)fntFile width:(float)width alignment:(CCTextAlignment)alignment imageOffset:(CGPoint)offset;
|
214
|
+
|
215
|
+
/** init a BMFont label with an initial string and the FNT file */
|
216
|
+
-(id) initWithString:(NSString*)string fntFile:(NSString*)fntFile;
|
217
|
+
/** init a BMFont label with an initial string and the FNT file, width, and alignment option*/
|
218
|
+
-(id) initWithString:(NSString*)string fntFile:(NSString*)fntFile width:(float)width alignment:(CCTextAlignment)alignment;
|
219
|
+
/** init a BMFont label with an initial string and the FNT file, width, alignment option and the offset of where the glyphs start on the .PNG image */
|
220
|
+
-(id) initWithString:(NSString*)string fntFile:(NSString*)fntFile width:(float)width alignment:(CCTextAlignment)alignment imageOffset:(CGPoint)offset;
|
221
|
+
|
222
|
+
/** updates the font chars based on the string to render */
|
223
|
+
-(void) createFontChars;
|
224
|
+
|
225
|
+
/** set label width */
|
226
|
+
- (void)setWidth:(float)width;
|
227
|
+
|
228
|
+
/** set label alignment */
|
229
|
+
- (void)setAlignment:(CCTextAlignment)alignment;
|
230
|
+
|
231
|
+
@end
|
232
|
+
|
233
|
+
/** Free function that parses a FNT file a place it on the cache
|
234
|
+
*/
|
235
|
+
CCBMFontConfiguration * FNTConfigLoadFile( NSString *file );
|
236
|
+
/** Purges the FNT config cache
|
237
|
+
*/
|
238
|
+
void FNTConfigRemoveCache( void );
|
239
|
+
|
240
|
+
|
@@ -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
|
+
|
27
|
+
|
28
|
+
#import "CCTexture2D.h"
|
29
|
+
#import "CCSprite.h"
|
30
|
+
#import "Platforms/CCNS.h"
|
31
|
+
|
32
|
+
|
33
|
+
/** CCLabel is a subclass of CCTextureNode that knows how to render text labels
|
34
|
+
*
|
35
|
+
* All features from CCTextureNode are valid in CCLabel
|
36
|
+
*
|
37
|
+
* CCLabel objects are slow. Consider using CCLabelAtlas or CCLabelBMFont instead.
|
38
|
+
*/
|
39
|
+
|
40
|
+
@interface CCLabelTTF : CCSprite <CCLabelProtocol>
|
41
|
+
{
|
42
|
+
CGSize _dimensions;
|
43
|
+
CCTextAlignment _hAlignment;
|
44
|
+
CCVerticalTextAlignment _vAlignment;
|
45
|
+
NSString * _fontName;
|
46
|
+
CGFloat _fontSize;
|
47
|
+
CCLineBreakMode _lineBreakMode;
|
48
|
+
NSString *_string;
|
49
|
+
}
|
50
|
+
|
51
|
+
/** Font name used in the label */
|
52
|
+
@property (nonatomic,retain) NSString* fontName;
|
53
|
+
/** Font size of the label */
|
54
|
+
@property (nonatomic,assign) float fontSize;
|
55
|
+
/** Dimensions of the label in Points */
|
56
|
+
@property (nonatomic,assign) CGSize dimensions;
|
57
|
+
/** The alignment of the label */
|
58
|
+
@property (nonatomic,assign) CCTextAlignment horizontalAlignment;
|
59
|
+
/** The vertical alignment of the label */
|
60
|
+
@property (nonatomic,assign) CCVerticalTextAlignment verticalAlignment;
|
61
|
+
|
62
|
+
|
63
|
+
/** creates a CCLabelTTF with a font name and font size in points*/
|
64
|
+
+ (id) labelWithString:(NSString*)string fontName:(NSString*)name fontSize:(CGFloat)size;
|
65
|
+
|
66
|
+
/** creates a CCLabelTTF from a fontname, horizontal alignment, dimension in points, and font size in points.
|
67
|
+
Supported lineBreakModes:
|
68
|
+
- iOS: all UILineBreakMode supported modes
|
69
|
+
- Mac: Only NSLineBreakByWordWrapping is supported.
|
70
|
+
@since v1.0
|
71
|
+
*/
|
72
|
+
+ (id) labelWithString:(NSString*)string fontName:(NSString*)name fontSize:(CGFloat)size dimensions:(CGSize)dimensions hAlignment:(CCTextAlignment)alignment;
|
73
|
+
|
74
|
+
/** creates a CCLabelTTF from a fontname, horizontal alignment, dimension in points, line break mode, and font size in points.
|
75
|
+
Supported lineBreakModes:
|
76
|
+
- iOS: all UILineBreakMode supported modes
|
77
|
+
- Mac: Only NSLineBreakByWordWrapping is supported.
|
78
|
+
@since v1.0
|
79
|
+
*/
|
80
|
+
+ (id) labelWithString:(NSString*)string fontName:(NSString*)name fontSize:(CGFloat)size dimensions:(CGSize)dimensions hAlignment:(CCTextAlignment)alignment lineBreakMode:(CCLineBreakMode)lineBreakMode;
|
81
|
+
|
82
|
+
/** creates a CCLabelTTF from a fontname, horizontal alignment, vertical alignment, dimension in points, line break mode, and font size in points.
|
83
|
+
Supported lineBreakModes:
|
84
|
+
- iOS: all UILineBreakMode supported modes
|
85
|
+
- Mac: Only NSLineBreakByWordWrapping is supported.
|
86
|
+
@since v1.0
|
87
|
+
*/
|
88
|
+
+ (id) labelWithString:(NSString*)string fontName:(NSString*)name fontSize:(CGFloat)size dimensions:(CGSize)dimensions hAlignment:(CCTextAlignment)alignment vAlignment:(CCVerticalTextAlignment)vertAlignment lineBreakMode:(CCLineBreakMode)lineBreakMode ;
|
89
|
+
|
90
|
+
/** creates a CCLabel from a fontname, alignment, dimension in points and font size in points*/
|
91
|
+
+ (id) labelWithString:(NSString*)string fontName:(NSString*)name fontSize:(CGFloat)size dimensions:(CGSize)dimensions hAlignment:(CCTextAlignment)alignment vAlignment:(CCVerticalTextAlignment)vertAlignment;
|
92
|
+
|
93
|
+
|
94
|
+
/** initializes the CCLabelTTF with a font name and font size in points */
|
95
|
+
- (id) initWithString:(NSString*)string fontName:(NSString*)name fontSize:(CGFloat)size;
|
96
|
+
|
97
|
+
/** initializes the CCLabelTTF with a font name, horizontal alignment, dimension in points, and font size in points.
|
98
|
+
Default verticalAlignment: kCCVerticalTextAlignmentTop
|
99
|
+
Default lineBreakMode: CCLineBreakModeWordWrap
|
100
|
+
@since v1.0
|
101
|
+
*/
|
102
|
+
- (id) initWithString:(NSString*)string fontName:(NSString*)name fontSize:(CGFloat)size dimensions:(CGSize)dimensions hAlignment:(CCTextAlignment)alignment;
|
103
|
+
|
104
|
+
/** initializes the CCLabelTTF with a font name, horizontal alignment, dimension in points, line break mode and font size in points.
|
105
|
+
Default verticalAlignment: kCCVerticalTextAlignmentTop
|
106
|
+
|
107
|
+
Supported lineBreakModes:
|
108
|
+
- iOS: all UILineBreakMode supported modes
|
109
|
+
- Mac: Only NSLineBreakByWordWrapping is supported.
|
110
|
+
@since v1.0
|
111
|
+
*/
|
112
|
+
- (id) initWithString:(NSString*)str fontName:(NSString*)name fontSize:(CGFloat)size dimensions:(CGSize)dimensions hAlignment:(CCTextAlignment)alignment lineBreakMode:(CCLineBreakMode)lineBreakMode;
|
113
|
+
|
114
|
+
/** initializes the CCLabelTTF with a font name, horizontal alignment, vertical alignment, dimension in points and font size in points.
|
115
|
+
Default lineBreakMode: CCLineBreakModeWordWrap
|
116
|
+
*/
|
117
|
+
- (id) initWithString:(NSString*)string fontName:(NSString*)name fontSize:(CGFloat)size dimensions:(CGSize)dimensions hAlignment:(CCTextAlignment)alignment vAlignment:(CCVerticalTextAlignment)vertAlignment;
|
118
|
+
|
119
|
+
/** initializes the CCLabelTTF with a font name, horizontal alignment, vertical alignment, dimension in points, line break mode and font size in points.
|
120
|
+
Supported lineBreakModes:
|
121
|
+
- iOS: all UILineBreakMode supported modes
|
122
|
+
- Mac: Only NSLineBreakByWordWrapping is supported.
|
123
|
+
@since v2.0
|
124
|
+
*/
|
125
|
+
- (id) initWithString:(NSString*)str fontName:(NSString*)name fontSize:(CGFloat)size dimensions:(CGSize)dimensions hAlignment:(CCTextAlignment)alignment vAlignment:(CCVerticalTextAlignment)vAlignment lineBreakMode:(CCLineBreakMode)lineBreakMode ;
|
126
|
+
|
127
|
+
/** changes the string to render
|
128
|
+
* @warning Changing the string is as expensive as creating a new CCLabelTTF. To obtain better performance use CCLabelAtlas or CCLabelBMFont.
|
129
|
+
*/
|
130
|
+
- (void) setString:(NSString*)str;
|
131
|
+
|
132
|
+
@end
|
@@ -0,0 +1,308 @@
|
|
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
|
+
|
29
|
+
#import "ccMacros.h"
|
30
|
+
|
31
|
+
#ifdef __CC_PLATFORM_IOS
|
32
|
+
#import <UIKit/UIKit.h> // Needed for UIAccelerometerDelegate
|
33
|
+
#import "Platforms/iOS/CCTouchDelegateProtocol.h" // Touches only supported on iOS
|
34
|
+
#elif defined(__CC_PLATFORM_MAC)
|
35
|
+
#import "Platforms/Mac/CCEventDispatcher.h"
|
36
|
+
#endif
|
37
|
+
|
38
|
+
#import "CCProtocols.h"
|
39
|
+
#import "CCNode.h"
|
40
|
+
|
41
|
+
#pragma mark - CCLayer
|
42
|
+
|
43
|
+
typedef enum {
|
44
|
+
kCCTouchesAllAtOnce,
|
45
|
+
kCCTouchesOneByOne,
|
46
|
+
} ccTouchesMode;
|
47
|
+
|
48
|
+
/** CCLayer is a subclass of CCNode that implements the CCTouchEventsDelegate protocol.
|
49
|
+
|
50
|
+
All features from CCNode are valid, plus the following new features:
|
51
|
+
- It can receive Touches both on iOS and Mac
|
52
|
+
- It can receive Accelerometer input on iOS
|
53
|
+
- It can receive Keyboard events on Mac
|
54
|
+
- It can receive Mouse events on Mac
|
55
|
+
*/
|
56
|
+
#ifdef __CC_PLATFORM_IOS
|
57
|
+
@interface CCLayer : CCNode <CCAccelerometerDelegate, CCTouchAllAtOnceDelegate, CCTouchOneByOneDelegate>
|
58
|
+
{
|
59
|
+
BOOL _touchEnabled;
|
60
|
+
NSInteger _touchPriority;
|
61
|
+
BOOL _touchMode;
|
62
|
+
BOOL _touchSwallow;
|
63
|
+
|
64
|
+
BOOL _accelerometerEnabled;
|
65
|
+
}
|
66
|
+
|
67
|
+
/** whether or not it will receive Accelerometer events
|
68
|
+
You can enable / disable accelerometer events with this property.
|
69
|
+
|
70
|
+
Valid only on iOS. Not valid on Mac.
|
71
|
+
|
72
|
+
@since v0.8.1
|
73
|
+
*/
|
74
|
+
@property(nonatomic, assign, getter = isAccelerometerEnabled) BOOL accelerometerEnabled;
|
75
|
+
|
76
|
+
/** whether or not it will receive Touch events
|
77
|
+
@since v0.8.1
|
78
|
+
*/
|
79
|
+
@property(nonatomic, assign, getter = isTouchEnabled) BOOL touchEnabled;
|
80
|
+
/** priority of the touch events. Default is 0 */
|
81
|
+
@property(nonatomic, assign) NSInteger touchPriority;
|
82
|
+
/** Touch modes.
|
83
|
+
- kCCTouchesAllAtOnce: Receives all the available touches at once.
|
84
|
+
- kCCTouchesOneByOne: Receives one touch at the time.
|
85
|
+
*/
|
86
|
+
@property(nonatomic, assign) ccTouchesMode touchMode;
|
87
|
+
|
88
|
+
/** whether touch events are swallowed (in kCCTouchesOneByOne mode) */
|
89
|
+
@property(nonatomic, assign) BOOL touchSwallow;
|
90
|
+
|
91
|
+
/** sets the accelerometer's update frequency. A value of 1/2 means that the callback is going to be called twice per second.
|
92
|
+
@since v2.1
|
93
|
+
*/
|
94
|
+
-(void) setAccelerometerInterval:(float)interval;
|
95
|
+
|
96
|
+
|
97
|
+
#elif defined(__CC_PLATFORM_MAC)
|
98
|
+
|
99
|
+
|
100
|
+
@interface CCLayer : CCNode <CCKeyboardEventDelegate, CCMouseEventDelegate, CCTouchEventDelegate, CCGestureEventDelegate>
|
101
|
+
{
|
102
|
+
BOOL _mouseEnabled;
|
103
|
+
NSInteger _mousePriority;
|
104
|
+
|
105
|
+
BOOL _keyboardEnabled;
|
106
|
+
NSInteger _keyboardPriority;
|
107
|
+
|
108
|
+
BOOL _touchEnabled;
|
109
|
+
NSInteger _touchPriority;
|
110
|
+
NSInteger _touchMode;
|
111
|
+
BOOL _touchSwallow;
|
112
|
+
|
113
|
+
BOOL _gestureEnabled;
|
114
|
+
NSInteger _gesturePriority;
|
115
|
+
}
|
116
|
+
|
117
|
+
/** whether or not it will receive touche events. */
|
118
|
+
@property (nonatomic, readwrite, getter=isTouchEnabled) BOOL touchEnabled;
|
119
|
+
/** priority of the touch events. Default is 0 */
|
120
|
+
@property(nonatomic, assign) NSInteger touchPriority;
|
121
|
+
|
122
|
+
/** whether or not it will receive gesture events. */
|
123
|
+
@property (nonatomic, readwrite, getter=isGestureEnabled) BOOL gestureEnabled;
|
124
|
+
/** priority of the gesture events. Default is 0 */
|
125
|
+
@property(nonatomic, assign) NSInteger gesturePriority;
|
126
|
+
|
127
|
+
|
128
|
+
/** whether or not it will receive mouse events.
|
129
|
+
|
130
|
+
Valid only on OS X. Not valid on iOS
|
131
|
+
*/
|
132
|
+
@property (nonatomic, readwrite, getter=isMouseEnabled) BOOL mouseEnabled;
|
133
|
+
/** priority of the mouse events. Default is 0 */
|
134
|
+
@property (nonatomic, assign) NSInteger mousePriority;
|
135
|
+
|
136
|
+
/** whether or not it will receive keyboard events.
|
137
|
+
|
138
|
+
Valid only on OS X. Not valid on iOS
|
139
|
+
*/
|
140
|
+
@property (nonatomic, readwrite, getter = isKeyboardEnabled) BOOL keyboardEnabled;
|
141
|
+
/** Priority of keyboard events. Default is 0 */
|
142
|
+
@property (nonatomic, assign) NSInteger keyboardPriority;
|
143
|
+
|
144
|
+
#endif // mac
|
145
|
+
|
146
|
+
@end
|
147
|
+
|
148
|
+
|
149
|
+
#pragma mark -
|
150
|
+
#pragma mark CCLayerRGBA
|
151
|
+
|
152
|
+
/** CCLayerRGBA is a subclass of CCLayer that implements the CCRGBAProtocol protocol using a solid color as the background.
|
153
|
+
|
154
|
+
All features from CCLayer are valid, plus the following new features that propagate into children that conform to the CCRGBAProtocol:
|
155
|
+
- opacity
|
156
|
+
- RGB colors
|
157
|
+
@since 2.1
|
158
|
+
*/
|
159
|
+
@interface CCLayerRGBA : CCLayer <CCRGBAProtocol>
|
160
|
+
{
|
161
|
+
GLubyte _displayedOpacity, _realOpacity;
|
162
|
+
ccColor3B _displayedColor, _realColor;
|
163
|
+
BOOL _cascadeOpacityEnabled, _cascadeColorEnabled;
|
164
|
+
}
|
165
|
+
|
166
|
+
// XXX: To make BridgeSupport happy
|
167
|
+
-(GLubyte) opacity;
|
168
|
+
@end
|
169
|
+
|
170
|
+
|
171
|
+
|
172
|
+
#pragma mark -
|
173
|
+
#pragma mark CCLayerColor
|
174
|
+
|
175
|
+
/** CCLayerColor is a subclass of CCLayer that implements the CCRGBAProtocol protocol.
|
176
|
+
|
177
|
+
All features from CCLayer are valid, plus the following new features:
|
178
|
+
- opacity
|
179
|
+
- RGB colors
|
180
|
+
*/
|
181
|
+
@interface CCLayerColor : CCLayerRGBA <CCBlendProtocol>
|
182
|
+
{
|
183
|
+
ccVertex2F _squareVertices[4];
|
184
|
+
ccColor4F _squareColors[4];
|
185
|
+
|
186
|
+
ccBlendFunc _blendFunc;
|
187
|
+
}
|
188
|
+
|
189
|
+
/** creates a CCLayer with color, width and height in Points*/
|
190
|
+
+ (id) layerWithColor: (ccColor4B)color width:(GLfloat)w height:(GLfloat)h;
|
191
|
+
/** creates a CCLayer with color. Width and height are the window size. */
|
192
|
+
+ (id) layerWithColor: (ccColor4B)color;
|
193
|
+
|
194
|
+
/** initializes a CCLayer with color, width and height in Points.
|
195
|
+
This is the designated initializer.
|
196
|
+
*/
|
197
|
+
- (id) initWithColor:(ccColor4B)color width:(GLfloat)w height:(GLfloat)h;
|
198
|
+
/** initializes a CCLayer with color. Width and height are the window size. */
|
199
|
+
- (id) initWithColor:(ccColor4B)color;
|
200
|
+
|
201
|
+
/** change width in Points */
|
202
|
+
-(void) changeWidth: (GLfloat)w;
|
203
|
+
/** change height in Points */
|
204
|
+
-(void) changeHeight: (GLfloat)h;
|
205
|
+
/** change width and height in Points
|
206
|
+
@since v0.8
|
207
|
+
*/
|
208
|
+
-(void) changeWidth:(GLfloat)w height:(GLfloat)h;
|
209
|
+
|
210
|
+
/** BlendFunction. Conforms to CCBlendProtocol protocol */
|
211
|
+
@property (nonatomic,readwrite) ccBlendFunc blendFunc;
|
212
|
+
@end
|
213
|
+
|
214
|
+
#pragma mark -
|
215
|
+
#pragma mark CCLayerGradient
|
216
|
+
|
217
|
+
/** CCLayerGradient is a subclass of CCLayerColor that draws gradients across
|
218
|
+
the background.
|
219
|
+
|
220
|
+
All features from CCLayerColor are valid, plus the following new features:
|
221
|
+
- direction
|
222
|
+
- final color
|
223
|
+
- interpolation mode
|
224
|
+
|
225
|
+
Color is interpolated between the startColor and endColor along the given
|
226
|
+
vector (starting at the origin, ending at the terminus). If no vector is
|
227
|
+
supplied, it defaults to (0, -1) -- a fade from top to bottom.
|
228
|
+
|
229
|
+
If 'compressedInterpolation' is disabled, you will not see either the start or end color for
|
230
|
+
non-cardinal vectors; a smooth gradient implying both end points will be still
|
231
|
+
be drawn, however.
|
232
|
+
|
233
|
+
If ' compressedInterpolation' is enabled (default mode) you will see both the start and end colors of the gradient.
|
234
|
+
|
235
|
+
@since v0.99.5
|
236
|
+
*/
|
237
|
+
@interface CCLayerGradient : CCLayerColor
|
238
|
+
{
|
239
|
+
ccColor3B _endColor;
|
240
|
+
GLubyte _startOpacity;
|
241
|
+
GLubyte _endOpacity;
|
242
|
+
CGPoint _vector;
|
243
|
+
BOOL _compressedInterpolation;
|
244
|
+
}
|
245
|
+
|
246
|
+
/** Creates a full-screen CCLayer with a gradient between start and end. */
|
247
|
+
+ (id) layerWithColor: (ccColor4B) start fadingTo: (ccColor4B) end;
|
248
|
+
/** Creates a full-screen CCLayer with a gradient between start and end in the direction of v. */
|
249
|
+
+ (id) layerWithColor: (ccColor4B) start fadingTo: (ccColor4B) end alongVector: (CGPoint) v;
|
250
|
+
|
251
|
+
/** Initializes the CCLayer with a gradient between start and end. */
|
252
|
+
- (id) initWithColor: (ccColor4B) start fadingTo: (ccColor4B) end;
|
253
|
+
/** Initializes the CCLayer with a gradient between start and end in the direction of v. */
|
254
|
+
- (id) initWithColor: (ccColor4B) start fadingTo: (ccColor4B) end alongVector: (CGPoint) v;
|
255
|
+
|
256
|
+
/** The starting color. */
|
257
|
+
@property (nonatomic, readwrite) ccColor3B startColor;
|
258
|
+
/** The ending color. */
|
259
|
+
@property (nonatomic, readwrite) ccColor3B endColor;
|
260
|
+
/** The starting opacity. */
|
261
|
+
@property (nonatomic, readwrite) GLubyte startOpacity;
|
262
|
+
/** The ending color. */
|
263
|
+
@property (nonatomic, readwrite) GLubyte endOpacity;
|
264
|
+
/** The vector along which to fade color. */
|
265
|
+
@property (nonatomic, readwrite) CGPoint vector;
|
266
|
+
/** Whether or not the interpolation will be compressed in order to display all the colors of the gradient both in canonical and non canonical vectors
|
267
|
+
Default: YES
|
268
|
+
*/
|
269
|
+
@property (nonatomic, readwrite) BOOL compressedInterpolation;
|
270
|
+
|
271
|
+
@end
|
272
|
+
|
273
|
+
#pragma mark -
|
274
|
+
#pragma mark CCLayerMultiplex
|
275
|
+
|
276
|
+
/** CCLayerMultiplex is a CCLayer with the ability to multiplex its children.
|
277
|
+
Features:
|
278
|
+
- It supports one or more children
|
279
|
+
- Only one children will be active a time
|
280
|
+
*/
|
281
|
+
@interface CCLayerMultiplex : CCLayer
|
282
|
+
{
|
283
|
+
unsigned int _enabledLayer;
|
284
|
+
NSMutableArray *_layers;
|
285
|
+
}
|
286
|
+
|
287
|
+
/** creates a CCMultiplexLayer with an array of layers.
|
288
|
+
@since v2.1
|
289
|
+
*/
|
290
|
+
+(id) layerWithArray:(NSArray*)arrayOfLayers;
|
291
|
+
/** creates a CCMultiplexLayer with one or more layers using a variable argument list. */
|
292
|
+
+(id) layerWithLayers: (CCLayer*) layer, ... NS_REQUIRES_NIL_TERMINATION;
|
293
|
+
/** initializes a CCMultiplexLayer with an array of layers
|
294
|
+
@since v2.1
|
295
|
+
*/
|
296
|
+
-(id) initWithArray:(NSArray*)arrayOfLayers;
|
297
|
+
/** initializes a MultiplexLayer with one or more layers using a variable argument list. */
|
298
|
+
-(id) initWithLayers: (CCLayer*) layer vaList:(va_list) params;
|
299
|
+
/** switches to a certain layer indexed by n.
|
300
|
+
The current (old) layer will be removed from its parent with 'cleanup:YES'.
|
301
|
+
*/
|
302
|
+
-(void) switchTo: (unsigned int) n;
|
303
|
+
/** release the current layer and switches to another layer indexed by n.
|
304
|
+
The current (old) layer will be removed from its parent with 'cleanup:YES'.
|
305
|
+
*/
|
306
|
+
-(void) switchToAndReleaseMe: (unsigned int) n;
|
307
|
+
@end
|
308
|
+
|