opal-phaser 0.1.4 → 0.1.6

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: 0f956c9eca665444723d329a56d6520cfcae1fc5
4
- data.tar.gz: e888973213552645e2182e194bb841be148c1d68
3
+ metadata.gz: 4873e726f3744eff28476ab8ebe398f2b4b12001
4
+ data.tar.gz: 47f4dd07619d9a6243b903ab6cf5ca20f9aa41ac
5
5
  SHA512:
6
- metadata.gz: 1d271e11d87fc46af47ed6ba8f8eb1618ecc4d727f2b503287ff0cf4357e85d5e2de19797b50856a6b672d036d62918c4e85c7d6441d88e5bf8672e19d257ebb
7
- data.tar.gz: 93402f6a6001af7c887e53a18d3fb141284153eb8c892005671d7fe85c26f082c21789b1147e9cb964f315deb9aeec6929d11642f72f26677662a255f1f58a72
6
+ metadata.gz: e4d43d58ada4ed74e1f975b66a57b64bbb0db8067a772caf436504cbade717dca0e4b64a9b396b868406acacc986455988ecc1b36d6d04ae29d61fb2cfc27c8a
7
+ data.tar.gz: 77dfa6968cfdf015710ac6b82588c29cdb595a7eac0c0c375c3ea5a6f123164c056a381be91dfe0bde3b9ea49f2b7dd50bf8e30292781f20493b3bb32bbad9d6
data/.gitignore CHANGED
@@ -1,5 +1,3 @@
1
- *Gemfile.lock
2
-
3
1
  ## Documentation cache and generated files:
4
2
  /.yardoc/
5
3
  /_yardoc/
@@ -9,3 +7,7 @@
9
7
  ## Ignore editors, tools and such:
10
8
  .idea
11
9
  prepros.cfg
10
+
11
+ ## Ignore demo's Gemfile.lock
12
+ demo/Gemfile.lock
13
+ *Gemfile.lock
data/Gemfile CHANGED
@@ -1,6 +1,8 @@
1
1
  source 'https://rubygems.org'
2
2
  gemspec
3
3
 
4
+ gem 'opal', git: 'https://github.com/opal/opal.git'
5
+
4
6
  group :development do
5
7
  gem "yard"
6
8
  end
data/demo/app/main.rb CHANGED
@@ -121,7 +121,7 @@ class Player
121
121
 
122
122
  player.body.bounce.y = 0.2
123
123
  player.body.gravity.y = 300
124
- player.body.collideWorldBounds = true
124
+ player.body.collide_world_bounds = true
125
125
 
126
126
  player.animations.add('left', [0, 1, 2, 3], 10, true)
127
127
  player.animations.add('right', [5, 6, 7, 8], 10, true)
data/demo/config.ru CHANGED
@@ -9,9 +9,9 @@ opal = Opal::Server.new { |s|
9
9
  s.main = 'main'
10
10
  }
11
11
 
12
- map opal.source_maps.prefix do
13
- run opal.source_maps
14
- end
12
+ # map opal.source_maps.prefix do
13
+ # run opal.source_maps
14
+ # end
15
15
 
16
16
  map '/assets' do
17
17
  run opal.sprockets
data/lib/opal/phaser.rb CHANGED
@@ -1,7 +1,5 @@
1
1
  if RUBY_ENGINE == 'opal'
2
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
4
  else
7
5
  require 'opal'
@@ -0,0 +1,4 @@
1
+ # These requires must be loaded in order of dependency:
2
+ require 'opal/phaser/animation/animation'
3
+ require 'opal/phaser/animation/animation_manager'
4
+ require 'opal/phaser/animation/frame'
@@ -0,0 +1,8 @@
1
+ # These requires must be loaded in order of dependency:
2
+ # TODO: look into why `puts File.dirname(__FILE__)` is not working for Opal
3
+
4
+ require 'opal/phaser/core/state'
5
+ require 'opal/phaser/core/anchor'
6
+ require 'opal/phaser/core/group'
7
+ require 'opal/phaser/core/signal'
8
+ require 'opal/phaser/core/world'
@@ -33,16 +33,17 @@ module Phaser
33
33
  }
34
34
  end
35
35
 
36
- alias_native :cache, :cache, as: Cache
37
- alias_native :add, :add, as: GameObjectFactory
36
+ alias_native :cache, :cache, as: Cache
37
+ alias_native :add, :add, as: GameObjectFactory
38
+ alias_native :world, :world, as: World
39
+ alias_native :physics, :physics, as: Physics
40
+ alias_native :input, :input, as: Input
41
+ alias_native :time, :time, as: Time
42
+ alias_native :rnd, :rnd, as: RandomDataGenerator
38
43
 
39
44
  alias_native :load
40
- alias_native :world, :world, as: World
41
45
  alias_native :stage
42
- alias_native :physics, :physics, as: Physics
43
46
  alias_native :debug
44
- alias_native :input, :input, as: Input
45
47
  alias_native :width
46
- alias_native :time
47
48
  end
48
49
  end
@@ -6,6 +6,7 @@ module Phaser
6
6
  alias_native :physics_body_type, :physicsBodyType
7
7
  alias_native :enable_body_debug, :enableBodyDebug
8
8
  alias_native :add_child, :addChild
9
+ alias_native :set_all, :setAll
9
10
  alias_native :children
10
11
  alias_native :create
11
12
 
@@ -0,0 +1,7 @@
1
+ # These requires must be loaded in order of dependency:
2
+ require 'opal/phaser/game_objects/events'
3
+ require 'opal/phaser/game_objects/sprite'
4
+ require 'opal/phaser/game_objects/tile_sprite'
5
+ require 'opal/phaser/game_objects/text'
6
+ require 'opal/phaser/game_objects/image'
7
+ require 'opal/phaser/game_objects/game_object_factory'
@@ -2,11 +2,11 @@ module Phaser
2
2
  class GameObjectFactory
3
3
  include Native
4
4
 
5
- alias_native :sprite, :sprite, as: Sprite
6
- alias_native :group, :group, as: Group
7
- alias_native :text, :text, as: Text
8
- alias_native :image, :image, as: Image
9
- alias_native :tween, :tween, as: Tween
10
- alias_native :tile_sprite, :tileSprite
5
+ alias_native :sprite, :sprite, as: Sprite
6
+ alias_native :group, :group, as: Group
7
+ alias_native :text, :text, as: Text
8
+ alias_native :image, :image, as: Image
9
+ alias_native :tween, :tween, as: Tween
10
+ alias_native :tile_sprite, :tileSprite, as: TileSprite
11
11
  end
12
12
  end
@@ -3,7 +3,6 @@ module Phaser
3
3
  include Native
4
4
 
5
5
  alias_native :scale
6
- alias_native :body
7
6
  alias_native :bounce
8
7
 
9
8
  alias_native :kill
@@ -35,8 +34,9 @@ module Phaser
35
34
 
36
35
  alias_native :load_texture, :loadTexture
37
36
 
37
+ alias_native :body, :body, as: Physics::Arcade::Body
38
38
  alias_native :anchor, :anchor, as: Anchor
39
39
  alias_native :animations, :animations, as: AnimationManager
40
- alias_native :events, :events, as: Events
40
+ alias_native :events, :events, as: Events
41
41
  end
42
42
  end
@@ -0,0 +1,7 @@
1
+ class TileSprite
2
+ include Native
3
+
4
+ alias_native :auto_scroll, :autoScroll
5
+ alias_native :stop_scroll, :stopScroll
6
+ alias_native :body
7
+ end
@@ -0,0 +1,4 @@
1
+ # These requires must be loaded in order of dependency:
2
+ require 'opal/phaser/input/key'
3
+ require 'opal/phaser/input/keyboard'
4
+ require 'opal/phaser/input/input'
@@ -2,6 +2,9 @@ module Phaser
2
2
  class Input
3
3
  include Native
4
4
 
5
+ alias_native :x
6
+ alias_native :y
7
+
5
8
  alias_native :keyboard, :keyboard, as: Keyboard
6
9
 
7
10
  alias_native :on_down, :onDown, as: Signal
@@ -0,0 +1,8 @@
1
+ module Phaser
2
+ class Key
3
+ include Native
4
+
5
+ alias_native :on_down, :onDown, as: Signal
6
+ alias_native :down?, :isDown
7
+ end
8
+ end
@@ -2,6 +2,15 @@ module Phaser
2
2
  class Keyboard
3
3
  include Native
4
4
 
5
+ SPACEBAR = `Phaser.Keyboard.SPACEBAR`
6
+ LEFT = `Phaser.Keyboard.LEFT`
7
+ RIGHT = `Phaser.Keyboard.RIGHT`
8
+ A = `Phaser.Keyboard.A`
9
+ D = `Phaser.Keyboard.D`
10
+
5
11
  alias_native :create_cursor_keys, :createCursorKeys
12
+ alias_native :remove_key, :removeKey
13
+
14
+ alias_native :add_key, :addKey, as: Key
6
15
  end
7
16
  end
@@ -0,0 +1,2 @@
1
+ # These requires must be loaded in order of dependency:
2
+ require 'opal/phaser/loader/cache'
@@ -0,0 +1,2 @@
1
+ # These requires must be loaded in order of dependency:
2
+ require 'opal/phaser/math/random_data_generator'
@@ -0,0 +1,7 @@
1
+ module Phaser
2
+ class RandomDataGenerator
3
+ include Native
4
+
5
+ alias_native :integer_in_range, :integerInRange
6
+ end
7
+ end
@@ -0,0 +1,2 @@
1
+ # These requires must be loaded in order of dependency:
2
+ require 'opal/phaser/physics/physics'
@@ -13,6 +13,21 @@ module Phaser
13
13
  alias_native :check_collision, :checkCollision
14
14
 
15
15
  class Body
16
+ include Native
17
+
18
+ alias_native :gravity
19
+ alias_native :velocity
20
+ alias_native :bounce
21
+ alias_native :touching
22
+ alias_native :set_size, :setSize
23
+
24
+ def collide_world_bounds=(bool)
25
+ `#@native.collideWorldBounds = bool`
26
+ end
27
+
28
+ def immovable=(bool)
29
+ `#@native.immovable = bool`
30
+ end
16
31
  end
17
32
  end
18
33
 
@@ -1,31 +1,16 @@
1
+ # We need the Opal Native support library here:
1
2
  require 'native'
2
3
 
3
-
4
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
-
5
+ require 'opal/phaser/core/files'
6
+ require 'opal/phaser/animation/files'
7
+ require 'opal/phaser/tween/files'
8
+ require 'opal/phaser/physics/files'
9
+ require 'opal/phaser/game_objects/files'
10
+ require 'opal/phaser/input/files'
11
+ require 'opal/phaser/loader/files'
12
+ require 'opal/phaser/time/files'
13
+ require 'opal/phaser/math/files'
14
+
15
+ # TODO: This is odd here as it doesn't fit the files.rb require pattern... how can we clean this up?
31
16
  require 'opal/phaser/core/game'
@@ -0,0 +1,4 @@
1
+ # These requires must be loaded in order of dependency:
2
+ require 'opal/phaser/time/timer_event'
3
+ require 'opal/phaser/time/timer'
4
+ require 'opal/phaser/time/time'
@@ -0,0 +1,12 @@
1
+ module Phaser
2
+ class Time
3
+ include Native
4
+
5
+ alias_native :events, :events, as: Timer
6
+ alias_native :fps
7
+
8
+ def advanced_timing=(bool)
9
+ `#@native.advancedTiming = bool`
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,10 @@
1
+ module Phaser
2
+ class Timer
3
+ include Native
4
+
5
+ SECOND = `Phaser.Timer.SECOND`
6
+
7
+ alias_native :loop, :loop, as: TimerEvent
8
+ alias_native :start
9
+ end
10
+ end
@@ -0,0 +1,8 @@
1
+ module Phaser
2
+ class TimerEvent
3
+ include Native
4
+
5
+ alias_native :start
6
+ alias_native :timer
7
+ end
8
+ end
@@ -0,0 +1,2 @@
1
+ # These requires must be loaded in order of dependency:
2
+ require 'opal/phaser/tween/tween'
@@ -1,5 +1,5 @@
1
1
  module Opal
2
2
  module Phaser
3
- VERSION = '0.1.4'
3
+ VERSION = '0.1.6'
4
4
  end
5
5
  end
data/opal-phaser.gemspec CHANGED
@@ -15,7 +15,6 @@ Gem::Specification.new do |s|
15
15
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
16
16
  s.require_paths = ['lib']
17
17
 
18
- s.add_runtime_dependency 'opal', '~> 0.6.0'
19
- s.add_development_dependency 'yard'
18
+ s.add_runtime_dependency 'opal'
20
19
  s.add_development_dependency 'rake'
21
20
  end
metadata CHANGED
@@ -1,37 +1,23 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: opal-phaser
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.6
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-23 00:00:00.000000000 Z
11
+ date: 2015-04-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: opal
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - "~>"
18
- - !ruby/object:Gem::Version
19
- version: 0.6.0
20
- type: :runtime
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - "~>"
25
- - !ruby/object:Gem::Version
26
- version: 0.6.0
27
- - !ruby/object:Gem::Dependency
28
- name: yard
29
15
  requirement: !ruby/object:Gem::Requirement
30
16
  requirements:
31
17
  - - ">="
32
18
  - !ruby/object:Gem::Version
33
19
  version: '0'
34
- type: :development
20
+ type: :runtime
35
21
  prerelease: false
36
22
  version_requirements: !ruby/object:Gem::Requirement
37
23
  requirements:
@@ -64,7 +50,6 @@ files:
64
50
  - Rakefile
65
51
  - common/images/logo.png
66
52
  - demo/Gemfile
67
- - demo/Gemfile.lock
68
53
  - demo/README.md
69
54
  - demo/app/main.rb
70
55
  - demo/assets/baddie.png
@@ -81,23 +66,38 @@ files:
81
66
  - lib/opal/phaser.rb
82
67
  - lib/opal/phaser/animation/animation.rb
83
68
  - lib/opal/phaser/animation/animation_manager.rb
69
+ - lib/opal/phaser/animation/files.rb
84
70
  - lib/opal/phaser/animation/frame.rb
85
71
  - lib/opal/phaser/core/anchor.rb
72
+ - lib/opal/phaser/core/files.rb
86
73
  - lib/opal/phaser/core/game.rb
87
74
  - lib/opal/phaser/core/group.rb
88
75
  - lib/opal/phaser/core/signal.rb
89
76
  - lib/opal/phaser/core/state.rb
90
77
  - lib/opal/phaser/core/world.rb
91
78
  - lib/opal/phaser/game_objects/events.rb
79
+ - lib/opal/phaser/game_objects/files.rb
92
80
  - lib/opal/phaser/game_objects/game_object_factory.rb
93
81
  - lib/opal/phaser/game_objects/image.rb
94
82
  - lib/opal/phaser/game_objects/sprite.rb
95
83
  - lib/opal/phaser/game_objects/text.rb
84
+ - lib/opal/phaser/game_objects/tile_sprite.rb
85
+ - lib/opal/phaser/input/files.rb
96
86
  - lib/opal/phaser/input/input.rb
87
+ - lib/opal/phaser/input/key.rb
97
88
  - lib/opal/phaser/input/keyboard.rb
98
89
  - lib/opal/phaser/loader/cache.rb
90
+ - lib/opal/phaser/loader/files.rb
91
+ - lib/opal/phaser/math/files.rb
92
+ - lib/opal/phaser/math/random_data_generator.rb
93
+ - lib/opal/phaser/physics/files.rb
99
94
  - lib/opal/phaser/physics/physics.rb
100
95
  - lib/opal/phaser/setup.rb
96
+ - lib/opal/phaser/time/files.rb
97
+ - lib/opal/phaser/time/time.rb
98
+ - lib/opal/phaser/time/timer.rb
99
+ - lib/opal/phaser/time/timer_event.rb
100
+ - lib/opal/phaser/tween/files.rb
101
101
  - lib/opal/phaser/tween/tween.rb
102
102
  - lib/opal/phaser/version.rb
103
103
  - opal-phaser.gemspec