Class: Phaser::Key

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

Instance Method Summary collapse

Instance Method Details

#on(type, &block) ⇒ Object



5
6
7
8
9
10
11
12
# File 'lib/opal/phaser/input/key.rb', line 5

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

#reset(hard) ⇒ Object



14
15
16
17
18
19
20
# File 'lib/opal/phaser/input/key.rb', line 14

def reset(hard)
  if hard == "hard".to_sym
    `#@native.reset(true)`
  else
    `#@native.reset(false)`
  end
end