Hello!
The full source code can be found here
I have coded a menu to the game where the user can reassign the input mappings.
Now I want to localize the key names, so that "Left" is "Links" in German for example, but this seems impossible right now.
When reassigning an input, I listen for an _Input, which gives me an InputEvent
object.
I check if the given object is an InputEventKey
.
InputEventKey
contains the following relevant information:
Was the user pressing Shift/Alt/Ctrl
The ScanCode
* The Unicode, but this is 0 for some keys.
I assign the new InputEvent
to the Godot input system via InputMap.ActionAddEvent
.
This all works perfectly!
Now comes the problem:
Because InputEventKey.Unicode is 0 for some keys, I cannot use that to know what string to show to the user. Therefore, I must use ScanCode.
I am using a German keyboard layout. Compared to an American one Y and Z are swapped and the special characters are all over the place.
When pressing the "Z" key I get the ScanCode "90", which is correct, 90 stands for Z.
When pressing the "+" key I get the ScanCode "61", which stands for "=". On American keyboards, the "=" key is where the German "+" key is.
There seems to be no way of knowing that the user pressed "+" instead of "=". Is there some workaround?
Kind regards,
JaFu0815