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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a232d359c2f70f16e05b890b2dbdeec290b3150a
4
- data.tar.gz: 25a2978ee8de1acbc76743441e03fc31f7d26396
3
+ metadata.gz: 0f956c9eca665444723d329a56d6520cfcae1fc5
4
+ data.tar.gz: e888973213552645e2182e194bb841be148c1d68
5
5
  SHA512:
6
- metadata.gz: f5a78740983822466e131e0e2b50388536249e1ccd0ec79369d59fbacb6a0cf3f5e44a3d7920de24d22e20ac01ca66f2b8a9b02607ce07bd700ee5a24d451b28
7
- data.tar.gz: ad26640e5b906806cc2ba7b03177dcc6a74836d2d119de9be4d38a45c013ff178e9a676c496766416e81504322bf254314c12bb4a9b6111bdd6e4bbc30f3599f
6
+ metadata.gz: 1d271e11d87fc46af47ed6ba8f8eb1618ecc4d727f2b503287ff0cf4357e85d5e2de19797b50856a6b672d036d62918c4e85c7d6441d88e5bf8672e19d257ebb
7
+ data.tar.gz: 93402f6a6001af7c887e53a18d3fb141284153eb8c892005671d7fe85c26f082c21789b1147e9cb964f315deb9aeec6929d11642f72f26677662a255f1f58a72
data/.gitignore CHANGED
@@ -1,2 +1,11 @@
1
+ *Gemfile.lock
2
+
3
+ ## Documentation cache and generated files:
4
+ /.yardoc/
5
+ /_yardoc/
6
+ /doc/
7
+ /rdoc/
8
+
9
+ ## Ignore editors, tools and such:
10
+ .idea
1
11
  prepros.cfg
2
- Gemfile.lock
data/Gemfile CHANGED
@@ -1,3 +1,6 @@
1
1
  source 'https://rubygems.org'
2
2
  gemspec
3
3
 
4
+ group :development do
5
+ gem "yard"
6
+ end
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
@@ -128,7 +128,7 @@ class Player
128
128
  end
129
129
 
130
130
  def update
131
- cursors = @game.input.keyboard.createCursorKeys
131
+ cursors = @game.input.keyboard.create_cursor_keys
132
132
  movement(cursors)
133
133
  end
134
134
 
data/lib/opal/phaser.rb CHANGED
@@ -1,5 +1,8 @@
1
1
  if RUBY_ENGINE == 'opal'
2
- require 'opal/phaser/core'
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
@@ -2,7 +2,7 @@ module Phaser
2
2
  class AnimationManager
3
3
  include Native
4
4
 
5
- alias_native :add
5
+ alias_native :add, :add, as: Animation
6
6
  alias_native :stop
7
7
  alias_native :play
8
8
  end
File without changes
@@ -3,5 +3,6 @@ module Phaser
3
3
  include Native
4
4
 
5
5
  alias_native :set_to, :setTo
6
+ alias_native :set
6
7
  end
7
8
  end
@@ -41,7 +41,7 @@ module Phaser
41
41
  alias_native :stage
42
42
  alias_native :physics, :physics, as: Physics
43
43
  alias_native :debug
44
- alias_native :input
44
+ alias_native :input, :input, as: Input
45
45
  alias_native :width
46
46
  alias_native :time
47
47
  end
@@ -0,0 +1,8 @@
1
+ module Phaser
2
+ class Signal
3
+ include Native
4
+
5
+ alias_native :add
6
+ alias_native :add_once, :addOnce
7
+ end
8
+ end
@@ -0,0 +1,7 @@
1
+ module Phaser
2
+ class Events
3
+ include Native
4
+
5
+ alias_native :on_input_down, :onInputDown, as: Signal
6
+ end
7
+ end
@@ -5,6 +5,7 @@ module Phaser
5
5
  alias_native :sprite, :sprite, as: Sprite
6
6
  alias_native :group, :group, as: Group
7
7
  alias_native :text, :text, as: Text
8
+ alias_native :image, :image, as: Image
8
9
  alias_native :tween, :tween, as: Tween
9
10
  alias_native :tile_sprite, :tileSprite
10
11
  end
@@ -0,0 +1,16 @@
1
+ module Phaser
2
+ class Image
3
+ include Native
4
+
5
+ alias_native :x
6
+ alias_native :y
7
+ alias_native :x=
8
+ alias_native :y=
9
+
10
+ alias_native :scale
11
+
12
+ def smoothed=(bool)
13
+ `#@native.smoothed = bool`
14
+ end
15
+ end
16
+ end
@@ -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
@@ -0,0 +1,10 @@
1
+ module Phaser
2
+ class Input
3
+ include Native
4
+
5
+ alias_native :keyboard, :keyboard, as: Keyboard
6
+
7
+ alias_native :on_down, :onDown, as: Signal
8
+ alias_native :active_pointer, :activePointer
9
+ end
10
+ end
@@ -0,0 +1,7 @@
1
+ module Phaser
2
+ class Keyboard
3
+ include Native
4
+
5
+ alias_native :create_cursor_keys, :createCursorKeys
6
+ end
7
+ end
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
@@ -1,5 +1,5 @@
1
1
  module Opal
2
2
  module Phaser
3
- VERSION = '0.1.3'
3
+ VERSION = '0.1.4'
4
4
  end
5
5
  end
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.3
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-19 00:00:00.000000000 Z
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/core.rb
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/image.rb
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
@@ -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
@@ -1,10 +0,0 @@
1
- module Phaser
2
- class Image
3
- def initialize (game, x, y, key)
4
- @game = game.to_n
5
- @native = `new Phaser.Image(#{@game}, x, y, key)`
6
- end
7
-
8
- alias_native :scale, :scale
9
- end
10
- end