I implemented a save/load settings rebind functionality, but I’m having some weirdness when binding keys to numbers.
When it loads the default, or right after binding an InputEventKey to a number key with the event set to physical, it looks fine. But after saving the dictionary to the file, and reloading it, the display no longer shows the number, but instead unicode characters. I’ve attached a screenshot below.
When loading the input event, I use the following code to get the text
var action_bind = OS.get_keycode_string(DisplayServer.keyboard_get_keycode_from_physical(event.physical_keycode))
When saving, i do a JSON.stringify on the payload dictionary, which contains all of the keybinding events, and then a file.store_line() on the resulting json string.
Letters and other keys work fine, its just numbers that make the weird characters.
Finally figured it out. I had followed a tutorial for saving/loading settings and key map data, and while the key map data was being saved properly initially, the loading of the data was incorrect.
the data dictionary would come in as a json string, and the tutorial was doing
int(dictionary.mapping_key), and just parsing the json element as an int. not sure how that worked for the letter mapping, but it seemed to work for letters and other keys, but not the number keys (top row or numpad).
once I replaced that with a custom parser that gets the physical keycode from the json, it works beautifully.
@qmilfox I appreciate the suggestion about the font, that is honestly something that I would never have thought to check in a million years.