Class: Tea::Kbd::Up

Inherits:
Event
  • Object
show all
Defined in:
lib/tea/m_event_keyboard.rb

Overview

Event generated when a held-down key is released. key and mods are the same as in KeyDown.

key

Physical key that was pressed, as a symbol (see key reference).

mods

Hash of the active key modifiers. Values are true or false, and the keys can be: :L_SHIFT, :R_SHIFT, :L_CTRL, :R_CTRL, :L_ALT, :R_ALT, :NUM_LOCK, :CAPS_LOCK, :ALT_GR. Also, :SHIFT, :CTRL and :ALT are provided for convenience, and Tea key constants with the same names can be used instead.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Event

each_key

Constructor Details

#initialize(sdl_event) ⇒ Up

Returns a new instance of Up.



226
227
228
229
# File 'lib/tea/m_event_keyboard.rb', line 226

def initialize(sdl_event)
  @key = sdl_keysym_to_key(sdl_event.sym)
  @mods = sdl_keymod_to_mods(sdl_event.mod)
end

Instance Attribute Details

#keyObject (readonly)

Returns the value of attribute key.



225
226
227
# File 'lib/tea/m_event_keyboard.rb', line 225

def key
  @key
end

#modsObject (readonly)

Returns the value of attribute mods.



225
226
227
# File 'lib/tea/m_event_keyboard.rb', line 225

def mods
  @mods
end