Class: Hokusai::KeyboardEvent
- Extended by:
- Forwardable
- Defined in:
- ui/src/hokusai/events/keyboard.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#input ⇒ Object
readonly
Returns the value of attribute input.
Attributes inherited from Event
Instance Method Summary collapse
- #hovered(canvas) ⇒ Object
-
#initialize(input, state) ⇒ KeyboardEvent
constructor
A new instance of KeyboardEvent.
- #to_json ⇒ Object
Methods inherited from Event
#bubble, #matches, name, #name, #stop
Constructor Details
#initialize(input, state) ⇒ KeyboardEvent
Returns a new instance of KeyboardEvent.
11 12 13 14 15 |
# File 'ui/src/hokusai/events/keyboard.rb', line 11 def initialize(input, state) @input = input @state = state @keyboard = input.keyboard end |
Instance Attribute Details
#input ⇒ Object (readonly)
Returns the value of attribute input.
9 10 11 |
# File 'ui/src/hokusai/events/keyboard.rb', line 9 def input @input end |
Instance Method Details
#hovered(canvas) ⇒ Object
17 18 19 |
# File 'ui/src/hokusai/events/keyboard.rb', line 17 def hovered(canvas) input.hovered?(canvas) end |
#to_json ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'ui/src/hokusai/events/keyboard.rb', line 21 def to_json { keypress: { keycode: code, char: char.to_s, super: self.super, control: ctrl, shift: shift, alt: alt } }.to_json end |