Class: Badline::GUI::KeyMap

Inherits:
Object
  • Object
show all
Defined in:
lib/badline/gui/key_map.rb

Overview

Translates SDL key events into the emulator’s key symbols.

MAP is just the overrides, anything not covered simply falls though.

Constant Summary collapse

MAP =
{
  "Backspace" => :delete,
  "Return" => :return,
  "Right" => :cursor_h,
  "Down" => :cursor_v,
  "Space" => :space,
  "Left Ctrl" => :control,
  "Left Alt" => :cbm,
  "Left Shift" => :lshift,
  "Right Shift" => :rshift,
  "Home" => :clr_home,
  "Escape" => :run_stop,
  "Backslash" => :"@",
  "'" => :":",
  "End" => ,
  "Keypad +" => :+,
  "Keypad *" => :*
}.freeze

Class Method Summary collapse

Class Method Details

.parse(event) ⇒ Object



28
29
30
31
# File 'lib/badline/gui/key_map.rb', line 28

def self.parse(event)
  name = SDL2::Key.name_of(event.sym)
  MAP[name] || name.downcase.to_sym
end