funnymemellama/KeyOverlay.gd

16 lines
269 B
GDScript3
Raw Normal View History

extends Label
var keys = []
func _input(event):
if event is InputEventKey:
var key = OS.get_keycode_string(event.key_label)
if event.pressed:
if not keys.has(key):
keys.append(key)
else:
if keys.has(key):
keys.erase(key)
text = ' '.join(keys)