Class: Controls

Inherits:
Object
  • Object
show all
Defined in:
lib/controls.rb

Overview

And here we handle the controls

Copyright © 2011 Nikolay Nemshilov

Constant Summary collapse

BUTTONS =
{
  :quit       => Button::KbQ,
  :reset      => Button::KbEscape,
  :drop       => Button::KbSpace,
  :left       => Button::KbLeft,
  :right      => Button::KbRight,
  :turn_left  => Button::KbUp,
  :turn_right => Button::KbDown
}.freeze

Instance Method Summary collapse

Instance Method Details

#command_for(button) ⇒ Object



18
19
20
21
22
# File 'lib/controls.rb', line 18

def command_for(button)
  BUTTONS.each do |key, value|
    return key if button === value
  end
end