Termisu::Event::Key
Inherits Struct / Value / Object
Keyboard input event.
Contains the key pressed and any modifier keys that were held.
Example:
event = termisu.poll_event
if event.is_a?(Termisu::Event::Key)
if event.ctrl_c?
puts "Ctrl+C pressed, exiting..."
elsif event.key.escape?
puts "Escape pressed"
end
end
Constructors
new(key : Input::Key, modifiers : Input::Modifier = Input::Modifier::None, char : Char | Nil = nil)
SourceInstance methods
char
Returns the character for this key, if printable. Prefers the explicitly attached @char (for full Unicode input).