A button that grabs key events and populate an InputEventKey instance for Godot.
Comes with a property editor for easy setup of InputEventKey Resources in editor, great for creating ShortCut resources.
Check out the scene at the addons/input_event_key_grabber/samples folder for a complete usage example.
Copy the addons/input_event_key_grabber folder into your project or import it from Godot Asset Library.
Alternatively, if you don't need the editor plugin, just copy the addons/input_event_key_grabber/input_event_key_grabber_button.gd file into your project.
InputEventKeyGrabberButton (addons/input_event_key_grabber/input_event_key_grabber_button.gd)
signal event_updated(event: InputEventKey)
- Emitted when a new key is set either by user input or when setting
event
property.
export(String) var press_key_text = "Press key combo..."
- Text shown when key grabber is focused, hinting it is grabbing keys.
export(bool) var auto_release_focus = true
- If true, key grabber gives up focus when a key that is not a modifier (control, alt, shift, meta, command) is pressed. If its focus_next points to another Control, focus will be passed on to it, otherwise it just releases focus.
var event: InputEventKey
- InputEventKey property, changes every time user inputs a new key combo. Setting it manually updates the shown text.