immersive-home/lib/events/event_key.gd

16 lines
436 B
GDScript3
Raw Normal View History

2023-11-22 02:44:07 +02:00
extends EventWithModifiers
class_name EventKey
var key: Key
var echo: bool
static func key_to_string(key: Key, caps: bool = false) -> String:
match key:
KEY_ASCIITILDE: return "~"
KEY_SLASH: return "/"
KEY_BACKSLASH: return "\\"
KEY_COLON: return ";"
KEY_COMMA: return ","
KEY_PERIOD: return "."
KEY_MINUS: return "-"
_: return OS.get_keycode_string(key).to_upper() if caps else OS.get_keycode_string(key).to_lower()