Class: Bestguigui::Input
- Inherits:
-
Object
- Object
- Bestguigui::Input
- Defined in:
- lib/bestguigui_lab/input.rb
Overview
Mappe une action à plusieurs touches/boutons (ex. right: [KB_RIGHT, KB_D]).
Instance Method Summary collapse
- #button_down(action, id) ⇒ Object
- #button_down?(action) ⇒ Boolean
- #button_up(action, id) ⇒ Object
-
#initialize(bindings = {}) ⇒ Input
constructor
A new instance of Input.
Constructor Details
#initialize(bindings = {}) ⇒ Input
Returns a new instance of Input.
6 7 8 |
# File 'lib/bestguigui_lab/input.rb', line 6 def initialize(bindings = {}) @bindings = bindings end |
Instance Method Details
#button_down(action, id) ⇒ Object
11 |
# File 'lib/bestguigui_lab/input.rb', line 11 def (action, id) = @bindings[action].any? { |key| key == id } |
#button_down?(action) ⇒ Boolean
10 |
# File 'lib/bestguigui_lab/input.rb', line 10 def (action) = @bindings[action].any? { |key| Gosu.(key) } |
#button_up(action, id) ⇒ Object
12 |
# File 'lib/bestguigui_lab/input.rb', line 12 def (action, id) = @bindings[action].any? { |key| key == id } |