opal-phaser 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +10 -1
- data/Gemfile +3 -0
- data/README.md +2 -0
- data/demo/app/main.rb +1 -1
- data/lib/opal/phaser.rb +4 -1
- data/lib/opal/phaser/animation/animation.rb +19 -0
- data/lib/opal/phaser/{core → animation}/animation_manager.rb +1 -1
- data/lib/opal/phaser/{core → animation}/frame.rb +0 -0
- data/lib/opal/phaser/core/anchor.rb +1 -0
- data/lib/opal/phaser/core/game.rb +1 -1
- data/lib/opal/phaser/core/signal.rb +8 -0
- data/lib/opal/phaser/game_objects/events.rb +7 -0
- data/lib/opal/phaser/{core → game_objects}/game_object_factory.rb +1 -0
- data/lib/opal/phaser/game_objects/image.rb +16 -0
- data/lib/opal/phaser/{core → game_objects}/sprite.rb +11 -1
- data/lib/opal/phaser/{core → game_objects}/text.rb +0 -0
- data/lib/opal/phaser/input/input.rb +10 -0
- data/lib/opal/phaser/input/keyboard.rb +7 -0
- data/lib/opal/phaser/{core → loader}/cache.rb +0 -0
- data/lib/opal/phaser/{core → physics}/physics.rb +0 -0
- data/lib/opal/phaser/setup.rb +31 -0
- data/lib/opal/phaser/{core → tween}/tween.rb +0 -0
- data/lib/opal/phaser/version.rb +1 -1
- metadata +17 -13
- data/lib/opal/phaser/core.rb +0 -16
- data/lib/opal/phaser/core/animation.rb +0 -23
- data/lib/opal/phaser/core/image.rb +0 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0f956c9eca665444723d329a56d6520cfcae1fc5
|
4
|
+
data.tar.gz: e888973213552645e2182e194bb841be148c1d68
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1d271e11d87fc46af47ed6ba8f8eb1618ecc4d727f2b503287ff0cf4357e85d5e2de19797b50856a6b672d036d62918c4e85c7d6441d88e5bf8672e19d257ebb
|
7
|
+
data.tar.gz: 93402f6a6001af7c887e53a18d3fb141284153eb8c892005671d7fe85c26f082c21789b1147e9cb964f315deb9aeec6929d11642f72f26677662a255f1f58a72
|
data/.gitignore
CHANGED
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -11,6 +11,8 @@ If you have not heard of Phaser, check out these links:
|
|
11
11
|
* Phaser: https://github.com/photonstorm/phaser
|
12
12
|
* Phaser Examples: https://github.com/photonstorm/phaser-examples
|
13
13
|
|
14
|
+
Also, to get examples of opal-phaser in action, check out the [opal-phaser-examples repository](https://github.com/orbitalimpact/opal-phaser-examples).
|
15
|
+
|
14
16
|
## Cloning this repository
|
15
17
|
|
16
18
|
```
|
data/demo/app/main.rb
CHANGED
data/lib/opal/phaser.rb
CHANGED
@@ -1,5 +1,8 @@
|
|
1
1
|
if RUBY_ENGINE == 'opal'
|
2
|
-
require 'opal/phaser/
|
2
|
+
require 'opal/phaser/setup'
|
3
|
+
# Require all Phaser API implementation files:
|
4
|
+
# Dir["#{File.dirname(__FILE__)}/opal/phaser/**/*.rb"].each { |f| load(f) }
|
5
|
+
|
3
6
|
else
|
4
7
|
require 'opal'
|
5
8
|
require 'opal/phaser/version'
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module Phaser
|
2
|
+
class Animation
|
3
|
+
include Native
|
4
|
+
|
5
|
+
alias_native :play
|
6
|
+
|
7
|
+
alias_native :on_start, :onStart, as: Signal
|
8
|
+
alias_native :on_loop, :onLoop, as: Signal
|
9
|
+
alias_native :on_completion, :onComplete, as: Signal
|
10
|
+
|
11
|
+
alias_native :loop_count, :loopCount
|
12
|
+
|
13
|
+
def loop=(bool)
|
14
|
+
`#@native.loop = bool`
|
15
|
+
end
|
16
|
+
|
17
|
+
alias_native :is_playing?, :isPlaying
|
18
|
+
end
|
19
|
+
end
|
File without changes
|
@@ -2,7 +2,6 @@ module Phaser
|
|
2
2
|
class Sprite
|
3
3
|
include Native
|
4
4
|
|
5
|
-
alias_native :events
|
6
5
|
alias_native :scale
|
7
6
|
alias_native :body
|
8
7
|
alias_native :bounce
|
@@ -25,8 +24,19 @@ module Phaser
|
|
25
24
|
def input_enabled=(bool)
|
26
25
|
`#@native.inputEnabled = bool`
|
27
26
|
end
|
27
|
+
|
28
|
+
def smoothed=(bool)
|
29
|
+
`#@native.smoothed = bool`
|
30
|
+
end
|
31
|
+
|
32
|
+
def frame_name=(name)
|
33
|
+
`#@native.frameName = name`
|
34
|
+
end
|
35
|
+
|
36
|
+
alias_native :load_texture, :loadTexture
|
28
37
|
|
29
38
|
alias_native :anchor, :anchor, as: Anchor
|
30
39
|
alias_native :animations, :animations, as: AnimationManager
|
40
|
+
alias_native :events, :events, as: Events
|
31
41
|
end
|
32
42
|
end
|
File without changes
|
File without changes
|
File without changes
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require 'native'
|
2
|
+
|
3
|
+
|
4
|
+
# These requires must be loaded in order of dependency:
|
5
|
+
require 'opal/phaser/core/state'
|
6
|
+
require 'opal/phaser/core/anchor'
|
7
|
+
require 'opal/phaser/core/group'
|
8
|
+
require 'opal/phaser/core/signal'
|
9
|
+
require 'opal/phaser/core/world'
|
10
|
+
|
11
|
+
require 'opal/phaser/animation/animation'
|
12
|
+
require 'opal/phaser/animation/animation_manager'
|
13
|
+
require 'opal/phaser/animation/frame'
|
14
|
+
|
15
|
+
require 'opal/phaser/tween/tween'
|
16
|
+
|
17
|
+
require 'opal/phaser/game_objects/events'
|
18
|
+
require 'opal/phaser/game_objects/sprite'
|
19
|
+
require 'opal/phaser/game_objects/text'
|
20
|
+
require 'opal/phaser/game_objects/image'
|
21
|
+
require 'opal/phaser/game_objects/game_object_factory'
|
22
|
+
|
23
|
+
require 'opal/phaser/input/keyboard'
|
24
|
+
require 'opal/phaser/input/input'
|
25
|
+
|
26
|
+
require 'opal/phaser/loader/cache'
|
27
|
+
|
28
|
+
require 'opal/phaser/physics/physics'
|
29
|
+
|
30
|
+
|
31
|
+
require 'opal/phaser/core/game'
|
File without changes
|
data/lib/opal/phaser/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: opal-phaser
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- George Plymale
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-03-
|
11
|
+
date: 2015-03-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: opal
|
@@ -79,22 +79,26 @@ files:
|
|
79
79
|
- demo/style.css
|
80
80
|
- lib/opal-phaser.rb
|
81
81
|
- lib/opal/phaser.rb
|
82
|
-
- lib/opal/phaser/
|
82
|
+
- lib/opal/phaser/animation/animation.rb
|
83
|
+
- lib/opal/phaser/animation/animation_manager.rb
|
84
|
+
- lib/opal/phaser/animation/frame.rb
|
83
85
|
- lib/opal/phaser/core/anchor.rb
|
84
|
-
- lib/opal/phaser/core/animation.rb
|
85
|
-
- lib/opal/phaser/core/animation_manager.rb
|
86
|
-
- lib/opal/phaser/core/cache.rb
|
87
|
-
- lib/opal/phaser/core/frame.rb
|
88
86
|
- lib/opal/phaser/core/game.rb
|
89
|
-
- lib/opal/phaser/core/game_object_factory.rb
|
90
87
|
- lib/opal/phaser/core/group.rb
|
91
|
-
- lib/opal/phaser/core/
|
92
|
-
- lib/opal/phaser/core/physics.rb
|
93
|
-
- lib/opal/phaser/core/sprite.rb
|
88
|
+
- lib/opal/phaser/core/signal.rb
|
94
89
|
- lib/opal/phaser/core/state.rb
|
95
|
-
- lib/opal/phaser/core/text.rb
|
96
|
-
- lib/opal/phaser/core/tween.rb
|
97
90
|
- lib/opal/phaser/core/world.rb
|
91
|
+
- lib/opal/phaser/game_objects/events.rb
|
92
|
+
- lib/opal/phaser/game_objects/game_object_factory.rb
|
93
|
+
- lib/opal/phaser/game_objects/image.rb
|
94
|
+
- lib/opal/phaser/game_objects/sprite.rb
|
95
|
+
- lib/opal/phaser/game_objects/text.rb
|
96
|
+
- lib/opal/phaser/input/input.rb
|
97
|
+
- lib/opal/phaser/input/keyboard.rb
|
98
|
+
- lib/opal/phaser/loader/cache.rb
|
99
|
+
- lib/opal/phaser/physics/physics.rb
|
100
|
+
- lib/opal/phaser/setup.rb
|
101
|
+
- lib/opal/phaser/tween/tween.rb
|
98
102
|
- lib/opal/phaser/version.rb
|
99
103
|
- opal-phaser.gemspec
|
100
104
|
homepage: http://github.com/orbitalimpact/opal-phaser
|
data/lib/opal/phaser/core.rb
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
require 'native'
|
2
|
-
|
3
|
-
require 'opal/phaser/core/state'
|
4
|
-
require 'opal/phaser/core/physics'
|
5
|
-
require 'opal/phaser/core/group'
|
6
|
-
require 'opal/phaser/core/animation'
|
7
|
-
require 'opal/phaser/core/animation_manager'
|
8
|
-
require 'opal/phaser/core/anchor'
|
9
|
-
require 'opal/phaser/core/sprite'
|
10
|
-
require 'opal/phaser/core/image'
|
11
|
-
require 'opal/phaser/core/tween'
|
12
|
-
require 'opal/phaser/core/text'
|
13
|
-
require 'opal/phaser/core/cache'
|
14
|
-
require 'opal/phaser/core/world'
|
15
|
-
require 'opal/phaser/core/game_object_factory'
|
16
|
-
require 'opal/phaser/core/game'
|
@@ -1,23 +0,0 @@
|
|
1
|
-
module Phaser
|
2
|
-
|
3
|
-
# An Animation instance contains a single animation and the controls to play it.
|
4
|
-
# It is created by the AnimationManager, consists of Animation.Frame objects and belongs to a single Game Object such as a Sprite.
|
5
|
-
#
|
6
|
-
# @see http://docs.phaser.io/Phaser.Animation.html
|
7
|
-
class Animation
|
8
|
-
include Native
|
9
|
-
attr_accessor :native
|
10
|
-
|
11
|
-
# @param game [Phaser.Game] A reference to the currently running game.
|
12
|
-
# @param parent [Phaser.Sprite] A reference to the owner of this Animation.
|
13
|
-
# @param name [String] The unique name for this animation, used in playback commands.
|
14
|
-
# @param frame_data [Phaser.FrameData] The FrameData object that contains all frames used by this Animation.
|
15
|
-
# @param frames [Array<Integer>, Array<String>] An array of numbers or strings indicating which frames to play in which order.
|
16
|
-
# @param frame_rate [Integer] [frameRate=60] The speed at which the animation should play. The speed is given in frames per second.
|
17
|
-
# @param loop [True, False] [loop=false] Whether or not the animation is looped or just plays once.
|
18
|
-
def initialize(game, parent, name, frameData, frames, frameRate = 60, _loop = false)
|
19
|
-
@native_game = game
|
20
|
-
@native = `new Phaser.Animation(#@native_game, parent, name, frameData, frames, frameRate, _loop)`
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|