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,37 @@
|
|
|
1
|
+
describe Joybox::Actions::Jump do
|
|
2
|
+
behaves_like "Action Sprite"
|
|
3
|
+
|
|
4
|
+
it "should jump the sprite by position" do
|
|
5
|
+
@sprite.run_action Jump.by position: [15, 15], height: 15
|
|
6
|
+
@sprite.position.should == CGPointMake(5, 5)
|
|
7
|
+
|
|
8
|
+
wait 0.2 do
|
|
9
|
+
@sprite.position.should.not == CGPointMake(5, 5)
|
|
10
|
+
@sprite.position.x.should.not.be.close 20, 0.1
|
|
11
|
+
@sprite.position.y.should.not.be.close 20, 0.1
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
wait 0.5 do
|
|
15
|
+
@sprite.position.should.not == CGPointMake(5, 5)
|
|
16
|
+
@sprite.position.x.should.be.close 20, 0.1
|
|
17
|
+
@sprite.position.y.should.be.close 20, 0.1
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
it "should jump the sprite to position" do
|
|
22
|
+
@sprite.run_action Jump.to position: [10, 10], height: 15
|
|
23
|
+
@sprite.position.should == CGPointMake(5, 5)
|
|
24
|
+
|
|
25
|
+
wait 0.2 do
|
|
26
|
+
@sprite.position.should.not == CGPointMake(5, 5)
|
|
27
|
+
@sprite.position.x.should.not.be.close 10, 0.1
|
|
28
|
+
@sprite.position.y.should.not.be.close 10, 0.1
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
wait 0.5 do
|
|
32
|
+
@sprite.position.should.not == CGPointMake(5, 5)
|
|
33
|
+
@sprite.position.x.should.be.close 10, 0.1
|
|
34
|
+
@sprite.position.y.should.be.close 10, 0.1
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
describe Joybox::Actions::Move do
|
|
2
|
+
behaves_like "Action Sprite"
|
|
3
|
+
|
|
4
|
+
it "should move the sprite by position" do
|
|
5
|
+
@sprite.run_action Move.by position: [15, 15]
|
|
6
|
+
@sprite.position.should == CGPointMake(5, 5)
|
|
7
|
+
|
|
8
|
+
wait 0.2 do
|
|
9
|
+
@sprite.position.should.not == CGPointMake(5, 5)
|
|
10
|
+
@sprite.position.x.should.not.be.close 20, 0.1
|
|
11
|
+
@sprite.position.y.should.not.be.close 20, 0.1
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
wait 0.4 do
|
|
15
|
+
@sprite.position.should.not == CGPointMake(5, 5)
|
|
16
|
+
@sprite.position.x.should.be.close 20, 0.1
|
|
17
|
+
@sprite.position.y.should.be.close 20, 0.1
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
it "should move the sprite to position" do
|
|
22
|
+
@sprite.run_action Move.to position: [10, 10]
|
|
23
|
+
@sprite.position.should == CGPointMake(5, 5)
|
|
24
|
+
|
|
25
|
+
wait 0.2 do
|
|
26
|
+
@sprite.position.should.not == CGPointMake(5, 5)
|
|
27
|
+
@sprite.position.x.should.not.be.close 10, 0.1
|
|
28
|
+
@sprite.position.y.should.not.be.close 10, 0.1
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
wait 0.4 do
|
|
32
|
+
@sprite.position.should.not == CGPointMake(5, 5)
|
|
33
|
+
@sprite.position.x.should.be.close 10, 0.1
|
|
34
|
+
@sprite.position.y.should.be.close 10, 0.1
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
describe Joybox::Actions::Place do
|
|
2
|
+
behaves_like "Action Sprite"
|
|
3
|
+
|
|
4
|
+
it "should place the sprite in position" do
|
|
5
|
+
@sprite.position.should == CGPointMake(5, 5)
|
|
6
|
+
@sprite.run_action Place.in position: [100, 100]
|
|
7
|
+
|
|
8
|
+
wait 0.1 do
|
|
9
|
+
@sprite.position.should == CGPointMake(100, 100)
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
end
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
describe Joybox::Actions::Rotate do
|
|
2
|
+
behaves_like "Action Sprite"
|
|
3
|
+
|
|
4
|
+
it "should rotate the sprite by angle" do
|
|
5
|
+
@sprite.run_action Rotate.by angle: 15
|
|
6
|
+
@sprite.rotation = 5
|
|
7
|
+
@sprite.rotation.should == 5
|
|
8
|
+
|
|
9
|
+
wait 0.2 do
|
|
10
|
+
@sprite.rotation.should.not == 5
|
|
11
|
+
@sprite.rotation.should.not.be.close 15, 0.1
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
wait 0.4 do
|
|
15
|
+
@sprite.rotation.should.not == 5
|
|
16
|
+
@sprite.rotation.should.be.close 15, 0.1
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
it "should rotate the sprite to angle" do
|
|
21
|
+
@sprite.run_action Rotate.to angle: 15
|
|
22
|
+
@sprite.rotation = 5
|
|
23
|
+
@sprite.rotation.should == 5
|
|
24
|
+
|
|
25
|
+
wait 0.2 do
|
|
26
|
+
@sprite.rotation.should.not == 5
|
|
27
|
+
@sprite.rotation.should.not.be.close 15, 0.1
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
wait 0.4 do
|
|
31
|
+
@sprite.rotation.should.not == 5
|
|
32
|
+
@sprite.rotation.should.be.close 15, 0.1
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
describe Joybox::Actions::Scale do
|
|
2
|
+
behaves_like "Action Sprite"
|
|
3
|
+
|
|
4
|
+
it "should scale the sprite by number" do
|
|
5
|
+
@sprite.run_action Scale.by scale: 1.5
|
|
6
|
+
@sprite.scaleX.should == 1.0
|
|
7
|
+
@sprite.scaleY.should == 1.0
|
|
8
|
+
|
|
9
|
+
wait 0.2 do
|
|
10
|
+
@sprite.scaleX.should.not == 1.0
|
|
11
|
+
@sprite.scaleY.should.not == 1.0
|
|
12
|
+
@sprite.scaleX.should.not.be.close 1.5, 0.1
|
|
13
|
+
@sprite.scaleY.should.not.be.close 1.5, 0.1
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
wait 0.4 do
|
|
17
|
+
@sprite.scaleX.should.not == 1.0
|
|
18
|
+
@sprite.scaleY.should.not == 1.0
|
|
19
|
+
@sprite.scaleX.should.be.close 1.5, 0.1
|
|
20
|
+
@sprite.scaleY.should.be.close 1.5, 0.1
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
it "should scale the sprite to number" do
|
|
25
|
+
@sprite.run_action Scale.to scale: 1.5
|
|
26
|
+
@sprite.scaleX.should == 1.0
|
|
27
|
+
@sprite.scaleY.should == 1.0
|
|
28
|
+
|
|
29
|
+
wait 0.2 do
|
|
30
|
+
@sprite.scaleX.should.not == 1.0
|
|
31
|
+
@sprite.scaleY.should.not == 1.0
|
|
32
|
+
@sprite.scaleX.should.not.be.close 1.5, 0.1
|
|
33
|
+
@sprite.scaleY.should.not.be.close 1.5, 0.1
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
wait 0.4 do
|
|
37
|
+
@sprite.scaleX.should.not == 1.0
|
|
38
|
+
@sprite.scaleY.should.not == 1.0
|
|
39
|
+
@sprite.scaleX.should.be.close 1.5, 0.1
|
|
40
|
+
@sprite.scaleY.should.be.close 1.5, 0.1
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
end
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
describe Joybox::Actions::Skew do
|
|
2
|
+
behaves_like "Action Sprite"
|
|
3
|
+
|
|
4
|
+
it "should skew the sprite by x & y" do
|
|
5
|
+
@sprite.run_action Skew.by x: 15, y: 15
|
|
6
|
+
@sprite.skewX.should == 0
|
|
7
|
+
@sprite.skewY.should == 0
|
|
8
|
+
|
|
9
|
+
wait 0.2 do
|
|
10
|
+
@sprite.skewX.should.not == 0
|
|
11
|
+
@sprite.skewY.should.not == 0
|
|
12
|
+
@sprite.skewX.should.not.be.close 15, 0.1
|
|
13
|
+
@sprite.skewY.should.not.be.close 15, 0.1
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
wait 0.4 do
|
|
17
|
+
@sprite.skewX.should.not == 0
|
|
18
|
+
@sprite.skewY.should.not == 0
|
|
19
|
+
@sprite.skewX.should.be.close 15, 0.1
|
|
20
|
+
@sprite.skewY.should.be.close 15, 0.1
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
it "should skew the sprite to x & y" do
|
|
25
|
+
@sprite.run_action Skew.to x: 15, y: 15
|
|
26
|
+
@sprite.skewX.should == 0
|
|
27
|
+
@sprite.skewY.should == 0
|
|
28
|
+
|
|
29
|
+
wait 0.2 do
|
|
30
|
+
@sprite.skewX.should.not == 0
|
|
31
|
+
@sprite.skewY.should.not == 0
|
|
32
|
+
@sprite.skewX.should.not.be.close 15, 0.1
|
|
33
|
+
@sprite.skewY.should.not.be.close 15, 0.1
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
wait 0.4 do
|
|
37
|
+
@sprite.skewX.should.not == 0
|
|
38
|
+
@sprite.skewY.should.not == 0
|
|
39
|
+
@sprite.skewX.should.be.close 15, 0.1
|
|
40
|
+
@sprite.skewY.should.be.close 15, 0.1
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
end
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
describe CGSize do
|
|
2
|
+
before do
|
|
3
|
+
@size = CGSizeMake(50, 50)
|
|
4
|
+
end
|
|
5
|
+
|
|
6
|
+
it "should return the half of the width" do
|
|
7
|
+
@size.half_width.should == 25
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
it "should return the double of the width" do
|
|
11
|
+
@size.double_width.should == 100
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
it "should return the half of the height" do
|
|
15
|
+
@size.half_height.should == 25
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
it "should return the double of the height" do
|
|
19
|
+
@size.double_height.should == 100
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
it "should convert from pixel coordinates" do
|
|
23
|
+
@size.from_pixel_coordinates.should == CGSizeMake(1.5625, 1.5625)
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
it "should convert to pixel coordinates" do
|
|
27
|
+
CGSizeMake(1.5625, 1.5625).to_pixel_coordinates.should == @size
|
|
28
|
+
end
|
|
29
|
+
end
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
describe Joybox::Core::Color do
|
|
2
|
+
describe "Initialization" do
|
|
3
|
+
it "should initialize with options" do
|
|
4
|
+
color = Color.create red:39, green:40, blue:34
|
|
5
|
+
color.red.should == 39
|
|
6
|
+
color.green.should == 40
|
|
7
|
+
color.blue.should == 34
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
it "should initialize with rgb" do
|
|
11
|
+
color = Color.from_rgb(39, 40, 34)
|
|
12
|
+
color.red.should == 39
|
|
13
|
+
color.green.should == 40
|
|
14
|
+
color.blue.should == 34
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
it "should initialize with hex" do
|
|
18
|
+
color = Color.from_hex('#272822')
|
|
19
|
+
color.red.should == 39
|
|
20
|
+
color.green.should == 40
|
|
21
|
+
color.blue.should == 34
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
it "should initialize from string" do
|
|
25
|
+
color = '#272822'.to_color
|
|
26
|
+
color.red.should == 39
|
|
27
|
+
color.green.should == 40
|
|
28
|
+
color.blue.should == 34
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
describe CCNode do
|
|
2
|
+
|
|
3
|
+
describe "Children" do
|
|
4
|
+
before do
|
|
5
|
+
@node = CCNode.new
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
it "should have empty children subclasses" do
|
|
9
|
+
@node.children.should == nil
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
it "should add subclass as a child" do
|
|
13
|
+
sprite = Sprite.new file_name: 'sprite.png'
|
|
14
|
+
@node << sprite
|
|
15
|
+
@node.children.count.should == 1
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
it "should add many subclasses as childs" do
|
|
19
|
+
sprite = Sprite.new file_name: 'sprite.png'
|
|
20
|
+
layer = Layer.new
|
|
21
|
+
@node.add_children(sprite, layer)
|
|
22
|
+
@node.children.count.should == 2
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
it "should clean all the children subclasses" do
|
|
26
|
+
@node.removeAllChildren
|
|
27
|
+
@node.children.should == nil
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
it "should clean all the children subclasses and stop the actions" do
|
|
31
|
+
@node.removeAllChildrenWithCleanup(true)
|
|
32
|
+
@node.children.should == nil
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
end
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
describe Joybox::Core::SpriteBatch do
|
|
2
|
+
|
|
3
|
+
describe "Initialization" do
|
|
4
|
+
it "should initialize with file name" do
|
|
5
|
+
sprite_batch = SpriteBatch.new file_name: 'sprite_sheet.png'
|
|
6
|
+
sprite_batch.should.not == nil
|
|
7
|
+
sprite_batch.texture.should.not == nil
|
|
8
|
+
sprite_batch.textureAtlas.should.not == nil
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
it "should initialize with file name and capacity" do
|
|
12
|
+
sprite_batch = SpriteBatch.new file_name: 'sprite_sheet.png', capacity: 50
|
|
13
|
+
sprite_batch.should.not == nil
|
|
14
|
+
sprite_batch.texture.should.not == nil
|
|
15
|
+
sprite_batch.textureAtlas.should.not == nil
|
|
16
|
+
sprite_batch.textureAtlas.capacity.should == 50
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
it "should initialize with texture" do
|
|
20
|
+
texture = CCTextureCache.sharedTextureCache.addImage('sprite_sheet.png')
|
|
21
|
+
sprite_batch = SpriteBatch.new texture: texture
|
|
22
|
+
sprite_batch.should.not == nil
|
|
23
|
+
sprite_batch.texture.should.not == nil
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
it "should initialize with texture and capacity" do
|
|
27
|
+
texture = CCTextureCache.sharedTextureCache.addImage('sprite_sheet.png')
|
|
28
|
+
sprite_batch = SpriteBatch.new texture: texture, capacity: 50
|
|
29
|
+
sprite_batch.should.not == nil
|
|
30
|
+
sprite_batch.texture.should.not == nil
|
|
31
|
+
sprite_batch.textureAtlas.capacity.should == 50
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
end
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
describe Joybox::Core::SpriteFrameCache do
|
|
2
|
+
|
|
3
|
+
describe "Add Frames" do
|
|
4
|
+
before do
|
|
5
|
+
SpriteFrameCache.purge
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
it "should add a frame with name" do
|
|
9
|
+
frame = CCSpriteFrame.alloc.initWithTextureFilename('animation_sprite_sheet.png', rect:[[237, 443], [233, 145]])
|
|
10
|
+
SpriteFrameCache.frames['frame'] = frame
|
|
11
|
+
frame = SpriteFrameCache.frames['frame']
|
|
12
|
+
frame.should.not == nil
|
|
13
|
+
frame.texture.should.not == nil
|
|
14
|
+
frame.rect.should == CGRectMake(237, 443, 233, 145)
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
it "should add frames from a PLIST file" do
|
|
18
|
+
SpriteFrameCache.frames.add file_name: 'animation_frames.plist'
|
|
19
|
+
frame = SpriteFrameCache.frames['bear1.png']
|
|
20
|
+
frame.should.not == nil
|
|
21
|
+
frame.texture.should.not == nil
|
|
22
|
+
frame.rect.should == CGRectMake(237, 443, 233, 145)
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
it "should add frames with a texture" do
|
|
26
|
+
texture = CCTextureCache.sharedTextureCache.addImage('animation_sprite_sheet.png')
|
|
27
|
+
SpriteFrameCache.frames.add file_name: 'animation_frames.plist', texture: texture
|
|
28
|
+
frame = SpriteFrameCache.frames['bear1.png']
|
|
29
|
+
frame.should.not == nil
|
|
30
|
+
frame.texture.should.not == nil
|
|
31
|
+
frame.rect.should == CGRectMake(237, 443, 233, 145)
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
it "should add a frame with texture file" do
|
|
35
|
+
SpriteFrameCache.frames.add file_name: 'animation_frames.plist', texture_file_name: 'animation_sprite_sheet.png'
|
|
36
|
+
frame = SpriteFrameCache.frames['bear1.png']
|
|
37
|
+
frame.should.not == nil
|
|
38
|
+
frame.texture.should.not == nil
|
|
39
|
+
frame.rect.should == CGRectMake(237, 443, 233, 145)
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
describe "Remove Frames" do
|
|
44
|
+
before do
|
|
45
|
+
SpriteFrameCache.purge
|
|
46
|
+
SpriteFrameCache.frames.add file_name: 'animation_frames.plist'
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
it "should remove frames with name" do
|
|
50
|
+
SpriteFrameCache.frames.remove name: 'bear1.png'
|
|
51
|
+
SpriteFrameCache.frames['bear1.png'].should == nil
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
it "should remove frames from a PLIST file" do
|
|
55
|
+
SpriteFrameCache.frames.remove file_name: 'animation_frames.plist'
|
|
56
|
+
SpriteFrameCache.frames['bear2.png'].should == nil
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
it "should remove unused frames" do
|
|
60
|
+
SpriteFrameCache.frames.remove_unused_frames
|
|
61
|
+
SpriteFrameCache.frames['bear1.png'].should == nil
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
describe "Get Frames" do
|
|
66
|
+
before do
|
|
67
|
+
SpriteFrameCache.purge
|
|
68
|
+
SpriteFrameCache.frames.add file_name: 'animation_frames.plist'
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
it "should get a frame by name" do
|
|
72
|
+
SpriteFrameCache.frames['bear1.png'].should.not == nil
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
it "should get frames using a prefix & suffix" do
|
|
76
|
+
sprite_frames = SpriteFrameCache.frames.where prefix: "bear", suffix: ".png"
|
|
77
|
+
sprite_frames.each do |frame|
|
|
78
|
+
frame.texture.should.not == nil
|
|
79
|
+
frame.rect.should.not == CGRectMake(0, 0, 0, 0)
|
|
80
|
+
end
|
|
81
|
+
sprite_frames.size.should == 8
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
it "should get frames using a prefix, suffix & from" do
|
|
85
|
+
sprite_frames = SpriteFrameCache.frames.where prefix: "bear", suffix: ".png", from: 5
|
|
86
|
+
sprite_frames.each do |frame|
|
|
87
|
+
frame.texture.should.not == nil
|
|
88
|
+
frame.rect.should.not == CGRectMake(0, 0, 0, 0)
|
|
89
|
+
end
|
|
90
|
+
sprite_frames.size.should == 4
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
it "should get frames using a prefix, suffix, from & to" do
|
|
94
|
+
sprite_frames = SpriteFrameCache.frames.where prefix: "bear", suffix: ".png", from: 5, to: 5
|
|
95
|
+
sprite_frames.each do |frame|
|
|
96
|
+
frame.texture.should.not == nil
|
|
97
|
+
frame.rect.should.not == CGRectMake(0, 0, 0, 0)
|
|
98
|
+
end
|
|
99
|
+
sprite_frames.size.should == 1
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
it "should get frames using a prefix, suffix and order" do
|
|
103
|
+
sprite_frames = SpriteFrameCache.frames.where prefix: "bear", suffix: ".png", order: [1, 5, 3]
|
|
104
|
+
sprite_frames.each do |frame|
|
|
105
|
+
frame.texture.should.not == nil
|
|
106
|
+
frame.rect.should.not == CGRectMake(0, 0, 0, 0)
|
|
107
|
+
end
|
|
108
|
+
sprite_frames.size.should == 3
|
|
109
|
+
end
|
|
110
|
+
end
|
|
111
|
+
end
|