Class: Phaser::Input

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

Instance Method Summary collapse

Instance Method Details

#on(type, &block) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/opal/phaser/input/input.rb', line 13

def on(type, &block)
  case type.to_sym
  when :down
    `#@native.onDown.add(#{block.to_n})`
  when :up
    `#@native.onUp.add(#{block.to_n})`
  when :tap
    `#@native.onTap.add(#{block.to_n})`
  when :hold
    `#@native.onHold.add(#{block.to_n})`
  end
end