Class: Phaser::State

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

Instance Method Summary collapse

Constructor Details

#initialize(game = nil, &block) ⇒ State

Returns a new instance of State.



6
7
8
9
10
11
12
13
14
# File 'lib/opal/phaser/core/state.rb', line 6

def initialize(game = nil, &block)
  @native  = `new Phaser.State`
  self.game    = game

  if block_given?
    block.call(@game)
  end
  super(@native)
end

Instance Method Details

#createObject



28
29
# File 'lib/opal/phaser/core/state.rb', line 28

def create
end

#gameObject



21
22
23
# File 'lib/opal/phaser/core/state.rb', line 21

def game
  @game
end

#game=(g_) ⇒ Object



16
17
18
19
# File 'lib/opal/phaser/core/state.rb', line 16

def game=(g_)
  @game = g_
  `#@native.game = #@game`
end

#preloadObject



25
26
# File 'lib/opal/phaser/core/state.rb', line 25

def preload
end

#renderObject



34
35
# File 'lib/opal/phaser/core/state.rb', line 34

def render
end

#to_nObject



37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/opal/phaser/core/state.rb', line 37

def to_n
  _preload = proc { preload }
  _create = proc { create }
  _update = proc { update }
  _render = proc { render }
  %x{
    var obj = { preload: #{_preload}, create: #{_create}, update: #{_update},
                render: #{_render} }
  }

  return %x{ obj }
end

#updateObject



31
32
# File 'lib/opal/phaser/core/state.rb', line 31

def update
end