Class: Phaser::Loader
- Inherits:
-
Object
- Object
- Phaser::Loader
- Includes:
- Native
- Defined in:
- lib/opal/phaser/core/loader.rb
Instance Method Summary collapse
- #cross_origin=(value) ⇒ Object
-
#initialize(game) ⇒ Loader
constructor
A new instance of Loader.
- #on(type, context, &block) ⇒ Object
Constructor Details
#initialize(game) ⇒ Loader
Returns a new instance of Loader.
5 6 7 8 9 10 11 |
# File 'lib/opal/phaser/core/loader.rb', line 5 def initialize(game) if native?(game) super else super(`new Phaser.Loader(#{game.to_n})`) end end |
Instance Method Details
#cross_origin=(value) ⇒ Object
31 32 33 |
# File 'lib/opal/phaser/core/loader.rb', line 31 def cross_origin=(value) `#@native.crossOrigin = #{value}` end |
#on(type, context, &block) ⇒ Object
35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/opal/phaser/core/loader.rb', line 35 def on(type, context, &block) case type.to_sym when :file_complete `#@native.onFileComplete.add(#{block.to_n}, #{context})` when :file_error `#@native.onFileError.add(#{block.to_n}, #{context})` when :file_start `#@native.onFileStart.add(#{block.to_n}, #{context})` when :load_complete `#@native.onLoadComplete.add(#{block.to_n}, #{context})` when :load_start `#@native.onLoadStart.add(#{block.to_n}, #{context})` end end |