Class: RubySketch::VirtualKey::Dispatcher
- Inherits:
-
Object
- Object
- RubySketch::VirtualKey::Dispatcher
- Defined in:
- lib/rubysketch/virtual_key.rb
Instance Attribute Summary collapse
-
#repeat_first_delay ⇒ Object
Returns the value of attribute repeat_first_delay.
-
#repeat_interval ⇒ Object
Returns the value of attribute repeat_interval.
Instance Method Summary collapse
-
#initialize(view) ⇒ Dispatcher
constructor
A new instance of Dispatcher.
- #key_down(chars, key) ⇒ Object
- #key_up(chars, key) ⇒ Object
- #pressing?(chars, key) ⇒ Boolean
Constructor Details
#initialize(view) ⇒ Dispatcher
Returns a new instance of Dispatcher.
91 92 93 94 95 96 97 |
# File 'lib/rubysketch/virtual_key.rb', line 91 def initialize(view) @view = view @pressings = {} @repeat_first_delay = 0.3 @repeat_interval = 0.1 end |
Instance Attribute Details
#repeat_first_delay ⇒ Object
Returns the value of attribute repeat_first_delay.
89 90 91 |
# File 'lib/rubysketch/virtual_key.rb', line 89 def repeat_first_delay @repeat_first_delay end |
#repeat_interval ⇒ Object
Returns the value of attribute repeat_interval.
89 90 91 |
# File 'lib/rubysketch/virtual_key.rb', line 89 def repeat_interval @repeat_interval end |
Instance Method Details
#key_down(chars, key) ⇒ Object
99 100 101 102 |
# File 'lib/rubysketch/virtual_key.rb', line 99 def key_down(chars, key) dispatch :down, chars, key pressing chars, key end |
#key_up(chars, key) ⇒ Object
104 105 106 107 |
# File 'lib/rubysketch/virtual_key.rb', line 104 def key_up(chars, key) dispatch :up, chars, key released chars, key end |
#pressing?(chars, key) ⇒ Boolean
109 110 111 |
# File 'lib/rubysketch/virtual_key.rb', line 109 def pressing?(chars, key) @pressings.key? to_key(chars, key) end |