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,349 @@
|
|
1
|
+
/*
|
2
|
+
|
3
|
+
===== IMPORTANT =====
|
4
|
+
|
5
|
+
This is sample code demonstrating API, technology or techniques in development.
|
6
|
+
Although this sample code has been reviewed for technical accuracy, it is not
|
7
|
+
final. Apple is supplying this information to help you plan for the adoption of
|
8
|
+
the technologies and programming interfaces described herein. This information
|
9
|
+
is subject to change, and software implemented based on this sample code should
|
10
|
+
be tested with final operating system software and final documentation. Newer
|
11
|
+
versions of this sample code may be provided with future seeds of the API or
|
12
|
+
technology. For information about updates to this and other developer
|
13
|
+
documentation, view the New & Updated sidebars in subsequent documentation
|
14
|
+
seeds.
|
15
|
+
|
16
|
+
=====================
|
17
|
+
|
18
|
+
File: Texture2D.h
|
19
|
+
Abstract: Creates OpenGL 2D textures from images or text.
|
20
|
+
|
21
|
+
Version: 1.6
|
22
|
+
|
23
|
+
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple Inc.
|
24
|
+
("Apple") in consideration of your agreement to the following terms, and your
|
25
|
+
use, installation, modification or redistribution of this Apple software
|
26
|
+
constitutes acceptance of these terms. If you do not agree with these terms,
|
27
|
+
please do not use, install, modify or redistribute this Apple software.
|
28
|
+
|
29
|
+
In consideration of your agreement to abide by the following terms, and subject
|
30
|
+
to these terms, Apple grants you a personal, non-exclusive license, under
|
31
|
+
Apple's copyrights in this original Apple software (the "Apple Software"), to
|
32
|
+
use, reproduce, modify and redistribute the Apple Software, with or without
|
33
|
+
modifications, in source and/or binary forms; provided that if you redistribute
|
34
|
+
the Apple Software in its entirety and without modifications, you must retain
|
35
|
+
this notice and the following text and disclaimers in all such redistributions
|
36
|
+
of the Apple Software.
|
37
|
+
Neither the name, trademarks, service marks or logos of Apple Inc. may be used
|
38
|
+
to endorse or promote products derived from the Apple Software without specific
|
39
|
+
prior written permission from Apple. Except as expressly stated in this notice,
|
40
|
+
no other rights or licenses, express or implied, are granted by Apple herein,
|
41
|
+
including but not limited to any patent rights that may be infringed by your
|
42
|
+
derivative works or by other works in which the Apple Software may be
|
43
|
+
incorporated.
|
44
|
+
|
45
|
+
The Apple Software is provided by Apple on an "AS IS" basis. APPLE MAKES NO
|
46
|
+
WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED
|
47
|
+
WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
48
|
+
PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND OPERATION ALONE OR IN
|
49
|
+
COMBINATION WITH YOUR PRODUCTS.
|
50
|
+
|
51
|
+
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR
|
52
|
+
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
|
53
|
+
GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
54
|
+
ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR
|
55
|
+
DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF
|
56
|
+
CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF
|
57
|
+
APPLE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
58
|
+
|
59
|
+
Copyright (C) 2008 Apple Inc. All Rights Reserved.
|
60
|
+
|
61
|
+
*/
|
62
|
+
|
63
|
+
#import <Foundation/Foundation.h> // for NSObject
|
64
|
+
|
65
|
+
#import "ccTypes.h"
|
66
|
+
#import "ccMacros.h"
|
67
|
+
|
68
|
+
#import "Platforms/CCGL.h" // OpenGL stuff
|
69
|
+
#import "Platforms/CCNS.h" // Next-Step stuff
|
70
|
+
|
71
|
+
//CONSTANTS:
|
72
|
+
|
73
|
+
/** @typedef CCTexture2DPixelFormat
|
74
|
+
Possible texture pixel formats
|
75
|
+
*/
|
76
|
+
typedef enum {
|
77
|
+
//! 32-bit texture: RGBA8888
|
78
|
+
kCCTexture2DPixelFormat_RGBA8888,
|
79
|
+
//! 32-bit texture without Alpha channel. Don't use it.
|
80
|
+
kCCTexture2DPixelFormat_RGB888,
|
81
|
+
//! 16-bit texture without Alpha channel
|
82
|
+
kCCTexture2DPixelFormat_RGB565,
|
83
|
+
//! 8-bit textures used as masks
|
84
|
+
kCCTexture2DPixelFormat_A8,
|
85
|
+
//! 8-bit intensity texture
|
86
|
+
kCCTexture2DPixelFormat_I8,
|
87
|
+
//! 16-bit textures used as masks
|
88
|
+
kCCTexture2DPixelFormat_AI88,
|
89
|
+
//! 16-bit textures: RGBA4444
|
90
|
+
kCCTexture2DPixelFormat_RGBA4444,
|
91
|
+
//! 16-bit textures: RGB5A1
|
92
|
+
kCCTexture2DPixelFormat_RGB5A1,
|
93
|
+
//! 4-bit PVRTC-compressed texture: PVRTC4
|
94
|
+
kCCTexture2DPixelFormat_PVRTC4,
|
95
|
+
//! 2-bit PVRTC-compressed texture: PVRTC2
|
96
|
+
kCCTexture2DPixelFormat_PVRTC2,
|
97
|
+
|
98
|
+
//! Default texture format: RGBA8888
|
99
|
+
kCCTexture2DPixelFormat_Default = kCCTexture2DPixelFormat_RGBA8888,
|
100
|
+
|
101
|
+
} CCTexture2DPixelFormat;
|
102
|
+
|
103
|
+
|
104
|
+
@class CCGLProgram;
|
105
|
+
|
106
|
+
/** CCTexture2D class.
|
107
|
+
* This class allows to easily create OpenGL 2D textures from images, text or raw data.
|
108
|
+
* The created CCTexture2D object will always have power-of-two dimensions.
|
109
|
+
* Depending on how you create the CCTexture2D object, the actual image area of the texture might be smaller than the texture dimensions i.e. "contentSize" != (pixelsWide, pixelsHigh) and (maxS, maxT) != (1.0, 1.0).
|
110
|
+
* Be aware that the content of the generated textures will be upside-down!
|
111
|
+
*/
|
112
|
+
@interface CCTexture2D : NSObject
|
113
|
+
{
|
114
|
+
GLuint _name;
|
115
|
+
CGSize _size;
|
116
|
+
NSUInteger _width,
|
117
|
+
_height;
|
118
|
+
CCTexture2DPixelFormat _format;
|
119
|
+
GLfloat _maxS,
|
120
|
+
_maxT;
|
121
|
+
BOOL _hasPremultipliedAlpha;
|
122
|
+
BOOL _hasMipmaps;
|
123
|
+
|
124
|
+
ccResolutionType _resolutionType;
|
125
|
+
|
126
|
+
// needed for drawAtRect, drawInPoint
|
127
|
+
CCGLProgram *_shaderProgram;
|
128
|
+
|
129
|
+
}
|
130
|
+
/** Initializes with a texture2d with data */
|
131
|
+
- (id) initWithData:(const void*)data pixelFormat:(CCTexture2DPixelFormat)pixelFormat pixelsWide:(NSUInteger)width pixelsHigh:(NSUInteger)height contentSize:(CGSize)size;
|
132
|
+
|
133
|
+
/** These functions are needed to create mutable textures */
|
134
|
+
- (void) releaseData:(void*)data;
|
135
|
+
- (void*) keepData:(void*)data length:(NSUInteger)length;
|
136
|
+
|
137
|
+
/** pixel format of the texture */
|
138
|
+
@property(nonatomic,readonly) CCTexture2DPixelFormat pixelFormat;
|
139
|
+
/** width in pixels */
|
140
|
+
@property(nonatomic,readonly) NSUInteger pixelsWide;
|
141
|
+
/** hight in pixels */
|
142
|
+
@property(nonatomic,readonly) NSUInteger pixelsHigh;
|
143
|
+
|
144
|
+
/** texture name */
|
145
|
+
@property(nonatomic,readonly) GLuint name;
|
146
|
+
|
147
|
+
/** returns content size of the texture in pixels */
|
148
|
+
@property(nonatomic,readonly, nonatomic) CGSize contentSizeInPixels;
|
149
|
+
|
150
|
+
/** texture max S */
|
151
|
+
@property(nonatomic,readwrite) GLfloat maxS;
|
152
|
+
/** texture max T */
|
153
|
+
@property(nonatomic,readwrite) GLfloat maxT;
|
154
|
+
/** whether or not the texture has their Alpha premultiplied */
|
155
|
+
@property(nonatomic,readonly) BOOL hasPremultipliedAlpha;
|
156
|
+
|
157
|
+
/** shader program used by drawAtPoint and drawInRect */
|
158
|
+
@property(nonatomic,readwrite,retain) CCGLProgram *shaderProgram;
|
159
|
+
|
160
|
+
/** Returns the resolution type of the texture.
|
161
|
+
Is it a RetinaDisplay texture, an iPad texture, a Mac, a Mac RetinaDisplay or an standard texture ?
|
162
|
+
|
163
|
+
Should be a readonly property. It is readwrite as a hack.
|
164
|
+
|
165
|
+
@since v1.1
|
166
|
+
*/
|
167
|
+
@property (nonatomic, readwrite) ccResolutionType resolutionType;
|
168
|
+
|
169
|
+
|
170
|
+
/** returns the content size of the texture in points */
|
171
|
+
-(CGSize) contentSize;
|
172
|
+
|
173
|
+
|
174
|
+
@end
|
175
|
+
|
176
|
+
/**
|
177
|
+
Drawing extensions to make it easy to draw basic quads using a CCTexture2D object.
|
178
|
+
These functions require GL_TEXTURE_2D and both GL_VERTEX_ARRAY and GL_TEXTURE_COORD_ARRAY client states to be enabled.
|
179
|
+
*/
|
180
|
+
@interface CCTexture2D (Drawing)
|
181
|
+
/** draws a texture at a given point */
|
182
|
+
- (void) drawAtPoint:(CGPoint)point;
|
183
|
+
/** draws a texture inside a rect */
|
184
|
+
- (void) drawInRect:(CGRect)rect;
|
185
|
+
@end
|
186
|
+
|
187
|
+
/**
|
188
|
+
Extensions to make it easy to create a CCTexture2D object from an image file.
|
189
|
+
Note that RGBA type textures will have their alpha premultiplied - use the blending mode (GL_ONE, GL_ONE_MINUS_SRC_ALPHA).
|
190
|
+
*/
|
191
|
+
@interface CCTexture2D (Image)
|
192
|
+
/** Initializes a texture from a CGImage object */
|
193
|
+
- (id) initWithCGImage:(CGImageRef)cgImage resolutionType:(ccResolutionType)resolution;
|
194
|
+
@end
|
195
|
+
|
196
|
+
/**
|
197
|
+
Extensions to make it easy to create a CCTexture2D object from a string of text.
|
198
|
+
Note that the generated textures are of type A8 - use the blending mode (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA).
|
199
|
+
*/
|
200
|
+
@interface CCTexture2D (Text)
|
201
|
+
/** Initializes a texture from a string with dimensions, alignment, line break mode, font name and font size
|
202
|
+
Supported lineBreakModes:
|
203
|
+
- iOS: all UILineBreakMode supported modes
|
204
|
+
- Mac: Only NSLineBreakByWordWrapping is supported.
|
205
|
+
@since v1.0
|
206
|
+
*/
|
207
|
+
- (id) initWithString:(NSString*)string fontName:(NSString*)name fontSize:(CGFloat)size dimensions:(CGSize)dimensions hAlignment:(CCTextAlignment)alignment vAlignment:(CCVerticalTextAlignment) vertAlignment lineBreakMode:(CCLineBreakMode)lineBreakMode ;
|
208
|
+
/** Initializes a texture from a string with dimensions, alignment, font name and font size */
|
209
|
+
- (id) initWithString:(NSString*)string fontName:(NSString*)name fontSize:(CGFloat)size dimensions:(CGSize)dimensions hAlignment:(CCTextAlignment)alignment vAlignment:(CCVerticalTextAlignment) vertAlignment;
|
210
|
+
/** Initializes a texture from a string with font name and font size */
|
211
|
+
- (id) initWithString:(NSString*)string fontName:(NSString*)name fontSize:(CGFloat)size;
|
212
|
+
@end
|
213
|
+
|
214
|
+
|
215
|
+
/**
|
216
|
+
Extensions to make it easy to create a CCTexture2D object from a PVRTC file
|
217
|
+
Note that the generated textures don't have their alpha premultiplied - use the blending mode (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA).
|
218
|
+
*/
|
219
|
+
@interface CCTexture2D (PVRSupport)
|
220
|
+
/** Initializes a texture from a PVR file.
|
221
|
+
|
222
|
+
Supported PVR formats:
|
223
|
+
- BGRA 8888
|
224
|
+
- RGBA 8888
|
225
|
+
- RGBA 4444
|
226
|
+
- RGBA 5551
|
227
|
+
- RBG 565
|
228
|
+
- A 8
|
229
|
+
- I 8
|
230
|
+
- AI 8
|
231
|
+
- PVRTC 2BPP
|
232
|
+
- PVRTC 4BPP
|
233
|
+
|
234
|
+
By default PVR images are treated as if they alpha channel is NOT premultiplied. You can override this behavior with this class method:
|
235
|
+
- PVRImagesHavePremultipliedAlpha:(BOOL)haveAlphaPremultiplied;
|
236
|
+
|
237
|
+
IMPORTANT: This method is only defined on iOS. It is not supported on the Mac version.
|
238
|
+
|
239
|
+
*/
|
240
|
+
-(id) initWithPVRFile: (NSString*) file;
|
241
|
+
|
242
|
+
/** treats (or not) PVR files as if they have alpha premultiplied.
|
243
|
+
Since it is impossible to know at runtime if the PVR images have the alpha channel premultiplied, it is
|
244
|
+
possible load them as if they have (or not) the alpha channel premultiplied.
|
245
|
+
|
246
|
+
By default it is disabled.
|
247
|
+
|
248
|
+
@since v0.99.5
|
249
|
+
*/
|
250
|
+
+(void) PVRImagesHavePremultipliedAlpha:(BOOL)haveAlphaPremultiplied;
|
251
|
+
@end
|
252
|
+
|
253
|
+
/**
|
254
|
+
Extension to set the Min / Mag filter
|
255
|
+
*/
|
256
|
+
typedef struct _ccTexParams {
|
257
|
+
GLuint minFilter;
|
258
|
+
GLuint magFilter;
|
259
|
+
GLuint wrapS;
|
260
|
+
GLuint wrapT;
|
261
|
+
} ccTexParams;
|
262
|
+
|
263
|
+
@interface CCTexture2D (GLFilter)
|
264
|
+
/** sets the min filter, mag filter, wrap s and wrap t texture parameters.
|
265
|
+
If the texture size is NPOT (non power of 2), then in can only use GL_CLAMP_TO_EDGE in GL_TEXTURE_WRAP_{S,T}.
|
266
|
+
|
267
|
+
@warning Calling this method could allocate additional texture memory.
|
268
|
+
|
269
|
+
@since v0.8
|
270
|
+
*/
|
271
|
+
-(void) setTexParameters: (ccTexParams*) texParams;
|
272
|
+
|
273
|
+
/** sets antialias texture parameters:
|
274
|
+
- GL_TEXTURE_MIN_FILTER = GL_LINEAR
|
275
|
+
- GL_TEXTURE_MAG_FILTER = GL_LINEAR
|
276
|
+
|
277
|
+
@warning Calling this method could allocate additional texture memory.
|
278
|
+
|
279
|
+
@since v0.8
|
280
|
+
*/
|
281
|
+
- (void) setAntiAliasTexParameters;
|
282
|
+
|
283
|
+
/** sets alias texture parameters:
|
284
|
+
- GL_TEXTURE_MIN_FILTER = GL_NEAREST
|
285
|
+
- GL_TEXTURE_MAG_FILTER = GL_NEAREST
|
286
|
+
|
287
|
+
@warning Calling this method could allocate additional texture memory.
|
288
|
+
|
289
|
+
@since v0.8
|
290
|
+
*/
|
291
|
+
- (void) setAliasTexParameters;
|
292
|
+
|
293
|
+
|
294
|
+
/** Generates mipmap images for the texture.
|
295
|
+
It only works if the texture size is POT (power of 2).
|
296
|
+
@since v0.99.0
|
297
|
+
*/
|
298
|
+
-(void) generateMipmap;
|
299
|
+
|
300
|
+
|
301
|
+
@end
|
302
|
+
|
303
|
+
@interface CCTexture2D (PixelFormat)
|
304
|
+
/** sets the default pixel format for CGImages that contains alpha channel.
|
305
|
+
If the CGImage contains alpha channel, then the options are:
|
306
|
+
- generate 32-bit textures: kCCTexture2DPixelFormat_RGBA8888 (default one)
|
307
|
+
- generate 16-bit textures: kCCTexture2DPixelFormat_RGBA4444
|
308
|
+
- generate 16-bit textures: kCCTexture2DPixelFormat_RGB5A1
|
309
|
+
- generate 24-bit textures: kCCTexture2DPixelFormat_RGB888 (no alpha)
|
310
|
+
- generate 16-bit textures: kCCTexture2DPixelFormat_RGB565 (no alpha)
|
311
|
+
- generate 8-bit textures: kCCTexture2DPixelFormat_A8 (only use it if you use just 1 color)
|
312
|
+
|
313
|
+
How does it work ?
|
314
|
+
- If the image is an RGBA (with Alpha) then the default pixel format will be used (it can be a 8-bit, 16-bit or 32-bit texture)
|
315
|
+
- If the image is an RGB (without Alpha) then: If the default pixel format is RGBA8888 then a RGBA8888 (32-bit) will be used. Otherwise a RGB565 (16-bit texture) will be used.
|
316
|
+
|
317
|
+
This parameter is not valid for PVR / PVR.CCZ images.
|
318
|
+
|
319
|
+
@since v0.8
|
320
|
+
*/
|
321
|
+
+(void) setDefaultAlphaPixelFormat:(CCTexture2DPixelFormat)format;
|
322
|
+
|
323
|
+
/** returns the alpha pixel format
|
324
|
+
@since v0.8
|
325
|
+
*/
|
326
|
+
+(CCTexture2DPixelFormat) defaultAlphaPixelFormat;
|
327
|
+
|
328
|
+
/** returns the bits-per-pixel of the in-memory OpenGL texture
|
329
|
+
@since v1.0
|
330
|
+
*/
|
331
|
+
-(NSUInteger) bitsPerPixelForFormat;
|
332
|
+
|
333
|
+
/** returns the pixel format in a NSString.
|
334
|
+
@since v2.0
|
335
|
+
*/
|
336
|
+
-(NSString*) stringForFormat;
|
337
|
+
|
338
|
+
|
339
|
+
/** Helper functions that returns bits per pixels for a given format.
|
340
|
+
@since v2.0
|
341
|
+
*/
|
342
|
+
+(NSUInteger) bitsPerPixelForFormat:(CCTexture2DPixelFormat)format;
|
343
|
+
|
344
|
+
@end
|
345
|
+
|
346
|
+
|
347
|
+
|
348
|
+
|
349
|
+
|
@@ -0,0 +1,188 @@
|
|
1
|
+
/*
|
2
|
+
* cocos2d for iPhone: http://www.cocos2d-iphone.org
|
3
|
+
*
|
4
|
+
* Copyright (c) 2008-2010 Ricardo Quesada
|
5
|
+
* Copyright (c) 2011 Zynga Inc.
|
6
|
+
*
|
7
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
8
|
+
* of this software and associated documentation files (the "Software"), to deal
|
9
|
+
* in the Software without restriction, including without limitation the rights
|
10
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
11
|
+
* copies of the Software, and to permit persons to whom the Software is
|
12
|
+
* furnished to do so, subject to the following conditions:
|
13
|
+
*
|
14
|
+
* The above copyright notice and this permission notice shall be included in
|
15
|
+
* all copies or substantial portions of the Software.
|
16
|
+
*
|
17
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
18
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
19
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
20
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
21
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
22
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
23
|
+
* THE SOFTWARE.
|
24
|
+
*
|
25
|
+
*/
|
26
|
+
|
27
|
+
#import "CCTexture2D.h"
|
28
|
+
#import "ccTypes.h"
|
29
|
+
#import "ccConfig.h"
|
30
|
+
|
31
|
+
/** A class that implements a Texture Atlas.
|
32
|
+
Supported features:
|
33
|
+
* The atlas file can be a PVRTC, PNG or any other format supported by Texture2D
|
34
|
+
* Quads can be updated in runtime
|
35
|
+
* Quads can be added in runtime
|
36
|
+
* Quads can be removed in runtime
|
37
|
+
* Quads can be re-ordered in runtime
|
38
|
+
* The TextureAtlas capacity can be increased or decreased in runtime
|
39
|
+
* OpenGL component: V3F, C4B, T2F.
|
40
|
+
The quads are rendered using an OpenGL ES VBO.
|
41
|
+
To render the quads using an interleaved vertex array list, you should modify the ccConfig.h file
|
42
|
+
*/
|
43
|
+
@interface CCTextureAtlas : NSObject
|
44
|
+
{
|
45
|
+
NSUInteger _totalQuads;
|
46
|
+
NSUInteger _capacity;
|
47
|
+
ccV3F_C4B_T2F_Quad *_quads; // quads to be rendered
|
48
|
+
GLushort *_indices;
|
49
|
+
CCTexture2D *_texture;
|
50
|
+
|
51
|
+
GLuint _buffersVBO[2]; //0: vertex 1: indices
|
52
|
+
BOOL _dirty; //indicates whether or not the array buffer of the VBO needs to be updated
|
53
|
+
|
54
|
+
#if CC_TEXTURE_ATLAS_USE_VAO
|
55
|
+
GLuint _VAOname;
|
56
|
+
#endif
|
57
|
+
}
|
58
|
+
|
59
|
+
/** quantity of quads that are going to be drawn */
|
60
|
+
@property (nonatomic,readonly) NSUInteger totalQuads;
|
61
|
+
/** quantity of quads that can be stored with the current texture atlas size */
|
62
|
+
@property (nonatomic,readonly) NSUInteger capacity;
|
63
|
+
/** Texture of the texture atlas */
|
64
|
+
@property (nonatomic,retain) CCTexture2D *texture;
|
65
|
+
/** Quads that are going to be rendered */
|
66
|
+
@property (nonatomic,readwrite) ccV3F_C4B_T2F_Quad *quads;
|
67
|
+
|
68
|
+
/** creates a TextureAtlas with an filename and with an initial capacity for Quads.
|
69
|
+
* The TextureAtlas capacity can be increased in runtime.
|
70
|
+
*/
|
71
|
+
+(id) textureAtlasWithFile:(NSString*)file capacity:(NSUInteger)capacity;
|
72
|
+
|
73
|
+
/** initializes a TextureAtlas with a filename and with a certain capacity for Quads.
|
74
|
+
* The TextureAtlas capacity can be increased in runtime.
|
75
|
+
*
|
76
|
+
* WARNING: Do not reinitialize the TextureAtlas because it will leak memory (issue #706)
|
77
|
+
*/
|
78
|
+
-(id) initWithFile: (NSString*) file capacity:(NSUInteger)capacity;
|
79
|
+
|
80
|
+
/** creates a TextureAtlas with a previously initialized Texture2D object, and
|
81
|
+
* with an initial capacity for n Quads.
|
82
|
+
* The TextureAtlas capacity can be increased in runtime.
|
83
|
+
*/
|
84
|
+
+(id) textureAtlasWithTexture:(CCTexture2D *)tex capacity:(NSUInteger)capacity;
|
85
|
+
|
86
|
+
/** initializes a TextureAtlas with a previously initialized Texture2D object, and
|
87
|
+
* with an initial capacity for Quads.
|
88
|
+
* The TextureAtlas capacity can be increased in runtime.
|
89
|
+
*
|
90
|
+
* WARNING: Do not reinitialize the TextureAtlas because it will leak memory (issue #706)
|
91
|
+
*/
|
92
|
+
-(id) initWithTexture:(CCTexture2D *)tex capacity:(NSUInteger)capacity;
|
93
|
+
|
94
|
+
/** updates a Quad (texture, vertex and color) at a certain index
|
95
|
+
* index must be between 0 and the atlas capacity - 1
|
96
|
+
@since v0.8
|
97
|
+
*/
|
98
|
+
-(void) updateQuad:(ccV3F_C4B_T2F_Quad*)quad atIndex:(NSUInteger)index;
|
99
|
+
|
100
|
+
/** Inserts a Quad (texture, vertex and color) at a certain index
|
101
|
+
index must be between 0 and the atlas capacity - 1
|
102
|
+
@since v0.8
|
103
|
+
*/
|
104
|
+
-(void) insertQuad:(ccV3F_C4B_T2F_Quad*)quad atIndex:(NSUInteger)index;
|
105
|
+
|
106
|
+
/** Inserts a c array of quads at a given index
|
107
|
+
index must be between 0 and the atlas capacity - 1
|
108
|
+
this method doesn't enlarge the array when amount + index > totalQuads
|
109
|
+
@since v1.1
|
110
|
+
*/
|
111
|
+
-(void) insertQuads:(ccV3F_C4B_T2F_Quad*)quads atIndex:(NSUInteger)index amount:(NSUInteger)amount;
|
112
|
+
|
113
|
+
/** Removes the quad that is located at a certain index and inserts it at a new index
|
114
|
+
This operation is faster than removing and inserting in a quad in 2 different steps
|
115
|
+
@since v0.7.2
|
116
|
+
*/
|
117
|
+
-(void) insertQuadFromIndex:(NSUInteger)fromIndex atIndex:(NSUInteger)newIndex;
|
118
|
+
|
119
|
+
/** removes a quad at a given index number.
|
120
|
+
The capacity remains the same, but the total number of quads to be drawn is reduced in 1
|
121
|
+
@since v0.7.2
|
122
|
+
*/
|
123
|
+
-(void) removeQuadAtIndex:(NSUInteger) index;
|
124
|
+
|
125
|
+
/** removes a amount of quads starting from index
|
126
|
+
@since 1.1
|
127
|
+
*/
|
128
|
+
- (void) removeQuadsAtIndex:(NSUInteger) index amount:(NSUInteger) amount;
|
129
|
+
|
130
|
+
/** removes all Quads.
|
131
|
+
The TextureAtlas capacity remains untouched. No memory is freed.
|
132
|
+
The total number of quads to be drawn will be 0
|
133
|
+
@since v0.7.2
|
134
|
+
*/
|
135
|
+
-(void) removeAllQuads;
|
136
|
+
|
137
|
+
/** resize the capacity of the CCTextureAtlas.
|
138
|
+
* The new capacity can be lower or higher than the current one
|
139
|
+
* It returns YES if the resize was successful.
|
140
|
+
* If it fails to resize the capacity it will return NO with a new capacity of 0.
|
141
|
+
*/
|
142
|
+
-(BOOL) resizeCapacity: (NSUInteger) n;
|
143
|
+
|
144
|
+
/**
|
145
|
+
Used internally by CCParticleBatchNode
|
146
|
+
don't use this unless you know what you're doing
|
147
|
+
@since 1.1
|
148
|
+
*/
|
149
|
+
- (void) increaseTotalQuadsWith:(NSUInteger) amount;
|
150
|
+
|
151
|
+
/** Moves an amount of quads from oldIndex at newIndex
|
152
|
+
@since v1.1
|
153
|
+
*/
|
154
|
+
-(void) moveQuadsFromIndex:(NSUInteger)oldIndex amount:(NSUInteger) amount atIndex:(NSUInteger)newIndex;
|
155
|
+
|
156
|
+
/**
|
157
|
+
Moves quads from index till totalQuads to the newIndex
|
158
|
+
Used internally by CCParticleBatchNode
|
159
|
+
This method doesn't enlarge the array if newIndex + quads to be moved > capacity
|
160
|
+
@since 1.1
|
161
|
+
*/
|
162
|
+
- (void) moveQuadsFromIndex:(NSUInteger) index to:(NSUInteger) newIndex;
|
163
|
+
|
164
|
+
/**
|
165
|
+
Ensures that after a realloc quads are still empty
|
166
|
+
Used internally by CCParticleBatchNode
|
167
|
+
@since 1.1
|
168
|
+
*/
|
169
|
+
- (void) fillWithEmptyQuadsFromIndex:(NSUInteger) index amount:(NSUInteger) amount;
|
170
|
+
|
171
|
+
/** draws n quads
|
172
|
+
* n can't be greater than the capacity of the Atlas
|
173
|
+
*/
|
174
|
+
|
175
|
+
-(void) drawNumberOfQuads: (NSUInteger) n;
|
176
|
+
|
177
|
+
/** draws n quads from an index (offset).
|
178
|
+
n + start can't be greater than the capacity of the atlas
|
179
|
+
|
180
|
+
@since v1.0
|
181
|
+
*/
|
182
|
+
-(void) drawNumberOfQuads: (NSUInteger) n fromIndex: (NSUInteger) start;
|
183
|
+
|
184
|
+
/** draws all the Atlas's Quads
|
185
|
+
*/
|
186
|
+
-(void) drawQuads;
|
187
|
+
|
188
|
+
@end
|
@@ -0,0 +1,146 @@
|
|
1
|
+
/*
|
2
|
+
* cocos2d for iPhone: http://www.cocos2d-iphone.org
|
3
|
+
*
|
4
|
+
* Copyright (c) 2008-2010 Ricardo Quesada
|
5
|
+
* Copyright (c) 2011 Zynga Inc.
|
6
|
+
*
|
7
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
8
|
+
* of this software and associated documentation files (the "Software"), to deal
|
9
|
+
* in the Software without restriction, including without limitation the rights
|
10
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
11
|
+
* copies of the Software, and to permit persons to whom the Software is
|
12
|
+
* furnished to do so, subject to the following conditions:
|
13
|
+
*
|
14
|
+
* The above copyright notice and this permission notice shall be included in
|
15
|
+
* all copies or substantial portions of the Software.
|
16
|
+
*
|
17
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
18
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
19
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
20
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
21
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
22
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
23
|
+
* THE SOFTWARE.
|
24
|
+
*
|
25
|
+
*/
|
26
|
+
|
27
|
+
#import "ccMacros.h"
|
28
|
+
|
29
|
+
#ifdef __CC_PLATFORM_IOS
|
30
|
+
#import <CoreGraphics/CGImage.h>
|
31
|
+
#endif
|
32
|
+
|
33
|
+
#import <Foundation/Foundation.h>
|
34
|
+
|
35
|
+
@class CCTexture2D;
|
36
|
+
|
37
|
+
/** Singleton that handles the loading of textures
|
38
|
+
* Once the texture is loaded, the next time it will return
|
39
|
+
* a reference of the previously loaded texture reducing GPU & CPU memory
|
40
|
+
*/
|
41
|
+
@interface CCTextureCache : NSObject
|
42
|
+
{
|
43
|
+
NSMutableDictionary *_textures;
|
44
|
+
|
45
|
+
dispatch_queue_t _loadingQueue;
|
46
|
+
dispatch_queue_t _dictQueue;
|
47
|
+
}
|
48
|
+
|
49
|
+
/** Retruns ths shared instance of the cache */
|
50
|
+
+ (CCTextureCache *) sharedTextureCache;
|
51
|
+
|
52
|
+
/** purges the cache. It releases the retained instance.
|
53
|
+
@since v0.99.0
|
54
|
+
*/
|
55
|
+
+(void)purgeSharedTextureCache;
|
56
|
+
|
57
|
+
|
58
|
+
/** Returns a Texture2D object given an file image
|
59
|
+
* If the file image was not previously loaded, it will create a new CCTexture2D
|
60
|
+
* object and it will return it. It will use the filename as a key.
|
61
|
+
* Otherwise it will return a reference of a previously loaded image.
|
62
|
+
* Supported image extensions: .png, .bmp, .tiff, .jpeg, .pvr, .gif
|
63
|
+
*/
|
64
|
+
-(CCTexture2D*) addImage: (NSString*) fileimage;
|
65
|
+
|
66
|
+
/** Asynchronously, load a texture2d from a file.
|
67
|
+
* If the file image was previously loaded, it will use it.
|
68
|
+
* Otherwise it will load a texture in a new thread, and when the image is loaded, the callback will be called with the Texture2D as a parameter.
|
69
|
+
* The callback will be called in the cocos2d thread, so it is safe to create any cocos2d object from the callback.
|
70
|
+
* Supported image extensions: .png, .bmp, .tiff, .jpeg, .pvr, .gif
|
71
|
+
* @since v0.8
|
72
|
+
*/
|
73
|
+
-(void) addImageAsync:(NSString*) filename target:(id)target selector:(SEL)selector;
|
74
|
+
|
75
|
+
/** Asynchronously, load a texture2d from a file.
|
76
|
+
* If the file image was previously loaded, it will use it.
|
77
|
+
* Otherwise it will load a texture in a new thread, and when the image is loaded, the block will be called.
|
78
|
+
* The callback will be called in the cocos2d thread, so it is safe to create any cocos2d object from the callback.
|
79
|
+
* Supported image extensions: .png, .bmp, .tiff, .jpeg, .pvr, .gif
|
80
|
+
* @since v2.0
|
81
|
+
*/
|
82
|
+
-(void) addImageAsync:(NSString*) filename withBlock:(void(^)(CCTexture2D *tex))block;
|
83
|
+
|
84
|
+
|
85
|
+
/** Returns a Texture2D object given an CGImageRef image
|
86
|
+
* If the image was not previously loaded, it will create a new CCTexture2D object and it will return it.
|
87
|
+
* Otherwise it will return a reference of a previously loaded image
|
88
|
+
* The "key" parameter will be used as the "key" for the cache.
|
89
|
+
* If "key" is nil, then a new texture will be created each time.
|
90
|
+
* @since v0.8
|
91
|
+
*/
|
92
|
+
-(CCTexture2D*) addCGImage: (CGImageRef) image forKey: (NSString *)key;
|
93
|
+
|
94
|
+
/** Returns an already created texture. Returns nil if the texture doesn't exist.
|
95
|
+
@since v0.99.5
|
96
|
+
*/
|
97
|
+
-(CCTexture2D *) textureForKey:(NSString *)key;
|
98
|
+
|
99
|
+
/** Purges the dictionary of loaded textures.
|
100
|
+
* Call this method if you receive the "Memory Warning"
|
101
|
+
* In the short term: it will free some resources preventing your app from being killed
|
102
|
+
* In the medium term: it will allocate more resources
|
103
|
+
* In the long term: it will be the same
|
104
|
+
*/
|
105
|
+
-(void) removeAllTextures;
|
106
|
+
|
107
|
+
/** Removes unused textures
|
108
|
+
* Textures that have a retain count of 1 will be deleted
|
109
|
+
* It is convenient to call this method after when starting a new Scene
|
110
|
+
* @since v0.8
|
111
|
+
*/
|
112
|
+
-(void) removeUnusedTextures;
|
113
|
+
|
114
|
+
/** Deletes a texture from the cache given a texture
|
115
|
+
*/
|
116
|
+
-(void) removeTexture: (CCTexture2D*) tex;
|
117
|
+
|
118
|
+
/** Deletes a texture from the cache given a its key name
|
119
|
+
@since v0.99.4
|
120
|
+
*/
|
121
|
+
-(void) removeTextureForKey: (NSString*) textureKeyName;
|
122
|
+
|
123
|
+
@end
|
124
|
+
|
125
|
+
|
126
|
+
@interface CCTextureCache (PVRSupport)
|
127
|
+
|
128
|
+
/** Returns a Texture2D object given an PVR filename.
|
129
|
+
* If the file image was not previously loaded, it will create a new CCTexture2D
|
130
|
+
* object and it will return it. Otherwise it will return a reference of a previously loaded image
|
131
|
+
*
|
132
|
+
*/
|
133
|
+
-(CCTexture2D*) addPVRImage:(NSString*) filename;
|
134
|
+
|
135
|
+
@end
|
136
|
+
|
137
|
+
|
138
|
+
@interface CCTextureCache (Debug)
|
139
|
+
/** Output to CCLOG the current contents of this CCTextureCache
|
140
|
+
* This will attempt to calculate the size of each texture, and the total texture memory in use
|
141
|
+
*
|
142
|
+
* @since v1.0
|
143
|
+
*/
|
144
|
+
-(void) dumpCachedTextureInfo;
|
145
|
+
|
146
|
+
@end
|