Class: RubySketch::VirtualKey::Dispatcher
- Inherits:
-
Object
- Object
- RubySketch::VirtualKey::Dispatcher
- Defined in:
- lib/rubysketch/window.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.
89 90 91 92 93 94 95 |
# File 'lib/rubysketch/window.rb', line 89 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.
87 88 89 |
# File 'lib/rubysketch/window.rb', line 87 def repeat_first_delay @repeat_first_delay end |
#repeat_interval ⇒ Object
Returns the value of attribute repeat_interval.
87 88 89 |
# File 'lib/rubysketch/window.rb', line 87 def repeat_interval @repeat_interval end |
Instance Method Details
#key_down(chars, key) ⇒ Object
97 98 99 100 |
# File 'lib/rubysketch/window.rb', line 97 def key_down(chars, key) dispatch :down, chars, key pressing chars, key end |
#key_up(chars, key) ⇒ Object
102 103 104 105 |
# File 'lib/rubysketch/window.rb', line 102 def key_up(chars, key) dispatch :up, chars, key released chars, key end |
#pressing?(chars, key) ⇒ Boolean
107 108 109 |
# File 'lib/rubysketch/window.rb', line 107 def pressing?(chars, key) @pressings.key? to_key(chars, key) end |