Class: Phaser::Game

Inherits:
Object
  • Object
show all
Includes:
Native
Defined in:
lib/opal/phaser/core/game.rb

Instance Method Summary collapse

Constructor Details

#initialize(width, height, renderer = Phaser::AUTO, parent = '', state = nil, transparent = false, antialias = true, physics = nil, &block) ⇒ Game

Returns a new instance of Game.



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/opal/phaser/core/game.rb', line 7

def initialize(width, height, renderer = Phaser::AUTO,
              parent = '', state = nil, transparent = false, antialias = true,
              physics = nil, &block)

  if state
    state.game = self
  else
    state = State.new(self)
  end

  if block_given?
    state.instance_eval(&block)
  end

  _native = %x{
    new Phaser.Game(width, height, renderer, parent, #{state.to_n}, transparent,
                    antialias, physics)
  }
  super(_native)
end