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,17 @@
|
|
|
1
|
+
describe Joybox::Physics::RayCastInput do
|
|
2
|
+
|
|
3
|
+
it "should convert between coordinate systems" do
|
|
4
|
+
ray_cast_input = RayCastInput.new
|
|
5
|
+
|
|
6
|
+
ray_cast_input.first_point = [32, 32]
|
|
7
|
+
ray_cast_input.second_point = [32, 32]
|
|
8
|
+
ray_cast_input.metric_first_point.should == CGPointMake(1, 1)
|
|
9
|
+
ray_cast_input.metric_second_point.should == CGPointMake(1, 1)
|
|
10
|
+
|
|
11
|
+
ray_cast_input.metric_first_point = [2, 2]
|
|
12
|
+
ray_cast_input.metric_second_point = [2, 2]
|
|
13
|
+
ray_cast_input.first_point.should == CGPointMake(64, 64)
|
|
14
|
+
ray_cast_input.second_point.should == CGPointMake(64, 64)
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
end
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
describe Joybox::Physics::RayCastOutput do
|
|
2
|
+
|
|
3
|
+
it "should convert between coordinate systems" do
|
|
4
|
+
ray_cast_output = RayCastOutput.new
|
|
5
|
+
|
|
6
|
+
ray_cast_output.normal = [32, 32]
|
|
7
|
+
ray_cast_output.metric_normal.should == CGPointMake(1, 1)
|
|
8
|
+
|
|
9
|
+
ray_cast_output.metric_normal = [2, 2]
|
|
10
|
+
ray_cast_output.normal.should == CGPointMake(64, 64)
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
end
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
describe Joybox::Physics::Shape do
|
|
2
|
+
before do
|
|
3
|
+
@world = World.new gravity: [0, -9.8]
|
|
4
|
+
@body = @world.new_body position: [100, 100], type: Body::Dynamic do
|
|
5
|
+
circle_fixture radius: 60,
|
|
6
|
+
density: 1.0,
|
|
7
|
+
friction: 1.0,
|
|
8
|
+
restitution: 1.0
|
|
9
|
+
end
|
|
10
|
+
@shape = @body.fixtures[0].shape
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
it "should have radius" do
|
|
14
|
+
@shape.radius.should == 60
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
it "should know if contains a point" do
|
|
18
|
+
@shape.contains_point?([0, 0]).should == true
|
|
19
|
+
@shape.contains_point?([30, 30]).should == true
|
|
20
|
+
@shape.contains_point?([61, 61]).should == false
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
it "should ray cast the shape" do
|
|
24
|
+
ray_cast_notified = false
|
|
25
|
+
|
|
26
|
+
@shape.ray_cast first_point:[60, 60],
|
|
27
|
+
second_point:[1, 1],
|
|
28
|
+
maximum_fraction: 20,
|
|
29
|
+
child_index: 0 do |hits, normal, fraction|
|
|
30
|
+
ray_cast_notified = true
|
|
31
|
+
hits.should == true
|
|
32
|
+
normal.should.be.close CGPointMake(22.62, 22.62), 0.01
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
ray_cast_notified.should == true
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
it "should compute its aabb" do
|
|
39
|
+
aabb = @shape.compute_aabb child_index: 0
|
|
40
|
+
aabb.lower_bound.should == CGPointMake(-60, -60)
|
|
41
|
+
aabb.upper_bound.should == CGPointMake(60, 60)
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
it "should compute its mass" do
|
|
45
|
+
mass_data = @shape.compute_mass density: 1
|
|
46
|
+
mass_data.mass.should.be.close 11.044, 0.01
|
|
47
|
+
mass_data.center.should == CGPointMake(0, 0)
|
|
48
|
+
mass_data.rotational_inertia.should.be.close 19.414, 0.01
|
|
49
|
+
end
|
|
50
|
+
end
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
describe Joybox::Physics::Transform do
|
|
2
|
+
|
|
3
|
+
it "should convert between coordinate systems" do
|
|
4
|
+
transform = Transform.new
|
|
5
|
+
|
|
6
|
+
transform.position = [32, 32]
|
|
7
|
+
transform.metric_position.should == CGPointMake(1, 1)
|
|
8
|
+
|
|
9
|
+
transform.metric_position = [2, 2]
|
|
10
|
+
transform.position.should == CGPointMake(64, 64)
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
end
|
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
describe Joybox::Physics::World do
|
|
2
|
+
describe "Initialization" do
|
|
3
|
+
it "should initialize with gravity" do
|
|
4
|
+
world = World.new gravity: [10, 10]
|
|
5
|
+
world.should.not == nil
|
|
6
|
+
world.gravity.should == CGPointMake(10, 10)
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
it "should initialize with gravity and allows_sleeping" do
|
|
10
|
+
world = World.new gravity: [10, 10], allows_sleeping: true
|
|
11
|
+
world.should.not == nil
|
|
12
|
+
world.gravity.should == CGPointMake(10, 10)
|
|
13
|
+
world.allows_sleeping?.should == true
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
it "should auto clear forces" do
|
|
18
|
+
world = World.new gravity: [10, 10], allows_sleeping: true
|
|
19
|
+
world.should.not == nil
|
|
20
|
+
world.auto_clear_forces = true
|
|
21
|
+
world.auto_clear_forces?.should == true
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
it "should create new bodies" do
|
|
25
|
+
world = World.new gravity: [0, -9.8]
|
|
26
|
+
body = world.new_body position: [100, 100]
|
|
27
|
+
body.should.not == nil
|
|
28
|
+
body.position.should == CGPointMake(100, 100)
|
|
29
|
+
world.bodies.size.should == 1
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
it "should destroy bodies" do
|
|
33
|
+
world = World.new gravity: [0, -9.8]
|
|
34
|
+
body = world.new_body position: [100, 100]
|
|
35
|
+
body.should.not == nil
|
|
36
|
+
|
|
37
|
+
world.destroy_body(body)
|
|
38
|
+
world.bodies.size.should == 0
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
it "should step into the simulation" do
|
|
42
|
+
world = World.new gravity: [0, -9.8]
|
|
43
|
+
|
|
44
|
+
static_body = world.new_body position: [100, 100]
|
|
45
|
+
static_body.position.should == CGPointMake(100, 100)
|
|
46
|
+
dynamic_body = world.new_body position: [100, 100], type: Body::Dynamic
|
|
47
|
+
dynamic_body.position.should == CGPointMake(100, 100)
|
|
48
|
+
kinematic_body = world.new_body position: [100, 100], type: Body::Kinematic
|
|
49
|
+
kinematic_body.position.should == CGPointMake(100, 100)
|
|
50
|
+
|
|
51
|
+
world.step delta: 100
|
|
52
|
+
static_body.position.should == CGPointMake(100, 100)
|
|
53
|
+
dynamic_body.position.should.be.close CGPointMake(100, 36), 0.001
|
|
54
|
+
kinematic_body.position.should == CGPointMake(100, 100)
|
|
55
|
+
|
|
56
|
+
world.step delta: 10, velocity_interactions:10, position_interactions: 2
|
|
57
|
+
static_body.position.should == CGPointMake(100, 100)
|
|
58
|
+
dynamic_body.position.should.be.close CGPointMake(100, -28.0), 0.001
|
|
59
|
+
kinematic_body.position.should == CGPointMake(100, 100)
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
it "should change its gravity" do
|
|
63
|
+
world = World.new gravity: [0, -9.8]
|
|
64
|
+
|
|
65
|
+
body = world.new_body position: [100, 100], type: Body::Dynamic
|
|
66
|
+
body.position.should == CGPointMake(100, 100)
|
|
67
|
+
|
|
68
|
+
world.step delta: 10
|
|
69
|
+
body.position.should.be.close CGPointMake(100, 36), 0.001
|
|
70
|
+
|
|
71
|
+
world.gravity = [0, 9.8]
|
|
72
|
+
world.step delta: 10
|
|
73
|
+
body.position.should.be.close CGPointMake(100, 100), 0.001
|
|
74
|
+
|
|
75
|
+
world.destroy_body(body)
|
|
76
|
+
|
|
77
|
+
body = world.new_body position: [100, 100], type: Body::Dynamic
|
|
78
|
+
body.position.should == CGPointMake(100, 100)
|
|
79
|
+
|
|
80
|
+
world.gravity = [-9.8, 0]
|
|
81
|
+
world.step delta: 100
|
|
82
|
+
body.position.should.be.close CGPointMake(36, 100), 0.001
|
|
83
|
+
|
|
84
|
+
world.gravity = [9.8, 0]
|
|
85
|
+
world.step delta: 100
|
|
86
|
+
body.position.should.be.close CGPointMake(100, 100), 0.001
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
it "should have a profile" do
|
|
90
|
+
world = World.new gravity: [0, -9.8]
|
|
91
|
+
|
|
92
|
+
world.profile.step.should == 0
|
|
93
|
+
world.profile.collide.should == 0
|
|
94
|
+
world.profile.solve.should == 0
|
|
95
|
+
world.profile.solve_init.should == 0
|
|
96
|
+
world.profile.solve_velocity.should == 0
|
|
97
|
+
world.profile.solve_position.should == 0
|
|
98
|
+
world.profile.broadphase.should == 0
|
|
99
|
+
world.profile.solve_TOI.should == 0
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
it "should filter body collisions" do
|
|
103
|
+
world = World.new gravity: [0, -9.8]
|
|
104
|
+
|
|
105
|
+
first_body = world.new_body position: [100, 100], type: Body::Dynamic do
|
|
106
|
+
polygon_fixture box: [16, 16]
|
|
107
|
+
end
|
|
108
|
+
|
|
109
|
+
second_body = world.new_body position: [100, 100], type: Body::Dynamic do
|
|
110
|
+
polygon_fixture box: [16, 16]
|
|
111
|
+
end
|
|
112
|
+
|
|
113
|
+
collision_filter_notified = false
|
|
114
|
+
|
|
115
|
+
world.should_collide do |first_fixture, second_fixture|
|
|
116
|
+
collision_filter_notified = true
|
|
117
|
+
first_fixture.should.not == nil
|
|
118
|
+
second_fixture.should.not == nil
|
|
119
|
+
first_fixture.body.should.not == nil
|
|
120
|
+
second_fixture.body.should.not == nil
|
|
121
|
+
true
|
|
122
|
+
end
|
|
123
|
+
|
|
124
|
+
world.step delta: 10
|
|
125
|
+
collision_filter_notified.should == true
|
|
126
|
+
end
|
|
127
|
+
|
|
128
|
+
it "should notify body collisions" do
|
|
129
|
+
world = World.new gravity: [0, -9.8]
|
|
130
|
+
|
|
131
|
+
body_one = world.new_body position: [100, 100], type: KDynamicBodyType do
|
|
132
|
+
polygon_fixture box: [16, 16]
|
|
133
|
+
end
|
|
134
|
+
|
|
135
|
+
body_one[:message] = 'First Body'
|
|
136
|
+
|
|
137
|
+
body_two = world.new_body position: [100, 100], type: KDynamicBodyType do
|
|
138
|
+
polygon_fixture box: [16, 16]
|
|
139
|
+
end
|
|
140
|
+
|
|
141
|
+
body_two[:message] = 'Second Body'
|
|
142
|
+
|
|
143
|
+
collision_notified = false
|
|
144
|
+
|
|
145
|
+
world.on_collision do |first_body, second_body, is_touching|
|
|
146
|
+
collision_notified = true
|
|
147
|
+
first_body.should == body_one
|
|
148
|
+
first_body[:message].should == 'First Body'
|
|
149
|
+
second_body.should == body_two
|
|
150
|
+
second_body[:message].should == 'Second Body'
|
|
151
|
+
is_touching.should == true
|
|
152
|
+
end
|
|
153
|
+
|
|
154
|
+
world.step delta: 10
|
|
155
|
+
collision_notified.should == true
|
|
156
|
+
end
|
|
157
|
+
|
|
158
|
+
it "should notify fixture destructions" do
|
|
159
|
+
world = World.new gravity: [0, -9.8]
|
|
160
|
+
|
|
161
|
+
body = world.new_body position: [100, 100], type: Body::Dynamic do
|
|
162
|
+
polygon_fixture box: [16, 16]
|
|
163
|
+
end
|
|
164
|
+
|
|
165
|
+
fixture_destroyed_notified = false
|
|
166
|
+
|
|
167
|
+
world.on_fixture_destroyed do |fixture|
|
|
168
|
+
fixture_destroyed_notified = true
|
|
169
|
+
fixture.should.not == nil
|
|
170
|
+
end
|
|
171
|
+
|
|
172
|
+
world.destroy_body(body)
|
|
173
|
+
fixture_destroyed_notified.should == true
|
|
174
|
+
end
|
|
175
|
+
|
|
176
|
+
it "should clear forces" do
|
|
177
|
+
world = World.new gravity: [0, -9.8]
|
|
178
|
+
|
|
179
|
+
body = world.new_body position: [100, 100], type: Body::Dynamic do
|
|
180
|
+
polygon_fixture box: [16, 16]
|
|
181
|
+
end
|
|
182
|
+
|
|
183
|
+
body.applyForceToCenter([10, 0])
|
|
184
|
+
world.clearForces
|
|
185
|
+
world.step delta: 10
|
|
186
|
+
|
|
187
|
+
body.position.should.be.close CGPointMake(100, 36), 0.1
|
|
188
|
+
end
|
|
189
|
+
|
|
190
|
+
it "should query the world with a lower bound & upper bound" do
|
|
191
|
+
world = World.new gravity: [0, -9.8]
|
|
192
|
+
|
|
193
|
+
body = world.new_body position: [100, 100], type: Body::Dynamic do
|
|
194
|
+
polygon_fixture box: [16, 16]
|
|
195
|
+
end
|
|
196
|
+
|
|
197
|
+
query_notified = false
|
|
198
|
+
|
|
199
|
+
world.query lower_bound:[0, 0], upper_bound:[100, 100] do |fixture|
|
|
200
|
+
query_notified = true
|
|
201
|
+
fixture.should.not == nil
|
|
202
|
+
true
|
|
203
|
+
end
|
|
204
|
+
|
|
205
|
+
query_notified.should == true
|
|
206
|
+
end
|
|
207
|
+
|
|
208
|
+
it "should ray cast the world with a first point and second point" do
|
|
209
|
+
world = World.new gravity: [0, -9.8]
|
|
210
|
+
|
|
211
|
+
body = world.new_body position: [320, 320], type: Body::Dynamic do
|
|
212
|
+
polygon_fixture box: [16, 16]
|
|
213
|
+
end
|
|
214
|
+
|
|
215
|
+
ray_cast_notified = false
|
|
216
|
+
|
|
217
|
+
world.ray_cast first_point: [0, 0], second_point: [320, 320] do |fixture, point, normal, fraction|
|
|
218
|
+
ray_cast_notified = true
|
|
219
|
+
fixture.type.should == Fixture::PolygonType
|
|
220
|
+
point.should.be.close CGPointMake(0.29, 0.29), 0.01
|
|
221
|
+
normal.should == CGPointMake(0, -1.0)
|
|
222
|
+
fraction.should.be.close 0.94, 0.01
|
|
223
|
+
0.0
|
|
224
|
+
end
|
|
225
|
+
|
|
226
|
+
ray_cast_notified.should == true
|
|
227
|
+
end
|
|
228
|
+
end
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
shared Joybox::UI::Label do
|
|
2
|
+
|
|
3
|
+
describe "Initialization" do
|
|
4
|
+
it "should initialize with text & alignment" do
|
|
5
|
+
label = Label.new text: 'Label',
|
|
6
|
+
position: [100, 100],
|
|
7
|
+
alignment: Joybox::UI::Label::TextAlignmentRight,
|
|
8
|
+
vertical_alignment: KCCVerticalTextAlignmentTop
|
|
9
|
+
|
|
10
|
+
label.should.not == nil
|
|
11
|
+
label.text.should == 'Label'
|
|
12
|
+
label.position.should == CGPointMake(100, 100)
|
|
13
|
+
label.alignment.should == Joybox::UI::Label::TextAlignmentRight
|
|
14
|
+
label.vertical_alignment.should == KCCVerticalTextAlignmentTop
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
it "should initialize with text & font" do
|
|
18
|
+
label = Label.new text: 'Label',
|
|
19
|
+
position: [100, 100],
|
|
20
|
+
font_name: 'Helvetica',
|
|
21
|
+
font_size: 20
|
|
22
|
+
|
|
23
|
+
label.should.not == nil
|
|
24
|
+
label.text.should == 'Label'
|
|
25
|
+
label.position.should == CGPointMake(100, 100)
|
|
26
|
+
label.font_name.should == 'Helvetica'
|
|
27
|
+
label.font_size.should == 20
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
it "should initialize with text & dimensions" do
|
|
31
|
+
label = Label.new text: 'Label',
|
|
32
|
+
position: [100, 100],
|
|
33
|
+
dimensions: [200, 200]
|
|
34
|
+
|
|
35
|
+
label.should.not == nil
|
|
36
|
+
label.text.should == 'Label'
|
|
37
|
+
label.position.should == CGPointMake(100, 100)
|
|
38
|
+
label.dimensions.should == CGSizeMake(200, 200)
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
it "should change its text" do
|
|
43
|
+
label = Label.new text: 'Label',
|
|
44
|
+
position: [100, 100],
|
|
45
|
+
alignment: Joybox::UI::Label::TextAlignmentRight,
|
|
46
|
+
vertical_alignment: KCCVerticalTextAlignmentTop
|
|
47
|
+
|
|
48
|
+
label.text.should == 'Label'
|
|
49
|
+
|
|
50
|
+
label.text = 'Changed Label'
|
|
51
|
+
label.text.should == 'Changed Label'
|
|
52
|
+
end
|
|
53
|
+
end
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
describe Joybox::UI::MenuImage do
|
|
2
|
+
|
|
3
|
+
describe "Initialization" do
|
|
4
|
+
it "should initialize with image & selected image" do
|
|
5
|
+
menu_image = MenuImage.new image_file_name: 'sprite.png'
|
|
6
|
+
|
|
7
|
+
texture = CCTextureCache.sharedTextureCache.addImage('sprite.png')
|
|
8
|
+
|
|
9
|
+
menu_image.should.not == nil
|
|
10
|
+
menu_image.sprite.texture.should == texture
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
it "should initialize with image & selected image" do
|
|
14
|
+
menu_image = MenuImage.new image_file_name: 'sprite.png',
|
|
15
|
+
selected_image_file_name: 'sprite_inverted.png'
|
|
16
|
+
|
|
17
|
+
texture = CCTextureCache.sharedTextureCache.addImage('sprite.png')
|
|
18
|
+
selected_texture = CCTextureCache.sharedTextureCache.addImage('sprite_inverted.png')
|
|
19
|
+
|
|
20
|
+
menu_image.should.not == nil
|
|
21
|
+
menu_image.sprite.texture.should == texture
|
|
22
|
+
menu_image.selected_sprite.texture.should == selected_texture
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
it "should initialize with image, selected image & disabled image" do
|
|
26
|
+
menu_image = MenuImage.new image_file_name: 'sprite.png',
|
|
27
|
+
selected_image_file_name: 'sprite_inverted.png',
|
|
28
|
+
disabled_image_file_name: 'sprite_inverted.png'
|
|
29
|
+
|
|
30
|
+
texture = CCTextureCache.sharedTextureCache.addImage('sprite.png')
|
|
31
|
+
selected_texture = CCTextureCache.sharedTextureCache.addImage('sprite_inverted.png')
|
|
32
|
+
disabled_texture = CCTextureCache.sharedTextureCache.addImage('sprite_inverted.png')
|
|
33
|
+
|
|
34
|
+
menu_image.should.not == nil
|
|
35
|
+
menu_image.sprite.texture.should == texture
|
|
36
|
+
menu_image.selected_sprite.texture.should == selected_texture
|
|
37
|
+
menu_image.disabled_sprite.texture.should == disabled_texture
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
it "should notify touch" do
|
|
42
|
+
menu_image = MenuImage.new image_file_name: 'sprite.png' do |menu_item|
|
|
43
|
+
texture = CCTextureCache.sharedTextureCache.addImage('sprite.png')
|
|
44
|
+
|
|
45
|
+
menu_item.should.not == nil
|
|
46
|
+
menu_image.sprite.texture.should == texture
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
menu_image.activate
|
|
50
|
+
end
|
|
51
|
+
end
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
shared Joybox::UI::MenuLabel do
|
|
2
|
+
after do
|
|
3
|
+
MenuLabel.default_font_size = 32
|
|
4
|
+
MenuLabel.default_font_name = 'Marker Felt'
|
|
5
|
+
end
|
|
6
|
+
|
|
7
|
+
describe "Initialization" do
|
|
8
|
+
it "should initialize with text" do
|
|
9
|
+
menu_label = MenuLabel.new text: 'MenuLabel'
|
|
10
|
+
menu_label.should.not == nil
|
|
11
|
+
menu_label.text.should == 'MenuLabel'
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
it "should initialize with text & position" do
|
|
15
|
+
menu_label = MenuLabel.new text: 'MenuLabel', position: [100, 100]
|
|
16
|
+
menu_label.should.not == nil
|
|
17
|
+
menu_label.text.should == 'MenuLabel'
|
|
18
|
+
menu_label.position.should == CGPointMake(100, 100)
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
it "should initialize with text & font" do
|
|
22
|
+
menu_label = MenuLabel.new text: 'MenuLabel',
|
|
23
|
+
font_name: 'Helvetica',
|
|
24
|
+
font_size: 20
|
|
25
|
+
|
|
26
|
+
menu_label.should.not == nil
|
|
27
|
+
menu_label.text.should == 'MenuLabel'
|
|
28
|
+
menu_label.font_name.should == 'Helvetica'
|
|
29
|
+
menu_label.font_size.should == 20
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
it "should set the default font for the Menu Labels" do
|
|
34
|
+
MenuLabel.default_font_name = 'Helvetica'
|
|
35
|
+
|
|
36
|
+
menu_label = MenuLabel.new text: 'MenuLabel'
|
|
37
|
+
menu_label.should.not == nil
|
|
38
|
+
menu_label.text.should == 'MenuLabel'
|
|
39
|
+
menu_label.font_name.should == 'Helvetica'
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
it "should set the default font size for the Menu Labels" do
|
|
43
|
+
MenuLabel.default_font_size = 40
|
|
44
|
+
|
|
45
|
+
menu_label = MenuLabel.new text: 'MenuLabel'
|
|
46
|
+
menu_label.should.not == nil
|
|
47
|
+
menu_label.text.should == 'MenuLabel'
|
|
48
|
+
menu_label.font_size.should == 40
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
it "should change its text" do
|
|
52
|
+
menu_label = MenuLabel.new text: 'MenuLabel'
|
|
53
|
+
|
|
54
|
+
menu_label.text.should == 'MenuLabel'
|
|
55
|
+
|
|
56
|
+
menu_label.text = 'Changed MenuLabel'
|
|
57
|
+
menu_label.text.should == 'Changed MenuLabel'
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
it "should notify touch" do
|
|
61
|
+
menu_label = MenuLabel.new text: 'MenuLabel' do |menu_item|
|
|
62
|
+
menu_item.should.not == nil
|
|
63
|
+
menu_item.text.should == 'MenuLabel'
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
menu_label.activate
|
|
67
|
+
end
|
|
68
|
+
end
|