|Topic was automatically imported from the old Question2Answer platform.
I know that it is possible to get the InputEventKey unicode when a key is pressed, but how can I get a unicode of a scancode in the code and without a key pressed event?
I’m currently working on a controls menu, where the player can change the key bindings and I’m having problems displaying the correct key in the UI.
Everything works fine when the player presses a key as I can get the unicode and display it correctly. But how about on _ready, when I load the saved scancodes? Is there a way to convert a scancode to unicode?
The following code works correctly inside the _input(event) method:
text = char(event.unicode)
Exemple: On PT-BR keyboard, I hit BraceRight and It shows " [ " as expected.
But how to get this info outside an input event? For example when I load all the scancodes from a file when adding to the InputMap. In the same example, the result will be “BraceRight”.
lsgrandchamp | 2021-05-19 18:28