joybox 1.0.0 → 1.1.0
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.
- data/.travis.yml +3 -0
- data/Gemfile +2 -2
- data/Gemfile.lock +4 -4
- data/README.md +66 -22
- data/Rakefile +22 -4
- data/app/ios/app_delegate.rb +48 -0
- data/app/osx/app_delegate.rb +26 -0
- data/app/osx/layers/game_layer.rb +5 -0
- data/app/osx/menu.rb +51 -0
- data/command/command/image.rb +26 -0
- data/command/command/string.rb +15 -0
- data/command/command/template.rb +59 -0
- data/command/command/tmx.rb +75 -0
- data/command/joybox_generate_command.rb +64 -110
- data/command/joybox_retina_command.rb +87 -0
- data/command/{joybox/templates → templates}/layer.erb +0 -0
- data/command/{joybox/templates → templates}/layer_spec.erb +0 -0
- data/command/{joybox/templates → templates}/scene.erb +0 -0
- data/command/{joybox/templates → templates}/scene_spec.erb +0 -0
- data/command/{joybox/templates → templates}/sprite.erb +0 -0
- data/command/{joybox/templates → templates}/sprite_spec.erb +0 -0
- data/ext/extconf.rb +34 -0
- data/joybox.gemspec +103 -50
- data/lib/joybox.rb +2 -0
- data/lib/joybox/joybox-ios.rb +18 -3
- data/lib/joybox/joybox-osx.rb +18 -2
- data/lib/joybox/version.rb +1 -1
- data/motion/joybox-ios/common/cg_point.rb +46 -16
- data/motion/joybox-ios/common/device.rb +56 -0
- data/motion/joybox-ios/common/ui_touch.rb +0 -2
- data/motion/joybox-ios/configuration/configuration.rb +10 -40
- data/motion/joybox-ios/configuration/file_utils.rb +0 -4
- data/motion/joybox-ios/configuration/gl_view.rb +14 -20
- data/motion/joybox-ios/configuration/texture_2d.rb +0 -4
- data/motion/joybox-ios/core/layer.rb +2 -8
- data/motion/joybox-ios/debug/proxy_view.rb +5 -5
- data/motion/joybox-ios/debug/{node.rb → repl.rb} +25 -19
- data/motion/joybox-ios/director.rb +15 -4
- data/motion/joybox-osx/common/ats_point.rb +45 -15
- data/motion/joybox-osx/common/device.rb +30 -0
- data/motion/joybox-osx/common/ns_event.rb +0 -1
- data/motion/joybox-osx/configuration/configuration.rb +6 -26
- data/motion/joybox-osx/configuration/gl_view.rb +16 -14
- data/motion/joybox-osx/core/layer.rb +45 -26
- data/motion/joybox-osx/debug/proxy_view.rb +5 -5
- data/motion/joybox-osx/debug/{node.rb → repl.rb} +13 -7
- data/motion/joybox-osx/director.rb +4 -3
- data/motion/joybox/actions/animate.rb +0 -1
- data/motion/joybox/actions/bezier.rb +2 -9
- data/motion/joybox/actions/blink.rb +1 -4
- data/motion/joybox/actions/callback.rb +19 -0
- data/motion/joybox/actions/d3/flip.rb +27 -0
- data/motion/joybox/actions/d3/jump.rb +30 -0
- data/motion/joybox/actions/d3/lens.rb +30 -0
- data/motion/joybox/actions/d3/shake.rb +32 -0
- data/motion/joybox/actions/d3/shatter.rb +30 -0
- data/motion/joybox/actions/d3/wave.rb +33 -0
- data/motion/joybox/actions/delay.rb +19 -0
- data/motion/joybox/actions/ease.rb +3 -21
- data/motion/joybox/actions/fade.rb +30 -6
- data/motion/joybox/actions/jump.rb +0 -5
- data/motion/joybox/actions/liquid.rb +28 -0
- data/motion/joybox/actions/move.rb +2 -9
- data/motion/joybox/actions/place.rb +0 -2
- data/motion/joybox/actions/repeat.rb +0 -2
- data/motion/joybox/actions/rotate.rb +2 -9
- data/motion/joybox/actions/scale.rb +2 -9
- data/motion/joybox/actions/sequence.rb +0 -1
- data/motion/joybox/actions/shuffle.rb +26 -0
- data/motion/joybox/actions/skew.rb +2 -11
- data/motion/joybox/actions/spawn.rb +0 -1
- data/motion/joybox/actions/split.rb +24 -0
- data/motion/joybox/actions/tint.rb +0 -5
- data/motion/joybox/actions/turn.rb +24 -0
- data/motion/joybox/actions/twirl.rb +30 -0
- data/motion/joybox/actions/visibility.rb +21 -0
- data/motion/joybox/actions/wave.rb +32 -0
- data/motion/joybox/animations/animation.rb +7 -11
- data/motion/joybox/audio/audio.rb +31 -0
- data/motion/joybox/audio/audio_effect.rb +69 -0
- data/motion/joybox/audio/background_audio.rb +77 -0
- data/motion/joybox/common/{gc_size.rb → cg_size.rb} +13 -12
- data/motion/joybox/common/color.rb +4 -13
- data/motion/joybox/common/initialize.rb +11 -0
- data/motion/joybox/common/ns_array.rb +15 -0
- data/motion/joybox/common/ns_string.rb +7 -0
- data/motion/joybox/common/numeric.rb +13 -4
- data/motion/joybox/common/screen.rb +4 -12
- data/motion/joybox/configuration/debug.rb +29 -0
- data/motion/joybox/core/layer.rb +0 -24
- data/motion/joybox/core/layer_color.rb +47 -0
- data/motion/joybox/core/node.rb +18 -8
- data/motion/joybox/core/scene.rb +0 -5
- data/motion/joybox/core/sprite.rb +43 -25
- data/motion/joybox/core/sprite_batch.rb +15 -6
- data/motion/joybox/core/sprite_frame_cache.rb +9 -58
- data/motion/joybox/debug/physics.rb +40 -0
- data/motion/joybox/debug/physics_draw.rb +191 -0
- data/motion/joybox/joybox.rb +9 -1
- data/motion/joybox/macros.rb +13 -13
- data/motion/joybox/physics/aabb.rb +28 -0
- data/motion/joybox/physics/body.rb +163 -68
- data/motion/joybox/physics/chain_shape.rb +71 -0
- data/motion/joybox/physics/circle_shape.rb +31 -0
- data/motion/joybox/physics/edge_shape.rb +37 -0
- data/motion/joybox/physics/filter.rb +17 -0
- data/motion/joybox/physics/fixture.rb +52 -0
- data/motion/joybox/physics/mass_data.rb +19 -0
- data/motion/joybox/physics/physics_sprite.rb +50 -16
- data/motion/joybox/physics/polygon_shape.rb +54 -0
- data/motion/joybox/physics/profile.rb +14 -0
- data/motion/joybox/physics/ray_cast_input.rb +30 -0
- data/motion/joybox/physics/ray_cast_output.rb +17 -0
- data/motion/joybox/physics/shape.rb +61 -0
- data/motion/joybox/physics/transform.rb +17 -0
- data/motion/joybox/physics/world.rb +101 -30
- data/motion/joybox/tmx/object_layer.rb +12 -0
- data/motion/joybox/tmx/tile_layer.rb +74 -0
- data/motion/joybox/tmx/tile_map.rb +112 -0
- data/motion/joybox/tmx/tile_set.rb +26 -0
- data/motion/joybox/tmx/tmx.rb +16 -0
- data/motion/joybox/ui/label.rb +44 -16
- data/motion/joybox/ui/menu.rb +7 -9
- data/motion/joybox/ui/menu_image.rb +11 -8
- data/motion/joybox/ui/menu_label.rb +14 -13
- data/resources/Default-568h@2x.png +0 -0
- data/resources/animation_frames-hd.plist +126 -0
- data/resources/animation_frames-ipadhd.plist +126 -0
- data/resources/animation_frames.plist +126 -0
- data/resources/animation_sprite_sheet-hd.png +0 -0
- data/resources/animation_sprite_sheet-ipadhd.png +0 -0
- data/resources/animation_sprite_sheet.png +0 -0
- data/resources/fps_images-hd.png +0 -0
- data/resources/fps_images-ipadhd.png +0 -0
- data/resources/fps_images.png +0 -0
- data/resources/sprite.png +0 -0
- data/resources/sprite_inverted.png +0 -0
- data/resources/sprite_sheet.png +0 -0
- data/spec/motion/joybox-ios/common/screen_spec.rb +21 -0
- data/spec/{main_spec.rb → motion/joybox-ios/main_spec.rb} +6 -2
- data/spec/motion/joybox-ios/ui/label_spec.rb +20 -0
- data/spec/motion/joybox-ios/ui/menu_label_spec.rb +15 -0
- data/spec/motion/joybox-ios/ui/menu_spec.rb +87 -0
- data/spec/motion/joybox-osx/common/screen_spec.rb +21 -0
- data/spec/motion/joybox-osx/main_spec.rb +13 -0
- data/spec/motion/joybox-osx/ui/label_spec.rb +18 -0
- data/spec/motion/joybox-osx/ui/menu_label_spec.rb +13 -0
- data/spec/motion/joybox-osx/ui/menu_spec.rb +87 -0
- data/spec/motion/joybox/actions/actions_spec.rb +11 -0
- data/spec/motion/joybox/actions/bezier_spec.rb +37 -0
- data/spec/motion/joybox/actions/blink_spec.rb +16 -0
- data/spec/motion/joybox/actions/fade_spec.rb +49 -0
- data/spec/motion/joybox/actions/jump_spec.rb +37 -0
- data/spec/motion/joybox/actions/move_spec.rb +37 -0
- data/spec/motion/joybox/actions/place_spec.rb +12 -0
- data/spec/motion/joybox/actions/rotate_spec.rb +35 -0
- data/spec/motion/joybox/actions/scale_spec.rb +43 -0
- data/spec/motion/joybox/actions/skew_spec.rb +43 -0
- data/spec/motion/joybox/common/cg_size_spec.rb +29 -0
- data/spec/motion/joybox/common/color_spec.rb +31 -0
- data/spec/motion/joybox/common/ns_string_spec.rb +8 -0
- data/spec/motion/joybox/common/numeric_spec.rb +13 -0
- data/spec/motion/joybox/core/node_spec.rb +36 -0
- data/spec/motion/joybox/core/sprite_batch_spec.rb +34 -0
- data/spec/motion/joybox/core/sprite_frame_cache_spec.rb +111 -0
- data/spec/motion/joybox/core/sprite_spec.rb +121 -0
- data/spec/motion/joybox/macros_spec.rb +280 -0
- data/spec/motion/joybox/physics/aabb_spec.rb +17 -0
- data/spec/motion/joybox/physics/body_spec.rb +318 -0
- data/spec/motion/joybox/physics/chain_shape_spec.rb +80 -0
- data/spec/motion/joybox/physics/circle_shape_spec.rb +63 -0
- data/spec/motion/joybox/physics/edge_shape_spec.rb +48 -0
- data/spec/motion/joybox/physics/fixture_spec.rb +106 -0
- data/spec/motion/joybox/physics/mass_data_spec.rb +13 -0
- data/spec/motion/joybox/physics/physics_sprite_spec.rb +50 -0
- data/spec/motion/joybox/physics/polygon_shape_spec.rb +92 -0
- data/spec/motion/joybox/physics/ray_cast_input_spec.rb +17 -0
- data/spec/motion/joybox/physics/ray_cast_output_spec.rb +13 -0
- data/spec/motion/joybox/physics/shape_spec.rb +50 -0
- data/spec/motion/joybox/physics/transform_spec.rb +13 -0
- data/spec/motion/joybox/physics/world_spec.rb +228 -0
- data/spec/motion/joybox/ui/label_spec.rb +53 -0
- data/spec/motion/joybox/ui/menu_image_spec.rb +51 -0
- data/spec/motion/joybox/ui/menu_label_spec.rb +68 -0
- data/spec/motion/joybox/ui/menu_spec.rb +26 -0
- data/spec/spec_helpers/cg_point.rb +5 -0
- data/spec/spec_helpers/cg_point_spec.rb +14 -0
- data/template/joybox-ios-example-repl/files/.gitignore +16 -0
- data/template/joybox-ios/files/.gitignore +16 -0
- data/template/joybox-osx-example-repl/files/.gitignore +16 -0
- data/template/joybox-osx/files/.gitignore +16 -0
- data/vendor/vendor-ios/box_2d/box_2d.bridgesupport +1201 -85
- data/vendor/vendor-ios/box_2d/box_2d_include/B2DAABB.h +21 -0
- data/vendor/vendor-ios/box_2d/box_2d_include/B2DBody.h +58 -13
- data/vendor/vendor-ios/box_2d/box_2d_include/B2DBodyDef.h +44 -0
- data/vendor/vendor-ios/box_2d/box_2d_include/B2DBodyTypes.h +20 -0
- data/vendor/vendor-ios/box_2d/box_2d_include/B2DChainShape.h +29 -0
- data/vendor/vendor-ios/box_2d/box_2d_include/B2DCircleShape.h +7 -0
- data/vendor/vendor-ios/box_2d/box_2d_include/B2DColor.h +23 -0
- data/vendor/vendor-ios/box_2d/box_2d_include/B2DContactFilter.h +24 -0
- data/vendor/vendor-ios/box_2d/box_2d_include/B2DContactListener.h +1 -1
- data/vendor/vendor-ios/box_2d/box_2d_include/B2DDestructionListener.h +24 -0
- data/vendor/vendor-ios/box_2d/box_2d_include/B2DDraw.h +54 -0
- data/vendor/vendor-ios/box_2d/box_2d_include/B2DEdgeShape.h +13 -2
- data/vendor/vendor-ios/box_2d/box_2d_include/B2DFilter.h +23 -0
- data/vendor/vendor-ios/box_2d/box_2d_include/B2DFixture.h +47 -0
- data/vendor/vendor-ios/box_2d/box_2d_include/B2DFixtureDef.h +29 -0
- data/vendor/vendor-ios/box_2d/box_2d_include/B2DMassData.h +23 -0
- data/vendor/vendor-ios/box_2d/box_2d_include/B2DPolygonShape.h +14 -1
- data/vendor/vendor-ios/box_2d/box_2d_include/B2DProfile.h +31 -0
- data/vendor/vendor-ios/box_2d/box_2d_include/B2DQueryCallback.h +24 -0
- data/vendor/vendor-ios/box_2d/box_2d_include/B2DRayCastCallback.h +24 -0
- data/vendor/vendor-ios/box_2d/box_2d_include/B2DRayCastInput.h +23 -0
- data/vendor/vendor-ios/box_2d/box_2d_include/B2DRayCastOutput.h +21 -0
- data/vendor/vendor-ios/box_2d/box_2d_include/B2DShape.h +23 -3
- data/vendor/vendor-ios/box_2d/box_2d_include/B2DShapeTypes.h +22 -0
- data/vendor/vendor-ios/box_2d/box_2d_include/B2DTransform.h +21 -0
- data/vendor/vendor-ios/box_2d/box_2d_include/B2DWorld.h +40 -19
- data/vendor/vendor-ios/box_2d/libBox2D.a +0 -0
- data/vendor/vendor-ios/cocos_2d/cocos_2d.bridgesupport +808 -1578
- data/vendor/vendor-ios/cocos_2d/cocos_2d_include/CCActionEase.h +47 -0
- data/vendor/vendor-ios/cocos_2d/cocos_2d_include/CCFontDefinition.h +85 -0
- data/vendor/vendor-ios/cocos_2d/cocos_2d_include/CCLabelTTF.h +54 -6
- data/vendor/vendor-ios/cocos_2d/cocos_2d_include/CCMenuItem.h +1 -0
- data/vendor/vendor-ios/cocos_2d/cocos_2d_include/CCTMXLayer.h +2 -2
- data/vendor/vendor-ios/cocos_2d/cocos_2d_include/CCTexture2D.h +4 -0
- data/vendor/vendor-ios/cocos_2d/cocos_2d_include/ccTypes.h +51 -1
- data/vendor/vendor-ios/cocos_2d/libcocos2d.a +0 -0
- data/vendor/vendor-ios/cocos_builder_reader/cocos_builder_reader.bridgesupport +510 -0
- data/vendor/vendor-ios/cocos_builder_reader/cocos_builder_reader_include/CCBAnimationManager.h +149 -0
- data/vendor/vendor-ios/cocos_builder_reader/cocos_builder_reader_include/CCBKeyframe.h +40 -0
- data/vendor/vendor-ios/cocos_builder_reader/cocos_builder_reader_include/CCBReader.h +176 -0
- data/vendor/vendor-ios/cocos_builder_reader/cocos_builder_reader_include/CCBSequence.h +49 -0
- data/vendor/vendor-ios/cocos_builder_reader/cocos_builder_reader_include/CCBSequenceProperty.h +38 -0
- data/vendor/vendor-ios/cocos_builder_reader/cocos_builder_reader_include/CCNode+CCBRelativePositioning.h +65 -0
- data/vendor/vendor-ios/cocos_builder_reader/libCocosBuilderReader.a +0 -0
- data/vendor/vendor-ios/cocos_denshion/cocos_denshion.bridgesupport +1001 -0
- data/vendor/vendor-ios/cocos_denshion/cocos_denshion_include/CDAudioManager.h +243 -0
- data/vendor/vendor-ios/cocos_denshion/cocos_denshion_include/CDConfig.h +60 -0
- data/vendor/vendor-ios/cocos_denshion/cocos_denshion_include/CDOpenALSupport.h +77 -0
- data/vendor/vendor-ios/cocos_denshion/cocos_denshion_include/CDXMacOSXSupport.h +232 -0
- data/vendor/vendor-ios/cocos_denshion/cocos_denshion_include/CDXPropertyModifierAction.h +45 -0
- data/vendor/vendor-ios/cocos_denshion/cocos_denshion_include/CocosDenshion.h +440 -0
- data/vendor/vendor-ios/cocos_denshion/cocos_denshion_include/SimpleAudioEngine.h +90 -0
- data/vendor/vendor-ios/cocos_denshion/libCocosDenshion.a +0 -0
- data/vendor/vendor-ios/kazmath/kazmath.bridgesupport +865 -0
- data/vendor/vendor-ios/kazmath/kazmath_include/GL/mat4stack.h +51 -0
- data/vendor/vendor-ios/kazmath/kazmath_include/GL/matrix.h +58 -0
- data/vendor/vendor-ios/kazmath/kazmath_include/aabb.h +53 -0
- data/vendor/vendor-ios/kazmath/kazmath_include/kazmath.h +39 -0
- data/vendor/vendor-ios/kazmath/kazmath_include/mat3.h +75 -0
- data/vendor/vendor-ios/kazmath/kazmath_include/mat4.h +93 -0
- data/vendor/vendor-ios/kazmath/kazmath_include/neon_matrix_impl.h +41 -0
- data/vendor/vendor-ios/kazmath/kazmath_include/plane.h +70 -0
- data/vendor/vendor-ios/kazmath/kazmath_include/quaternion.h +113 -0
- data/vendor/vendor-ios/kazmath/kazmath_include/ray2.h +50 -0
- data/vendor/vendor-ios/kazmath/kazmath_include/utility.h +74 -0
- data/vendor/vendor-ios/kazmath/kazmath_include/vec2.h +64 -0
- data/vendor/vendor-ios/kazmath/kazmath_include/vec3.h +68 -0
- data/vendor/vendor-ios/kazmath/kazmath_include/vec4.h +68 -0
- data/vendor/vendor-ios/kazmath/libkazmath.a +0 -0
- data/vendor/vendor-osx/box_2d/box_2d.bridgesupport +1199 -83
- data/vendor/vendor-osx/box_2d/box_2d_include/B2DAABB.h +21 -0
- data/vendor/vendor-osx/box_2d/box_2d_include/B2DBody.h +58 -13
- data/vendor/vendor-osx/box_2d/box_2d_include/B2DBodyDef.h +44 -0
- data/vendor/vendor-osx/box_2d/box_2d_include/B2DBodyTypes.h +20 -0
- data/vendor/vendor-osx/box_2d/box_2d_include/B2DChainShape.h +29 -0
- data/vendor/vendor-osx/box_2d/box_2d_include/B2DCircleShape.h +7 -0
- data/vendor/vendor-osx/box_2d/box_2d_include/B2DColor.h +23 -0
- data/vendor/vendor-osx/box_2d/box_2d_include/B2DContactFilter.h +24 -0
- data/vendor/vendor-osx/box_2d/box_2d_include/B2DContactListener.h +1 -1
- data/vendor/vendor-osx/box_2d/box_2d_include/B2DDestructionListener.h +24 -0
- data/vendor/vendor-osx/box_2d/box_2d_include/B2DDraw.h +54 -0
- data/vendor/vendor-osx/box_2d/box_2d_include/B2DEdgeShape.h +13 -2
- data/vendor/vendor-osx/box_2d/box_2d_include/B2DFilter.h +23 -0
- data/vendor/vendor-osx/box_2d/box_2d_include/B2DFixture.h +47 -0
- data/vendor/vendor-osx/box_2d/box_2d_include/B2DFixtureDef.h +29 -0
- data/vendor/vendor-osx/box_2d/box_2d_include/B2DMassData.h +23 -0
- data/vendor/vendor-osx/box_2d/box_2d_include/B2DPolygonShape.h +14 -1
- data/vendor/vendor-osx/box_2d/box_2d_include/B2DProfile.h +31 -0
- data/vendor/vendor-osx/box_2d/box_2d_include/B2DQueryCallback.h +24 -0
- data/vendor/vendor-osx/box_2d/box_2d_include/B2DRayCastCallback.h +24 -0
- data/vendor/vendor-osx/box_2d/box_2d_include/B2DRayCastInput.h +23 -0
- data/vendor/vendor-osx/box_2d/box_2d_include/B2DRayCastOutput.h +21 -0
- data/vendor/vendor-osx/box_2d/box_2d_include/B2DShape.h +23 -3
- data/vendor/vendor-osx/box_2d/box_2d_include/B2DShapeTypes.h +22 -0
- data/vendor/vendor-osx/box_2d/box_2d_include/B2DTransform.h +21 -0
- data/vendor/vendor-osx/box_2d/box_2d_include/B2DWorld.h +40 -19
- data/vendor/vendor-osx/box_2d/libBox2D.a +0 -0
- data/vendor/vendor-osx/cocos_2d/cocos_2d.bridgesupport +2820 -2633
- data/vendor/vendor-osx/cocos_2d/cocos_2d_include/CCActionEase.h +47 -0
- data/vendor/vendor-osx/cocos_2d/cocos_2d_include/CCFontDefinition.h +85 -0
- data/vendor/vendor-osx/cocos_2d/cocos_2d_include/CCLabelTTF.h +54 -6
- data/vendor/vendor-osx/cocos_2d/cocos_2d_include/CCMenuItem.h +1 -0
- data/vendor/vendor-osx/cocos_2d/cocos_2d_include/CCTMXLayer.h +2 -2
- data/vendor/vendor-osx/cocos_2d/cocos_2d_include/CCTexture2D.h +4 -0
- data/vendor/vendor-osx/cocos_2d/cocos_2d_include/Platforms/iOS/CCDirectorIOS.h +111 -0
- data/vendor/vendor-osx/cocos_2d/cocos_2d_include/Platforms/iOS/CCES2Renderer.h +83 -0
- data/vendor/vendor-osx/cocos_2d/cocos_2d_include/Platforms/iOS/CCESRenderer.h +54 -0
- data/vendor/vendor-osx/cocos_2d/cocos_2d_include/Platforms/iOS/CCGLView.h +175 -0
- data/vendor/vendor-osx/cocos_2d/cocos_2d_include/Platforms/iOS/CCTouchDelegateProtocol.h +75 -0
- data/vendor/vendor-osx/cocos_2d/cocos_2d_include/Platforms/iOS/CCTouchDispatcher.h +120 -0
- data/vendor/vendor-osx/cocos_2d/cocos_2d_include/Platforms/iOS/CCTouchHandler.h +93 -0
- data/vendor/vendor-osx/cocos_2d/cocos_2d_include/ccTypes.h +65 -1
- data/vendor/vendor-osx/cocos_2d/libcocos2d.a +0 -0
- data/vendor/vendor-osx/cocos_builder_reader/cocos_builder_reader.bridgesupport +510 -0
- data/vendor/vendor-osx/cocos_builder_reader/cocos_builder_reader_include/CCBAnimationManager.h +149 -0
- data/vendor/vendor-osx/cocos_builder_reader/cocos_builder_reader_include/CCBKeyframe.h +40 -0
- data/vendor/vendor-osx/cocos_builder_reader/cocos_builder_reader_include/CCBReader.h +176 -0
- data/vendor/vendor-osx/cocos_builder_reader/cocos_builder_reader_include/CCBSequence.h +49 -0
- data/vendor/vendor-osx/cocos_builder_reader/cocos_builder_reader_include/CCBSequenceProperty.h +38 -0
- data/vendor/vendor-osx/cocos_builder_reader/cocos_builder_reader_include/CCNode+CCBRelativePositioning.h +65 -0
- data/vendor/vendor-osx/cocos_builder_reader/libCocosBuilderReader.a +0 -0
- data/vendor/vendor-osx/cocos_denshion/cocos_denshion.bridgesupport +1001 -0
- data/vendor/vendor-osx/cocos_denshion/cocos_denshion_include/CDAudioManager.h +243 -0
- data/vendor/vendor-osx/cocos_denshion/cocos_denshion_include/CDConfig.h +60 -0
- data/vendor/vendor-osx/cocos_denshion/cocos_denshion_include/CDOpenALSupport.h +77 -0
- data/vendor/vendor-osx/cocos_denshion/cocos_denshion_include/CDXMacOSXSupport.h +232 -0
- data/vendor/vendor-osx/cocos_denshion/cocos_denshion_include/CDXPropertyModifierAction.h +45 -0
- data/vendor/vendor-osx/cocos_denshion/cocos_denshion_include/CocosDenshion.h +440 -0
- data/vendor/vendor-osx/cocos_denshion/cocos_denshion_include/SimpleAudioEngine.h +90 -0
- data/vendor/vendor-osx/cocos_denshion/libCocosDenshion.a +0 -0
- data/vendor/vendor-osx/kazmath/kazmath.bridgesupport +865 -0
- data/vendor/vendor-osx/kazmath/kazmath_include/GL/mat4stack.h +51 -0
- data/vendor/vendor-osx/kazmath/kazmath_include/GL/matrix.h +58 -0
- data/vendor/vendor-osx/kazmath/kazmath_include/aabb.h +53 -0
- data/vendor/vendor-osx/kazmath/kazmath_include/kazmath.h +39 -0
- data/vendor/vendor-osx/kazmath/kazmath_include/mat3.h +75 -0
- data/vendor/vendor-osx/kazmath/kazmath_include/mat4.h +93 -0
- data/vendor/vendor-osx/kazmath/kazmath_include/neon_matrix_impl.h +41 -0
- data/vendor/vendor-osx/kazmath/kazmath_include/plane.h +70 -0
- data/vendor/vendor-osx/kazmath/kazmath_include/quaternion.h +113 -0
- data/vendor/vendor-osx/kazmath/kazmath_include/ray2.h +50 -0
- data/vendor/vendor-osx/kazmath/kazmath_include/utility.h +74 -0
- data/vendor/vendor-osx/kazmath/kazmath_include/vec2.h +64 -0
- data/vendor/vendor-osx/kazmath/kazmath_include/vec3.h +68 -0
- data/vendor/vendor-osx/kazmath/kazmath_include/vec4.h +68 -0
- data/vendor/vendor-osx/kazmath/libkazmath.a +0 -0
- metadata +353 -57
- checksums.yaml +0 -15
- data/bin/joybox +0 -49
- data/command/joybox/USAGE +0 -24
- data/motion/joybox-ios/configuration/debug.rb +0 -27
- data/motion/joybox-ios/debug/debug.rb +0 -10
- data/motion/joybox-osx/configuration/debug.rb +0 -27
- data/motion/joybox-osx/configuration/sprite_view.rb +0 -91
- data/motion/joybox-osx/debug/debug.rb +0 -10
- data/motion/joybox/core/ns_object.rb +0 -8
- data/spec/lib/joybox/cocos2d/cocos2d_spec.rb +0 -7
- data/spec/lib/joybox/cocos2d/macros_spec.rb +0 -37
- data/vendor/vendor-ios/cocos_2d/cocos_2d_include/cocos2d-ios-exceptions.bridgesupport +0 -39
- data/vendor/vendor-ios/cocos_2d/cocos_2d_include/gen_cocos2d_bridgesupport.sh +0 -17
- data/vendor/vendor-ios/cocos_2d/cocos_2d_include/gen_cocos2d_complement.sh +0 -17
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* cocos2d for iPhone: http://www.cocos2d-iphone.org
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 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
|
+
* File autogenerated with Xcode. Adapted for cocos2d needs.
|
|
27
|
+
*/
|
|
28
|
+
|
|
29
|
+
// Only compile this code on iOS. These files should NOT be included on your Mac project.
|
|
30
|
+
// But in case they are included, it won't be compiled.
|
|
31
|
+
#import "../../ccMacros.h"
|
|
32
|
+
#ifdef __CC_PLATFORM_IOS
|
|
33
|
+
|
|
34
|
+
#import <QuartzCore/QuartzCore.h>
|
|
35
|
+
|
|
36
|
+
#import <OpenGLES/EAGL.h>
|
|
37
|
+
#import <OpenGLES/EAGLDrawable.h>
|
|
38
|
+
|
|
39
|
+
@protocol CCESRenderer <NSObject>
|
|
40
|
+
|
|
41
|
+
- (id) initWithDepthFormat:(unsigned int)depthFormat withPixelFormat:(unsigned int)pixelFormat withSharegroup:(EAGLSharegroup*)sharegroup withMultiSampling:(BOOL) multiSampling withNumberOfSamples:(unsigned int) requestedSamples;
|
|
42
|
+
|
|
43
|
+
- (BOOL) resizeFromLayer:(CAEAGLLayer *)layer;
|
|
44
|
+
|
|
45
|
+
- (EAGLContext*) context;
|
|
46
|
+
- (CGSize) backingSize;
|
|
47
|
+
|
|
48
|
+
- (unsigned int) colorRenderBuffer;
|
|
49
|
+
- (unsigned int) defaultFrameBuffer;
|
|
50
|
+
- (unsigned int) msaaFrameBuffer;
|
|
51
|
+
- (unsigned int) msaaColorBuffer;
|
|
52
|
+
@end
|
|
53
|
+
|
|
54
|
+
#endif // __CC_PLATFORM_IOS
|
|
@@ -0,0 +1,175 @@
|
|
|
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: CCGLView.h
|
|
19
|
+
Abstract: Convenience class that wraps the CAEAGLLayer from CoreAnimation into a
|
|
20
|
+
UIView subclass.
|
|
21
|
+
|
|
22
|
+
Version: 1.3
|
|
23
|
+
|
|
24
|
+
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple Inc.
|
|
25
|
+
("Apple") in consideration of your agreement to the following terms, and your
|
|
26
|
+
use, installation, modification or redistribution of this Apple software
|
|
27
|
+
constitutes acceptance of these terms. If you do not agree with these terms,
|
|
28
|
+
please do not use, install, modify or redistribute this Apple software.
|
|
29
|
+
|
|
30
|
+
In consideration of your agreement to abide by the following terms, and subject
|
|
31
|
+
to these terms, Apple grants you a personal, non-exclusive license, under
|
|
32
|
+
Apple's copyrights in this original Apple software (the "Apple Software"), to
|
|
33
|
+
use, reproduce, modify and redistribute the Apple Software, with or without
|
|
34
|
+
modifications, in source and/or binary forms; provided that if you redistribute
|
|
35
|
+
the Apple Software in its entirety and without modifications, you must retain
|
|
36
|
+
this notice and the following text and disclaimers in all such redistributions
|
|
37
|
+
of the Apple Software.
|
|
38
|
+
Neither the name, trademarks, service marks or logos of Apple Inc. may be used
|
|
39
|
+
to endorse or promote products derived from the Apple Software without specific
|
|
40
|
+
prior written permission from Apple. Except as expressly stated in this notice,
|
|
41
|
+
no other rights or licenses, express or implied, are granted by Apple herein,
|
|
42
|
+
including but not limited to any patent rights that may be infringed by your
|
|
43
|
+
derivative works or by other works in which the Apple Software may be
|
|
44
|
+
incorporated.
|
|
45
|
+
|
|
46
|
+
The Apple Software is provided by Apple on an "AS IS" basis. APPLE MAKES NO
|
|
47
|
+
WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED
|
|
48
|
+
WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
|
49
|
+
PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND OPERATION ALONE OR IN
|
|
50
|
+
COMBINATION WITH YOUR PRODUCTS.
|
|
51
|
+
|
|
52
|
+
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR
|
|
53
|
+
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
|
|
54
|
+
GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
55
|
+
ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR
|
|
56
|
+
DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF
|
|
57
|
+
CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF
|
|
58
|
+
APPLE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
59
|
+
|
|
60
|
+
Copyright (C) 2008 Apple Inc. All Rights Reserved.
|
|
61
|
+
|
|
62
|
+
*/
|
|
63
|
+
|
|
64
|
+
// Only compile this code on iOS. These files should NOT be included on your Mac project.
|
|
65
|
+
// But in case they are included, it won't be compiled.
|
|
66
|
+
#import "../../ccMacros.h"
|
|
67
|
+
#ifdef __CC_PLATFORM_IOS
|
|
68
|
+
|
|
69
|
+
#import <UIKit/UIKit.h>
|
|
70
|
+
#import <OpenGLES/EAGL.h>
|
|
71
|
+
#import <OpenGLES/EAGLDrawable.h>
|
|
72
|
+
#import <OpenGLES/ES2/gl.h>
|
|
73
|
+
#import <OpenGLES/ES2/glext.h>
|
|
74
|
+
|
|
75
|
+
#import "CCESRenderer.h"
|
|
76
|
+
|
|
77
|
+
//CLASSES:
|
|
78
|
+
|
|
79
|
+
@class CCGLView;
|
|
80
|
+
|
|
81
|
+
//PROTOCOLS:
|
|
82
|
+
|
|
83
|
+
@protocol CCTouchDelegate <NSObject>
|
|
84
|
+
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event;
|
|
85
|
+
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event;
|
|
86
|
+
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event;
|
|
87
|
+
- (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event;
|
|
88
|
+
@end
|
|
89
|
+
|
|
90
|
+
//CLASS INTERFACE:
|
|
91
|
+
|
|
92
|
+
/** CCGLView Class.
|
|
93
|
+
This class wraps the CAEAGLLayer from CoreAnimation into a convenient UIView subclass.
|
|
94
|
+
The view content is basically an EAGL surface you render your OpenGL scene into.
|
|
95
|
+
Note that setting the view non-opaque will only work if the EAGL surface has an alpha channel.
|
|
96
|
+
|
|
97
|
+
Parameters:
|
|
98
|
+
|
|
99
|
+
- viewWithFrame: size of the OpenGL view. For full screen use [_window bounds]
|
|
100
|
+
- Possible values: any CGRect
|
|
101
|
+
- pixelFormat: Format of the render buffer. Use RGBA8 for better color precision (eg: gradients). But it takes more memory and it is slower
|
|
102
|
+
- Possible values: kEAGLColorFormatRGBA8, kEAGLColorFormatRGB565
|
|
103
|
+
- depthFormat: Use stencil if you plan to use CCClippingNode. Use Depth if you plan to use 3D effects, like CCCamera or CCNode#vertexZ
|
|
104
|
+
- Possible values: 0, GL_DEPTH_COMPONENT24_OES, GL_DEPTH24_STENCIL8_OES
|
|
105
|
+
- sharegroup: OpenGL sharegroup. Useful if you want to share the same OpenGL context between different threads
|
|
106
|
+
- Possible values: nil, or any valid EAGLSharegroup group
|
|
107
|
+
- multiSampling: Whether or not to enable multisampling
|
|
108
|
+
- Possible values: YES, NO
|
|
109
|
+
- numberOfSamples: Only valid if multisampling is enabled
|
|
110
|
+
- Possible values: 0 to glGetIntegerv(GL_MAX_SAMPLES_APPLE)
|
|
111
|
+
*/
|
|
112
|
+
@interface CCGLView : UIView
|
|
113
|
+
{
|
|
114
|
+
id<CCESRenderer> _renderer;
|
|
115
|
+
EAGLContext *_context; // weak ref
|
|
116
|
+
|
|
117
|
+
NSString *_pixelformat;
|
|
118
|
+
GLuint _depthFormat;
|
|
119
|
+
BOOL _preserveBackbuffer;
|
|
120
|
+
|
|
121
|
+
CGSize _size;
|
|
122
|
+
BOOL _discardFramebufferSupported;
|
|
123
|
+
id<CCTouchDelegate> _touchDelegate;
|
|
124
|
+
|
|
125
|
+
//fsaa addition
|
|
126
|
+
BOOL _multisampling;
|
|
127
|
+
unsigned int _requestedSamples;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/** creates an initializes an CCGLView with a frame and 0-bit depth buffer, and a RGB565 color buffer. */
|
|
131
|
+
+ (id) viewWithFrame:(CGRect)frame;
|
|
132
|
+
/** creates an initializes an CCGLView with a frame, a color buffer format, and 0-bit depth buffer. */
|
|
133
|
+
+ (id) viewWithFrame:(CGRect)frame pixelFormat:(NSString*)format;
|
|
134
|
+
/** creates an initializes an CCGLView with a frame, a color buffer format, and a depth buffer. */
|
|
135
|
+
+ (id) viewWithFrame:(CGRect)frame pixelFormat:(NSString*)format depthFormat:(GLuint)depth;
|
|
136
|
+
/** creates an initializes an CCGLView with a frame, a color buffer format, a depth buffer format, a sharegroup, and multisamping */
|
|
137
|
+
+ (id) viewWithFrame:(CGRect)frame pixelFormat:(NSString*)format depthFormat:(GLuint)depth preserveBackbuffer:(BOOL)retained sharegroup:(EAGLSharegroup*)sharegroup multiSampling:(BOOL)multisampling numberOfSamples:(unsigned int)samples;
|
|
138
|
+
|
|
139
|
+
/** Initializes an CCGLView with a frame and 0-bit depth buffer, and a RGB565 color buffer */
|
|
140
|
+
- (id) initWithFrame:(CGRect)frame; //These also set the current context
|
|
141
|
+
/** Initializes an CCGLView with a frame, a color buffer format, and 0-bit depth buffer */
|
|
142
|
+
- (id) initWithFrame:(CGRect)frame pixelFormat:(NSString*)format;
|
|
143
|
+
/** Initializes an CCGLView with a frame, a color buffer format, a depth buffer format, a sharegroup and multisampling support */
|
|
144
|
+
- (id) initWithFrame:(CGRect)frame pixelFormat:(NSString*)format depthFormat:(GLuint)depth preserveBackbuffer:(BOOL)retained sharegroup:(EAGLSharegroup*)sharegroup multiSampling:(BOOL)sampling numberOfSamples:(unsigned int)nSamples;
|
|
145
|
+
|
|
146
|
+
/** pixel format: it could be RGBA8 (32-bit) or RGB565 (16-bit) */
|
|
147
|
+
@property(nonatomic,readonly) NSString* pixelFormat;
|
|
148
|
+
/** depth format of the render buffer: 0, 16 or 24 bits*/
|
|
149
|
+
@property(nonatomic,readonly) GLuint depthFormat;
|
|
150
|
+
|
|
151
|
+
/** returns surface size in pixels */
|
|
152
|
+
@property(nonatomic,readonly) CGSize surfaceSize;
|
|
153
|
+
|
|
154
|
+
/** OpenGL context */
|
|
155
|
+
@property(nonatomic,readonly) EAGLContext *context;
|
|
156
|
+
|
|
157
|
+
@property(nonatomic,readwrite) BOOL multiSampling;
|
|
158
|
+
|
|
159
|
+
/** touch delegate */
|
|
160
|
+
@property(nonatomic,readwrite,assign) id<CCTouchDelegate> touchDelegate;
|
|
161
|
+
|
|
162
|
+
/** CCGLView uses double-buffer. This method swaps the buffers */
|
|
163
|
+
-(void) swapBuffers;
|
|
164
|
+
|
|
165
|
+
/** uses and locks the OpenGL context */
|
|
166
|
+
-(void) lockOpenGLContext;
|
|
167
|
+
|
|
168
|
+
/** unlocks the openGL context */
|
|
169
|
+
-(void) unlockOpenGLContext;
|
|
170
|
+
|
|
171
|
+
- (CGPoint) convertPointFromViewToSurface:(CGPoint)point;
|
|
172
|
+
- (CGRect) convertRectFromViewToSurface:(CGRect)rect;
|
|
173
|
+
@end
|
|
174
|
+
|
|
175
|
+
#endif // __CC_PLATFORM_IOS
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* cocos2d for iPhone: http://www.cocos2d-iphone.org
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 2009 Valentin Milea
|
|
5
|
+
*
|
|
6
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
* in the Software without restriction, including without limitation the rights
|
|
9
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
* furnished to do so, subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be included in
|
|
14
|
+
* all copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
22
|
+
* THE SOFTWARE.
|
|
23
|
+
*
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
// Only compile this code on iOS. These files should NOT be included on your Mac project.
|
|
27
|
+
// But in case they are included, it won't be compiled.
|
|
28
|
+
#import "../../ccMacros.h"
|
|
29
|
+
#ifdef __CC_PLATFORM_IOS
|
|
30
|
+
|
|
31
|
+
#import <UIKit/UIKit.h>
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
CCTouchOneByOneDelegate.
|
|
35
|
+
|
|
36
|
+
Using this type of delegate results in two benefits:
|
|
37
|
+
1. You don't need to deal with NSSets, the dispatcher does the job of splitting
|
|
38
|
+
them. You get exactly one UITouch per call.
|
|
39
|
+
2. You can *claim* a UITouch by returning YES in ccTouchBegan. Updates of claimed
|
|
40
|
+
touches are sent only to the delegate(s) that claimed them. So if you get a move/
|
|
41
|
+
ended/cancelled update you're sure it is your touch. This frees you from doing a
|
|
42
|
+
lot of checks when doing multi-touch.
|
|
43
|
+
|
|
44
|
+
(The name TargetedTouchDelegate relates to updates "targeting" their specific
|
|
45
|
+
handler, without bothering the other handlers.)
|
|
46
|
+
@since v0.8
|
|
47
|
+
*/
|
|
48
|
+
@protocol CCTouchOneByOneDelegate <NSObject>
|
|
49
|
+
|
|
50
|
+
/** Return YES to claim the touch.
|
|
51
|
+
@since v0.8
|
|
52
|
+
*/
|
|
53
|
+
- (BOOL)ccTouchBegan:(UITouch *)touch withEvent:(UIEvent *)event;
|
|
54
|
+
@optional
|
|
55
|
+
// touch updates:
|
|
56
|
+
- (void)ccTouchMoved:(UITouch *)touch withEvent:(UIEvent *)event;
|
|
57
|
+
- (void)ccTouchEnded:(UITouch *)touch withEvent:(UIEvent *)event;
|
|
58
|
+
- (void)ccTouchCancelled:(UITouch *)touch withEvent:(UIEvent *)event;
|
|
59
|
+
@end
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
CCTouchAllAtOnceDelegate.
|
|
63
|
+
|
|
64
|
+
This type of delegate is the same one used by CocoaTouch. You will receive all the events (Began,Moved,Ended,Cancelled).
|
|
65
|
+
@since v0.8
|
|
66
|
+
*/
|
|
67
|
+
@protocol CCTouchAllAtOnceDelegate <NSObject>
|
|
68
|
+
@optional
|
|
69
|
+
- (void)ccTouchesBegan:(NSSet *)touches withEvent:(UIEvent *)event;
|
|
70
|
+
- (void)ccTouchesMoved:(NSSet *)touches withEvent:(UIEvent *)event;
|
|
71
|
+
- (void)ccTouchesEnded:(NSSet *)touches withEvent:(UIEvent *)event;
|
|
72
|
+
- (void)ccTouchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event;
|
|
73
|
+
@end
|
|
74
|
+
|
|
75
|
+
#endif // __CC_PLATFORM_IOS
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* cocos2d for iPhone: http://www.cocos2d-iphone.org
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 2009 Valentin Milea
|
|
5
|
+
*
|
|
6
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
* in the Software without restriction, including without limitation the rights
|
|
9
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
* furnished to do so, subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be included in
|
|
14
|
+
* all copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
22
|
+
* THE SOFTWARE.
|
|
23
|
+
*
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
// Only compile this code on iOS. These files should NOT be included on your Mac project.
|
|
27
|
+
// But in case they are included, it won't be compiled.
|
|
28
|
+
#import "../../ccMacros.h"
|
|
29
|
+
#ifdef __CC_PLATFORM_IOS
|
|
30
|
+
|
|
31
|
+
#import "CCTouchDelegateProtocol.h"
|
|
32
|
+
#import "CCGLView.h"
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
typedef enum
|
|
36
|
+
{
|
|
37
|
+
kCCTouchSelectorBeganBit = 1 << 0,
|
|
38
|
+
kCCTouchSelectorMovedBit = 1 << 1,
|
|
39
|
+
kCCTouchSelectorEndedBit = 1 << 2,
|
|
40
|
+
kCCTouchSelectorCancelledBit = 1 << 3,
|
|
41
|
+
kCCTouchSelectorAllBits = ( kCCTouchSelectorBeganBit | kCCTouchSelectorMovedBit | kCCTouchSelectorEndedBit | kCCTouchSelectorCancelledBit),
|
|
42
|
+
} ccTouchSelectorFlag;
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
enum {
|
|
46
|
+
kCCTouchBegan,
|
|
47
|
+
kCCTouchMoved,
|
|
48
|
+
kCCTouchEnded,
|
|
49
|
+
kCCTouchCancelled,
|
|
50
|
+
|
|
51
|
+
kCCTouchMax,
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
struct ccTouchHandlerHelperData {
|
|
55
|
+
SEL touchesSel;
|
|
56
|
+
SEL touchSel;
|
|
57
|
+
ccTouchSelectorFlag type;
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
/** CCTouchDispatcher.
|
|
61
|
+
Object that handles all the touch events.
|
|
62
|
+
The dispatcher dispatches events to the registered TouchHandlers.
|
|
63
|
+
There are 2 different type of touch handlers:
|
|
64
|
+
- Standard Touch Handlers
|
|
65
|
+
- Targeted Touch Handlers
|
|
66
|
+
|
|
67
|
+
The Standard Touch Handlers work like the CocoaTouch touch handler: a set of touches is passed to the delegate.
|
|
68
|
+
On the other hand, the Targeted Touch Handlers only receive 1 touch at the time, and they can "swallow" touches (avoid the propagation of the event).
|
|
69
|
+
|
|
70
|
+
Firstly, the dispatcher sends the received touches to the targeted touches.
|
|
71
|
+
These touches can be swallowed by the Targeted Touch Handlers. If there are still remaining touches, then the remaining touches will be sent
|
|
72
|
+
to the Standard Touch Handlers.
|
|
73
|
+
|
|
74
|
+
@since v0.8.0
|
|
75
|
+
*/
|
|
76
|
+
@interface CCTouchDispatcher : NSObject <CCTouchDelegate>
|
|
77
|
+
{
|
|
78
|
+
NSMutableArray *targetedHandlers;
|
|
79
|
+
NSMutableArray *standardHandlers;
|
|
80
|
+
|
|
81
|
+
BOOL locked;
|
|
82
|
+
BOOL toAdd;
|
|
83
|
+
BOOL toRemove;
|
|
84
|
+
NSMutableArray *handlersToAdd;
|
|
85
|
+
NSMutableArray *handlersToRemove;
|
|
86
|
+
BOOL toQuit;
|
|
87
|
+
|
|
88
|
+
BOOL dispatchEvents;
|
|
89
|
+
|
|
90
|
+
// 4, 1 for each type of event
|
|
91
|
+
struct ccTouchHandlerHelperData handlerHelperData[kCCTouchMax];
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/** Whether or not the events are going to be dispatched. Default: YES */
|
|
95
|
+
@property (nonatomic,readwrite, assign) BOOL dispatchEvents;
|
|
96
|
+
|
|
97
|
+
/** Adds a standard touch delegate to the dispatcher's list.
|
|
98
|
+
See StandardTouchDelegate description.
|
|
99
|
+
IMPORTANT: The delegate will be retained.
|
|
100
|
+
*/
|
|
101
|
+
-(void) addStandardDelegate:(id<CCTouchAllAtOnceDelegate>) delegate priority:(int)priority;
|
|
102
|
+
/** Adds a targeted touch delegate to the dispatcher's list.
|
|
103
|
+
See TargetedTouchDelegate description.
|
|
104
|
+
IMPORTANT: The delegate will be retained.
|
|
105
|
+
*/
|
|
106
|
+
-(void) addTargetedDelegate:(id<CCTouchOneByOneDelegate>) delegate priority:(int)priority swallowsTouches:(BOOL)swallowsTouches;
|
|
107
|
+
/** Removes a touch delegate.
|
|
108
|
+
The delegate will be released
|
|
109
|
+
*/
|
|
110
|
+
-(void) removeDelegate:(id) delegate;
|
|
111
|
+
/** Removes all touch delegates, releasing all the delegates */
|
|
112
|
+
-(void) removeAllDelegates;
|
|
113
|
+
/** Changes the priority of a previously added delegate. The lower the number,
|
|
114
|
+
the higher the priority */
|
|
115
|
+
-(void) setPriority:(int) priority forDelegate:(id) delegate;
|
|
116
|
+
|
|
117
|
+
NSComparisonResult sortByPriority(id first, id second, void *context);
|
|
118
|
+
@end
|
|
119
|
+
|
|
120
|
+
#endif // __CC_PLATFORM_IOS
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* cocos2d for iPhone: http://www.cocos2d-iphone.org
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 2009 Valentin Milea
|
|
5
|
+
*
|
|
6
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
* in the Software without restriction, including without limitation the rights
|
|
9
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
* furnished to do so, subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be included in
|
|
14
|
+
* all copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
22
|
+
* THE SOFTWARE.
|
|
23
|
+
*
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
// Only compile this code on iOS. These files should NOT be included on your Mac project.
|
|
27
|
+
// But in case they are included, it won't be compiled.
|
|
28
|
+
#import "../../ccMacros.h"
|
|
29
|
+
#ifdef __CC_PLATFORM_IOS
|
|
30
|
+
|
|
31
|
+
/*
|
|
32
|
+
* This file contains the delegates of the touches
|
|
33
|
+
* There are 2 possible delegates:
|
|
34
|
+
* - CCStandardTouchHandler: propagates all the events at once
|
|
35
|
+
* - CCTargetedTouchHandler: propagates 1 event at the time
|
|
36
|
+
*/
|
|
37
|
+
|
|
38
|
+
#import "CCTouchDelegateProtocol.h"
|
|
39
|
+
#import "CCTouchDispatcher.h"
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
CCTouchHandler
|
|
43
|
+
Object than contains the delegate and priority of the event handler.
|
|
44
|
+
*/
|
|
45
|
+
@interface CCTouchHandler : NSObject {
|
|
46
|
+
id _delegate;
|
|
47
|
+
int _priority;
|
|
48
|
+
ccTouchSelectorFlag _enabledSelectors;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/** delegate */
|
|
52
|
+
@property(nonatomic, readwrite, retain) id delegate;
|
|
53
|
+
/** priority */
|
|
54
|
+
@property(nonatomic, readwrite) int priority; // default 0
|
|
55
|
+
/** enabled selectors */
|
|
56
|
+
@property(nonatomic,readwrite) ccTouchSelectorFlag enabledSelectors;
|
|
57
|
+
|
|
58
|
+
/** allocates a TouchHandler with a delegate and a priority */
|
|
59
|
+
+ (id)handlerWithDelegate:(id)aDelegate priority:(int)priority;
|
|
60
|
+
/** initializes a TouchHandler with a delegate and a priority */
|
|
61
|
+
- (id)initWithDelegate:(id)aDelegate priority:(int)priority;
|
|
62
|
+
@end
|
|
63
|
+
|
|
64
|
+
/** CCStandardTouchHandler
|
|
65
|
+
It forwards each event to the delegate.
|
|
66
|
+
*/
|
|
67
|
+
@interface CCStandardTouchHandler : CCTouchHandler
|
|
68
|
+
{
|
|
69
|
+
}
|
|
70
|
+
@end
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
CCTargetedTouchHandler
|
|
74
|
+
Object than contains the claimed touches and if it swallows touches.
|
|
75
|
+
Used internally by TouchDispatcher
|
|
76
|
+
*/
|
|
77
|
+
@interface CCTargetedTouchHandler : CCTouchHandler {
|
|
78
|
+
BOOL _swallowsTouches;
|
|
79
|
+
NSMutableSet *_claimedTouches;
|
|
80
|
+
}
|
|
81
|
+
/** whether or not the touches are swallowed */
|
|
82
|
+
@property(nonatomic, readwrite) BOOL swallowsTouches; // default NO
|
|
83
|
+
/** MutableSet that contains the claimed touches */
|
|
84
|
+
@property(nonatomic, readonly) NSMutableSet *claimedTouches;
|
|
85
|
+
|
|
86
|
+
/** allocates a TargetedTouchHandler with a delegate, a priority and whether or not it swallows touches or not */
|
|
87
|
+
+ (id)handlerWithDelegate:(id) aDelegate priority:(int)priority swallowsTouches:(BOOL)swallowsTouches;
|
|
88
|
+
/** initializes a TargetedTouchHandler with a delegate, a priority and whether or not it swallows touches or not */
|
|
89
|
+
- (id)initWithDelegate:(id) aDelegate priority:(int)priority swallowsTouches:(BOOL)swallowsTouches;
|
|
90
|
+
|
|
91
|
+
@end
|
|
92
|
+
|
|
93
|
+
#endif // __CC_PLATFORM_IOS
|