Closed DarthGandalf closed 2 years ago
That'sā¦ weird. The game uses the SDL scan codes to match key -> ASCII. I'm curious about the reason behind this bug š
I know it's been a while, but going to write a bit about this.
The SDL2 port seems to use SDL_Scancode exclusively, so the reported issue is expected. SDL scancodes aim to identify keys by their locations on the keyboard, regardless of the actual layout in use. SDL_Keycode should be layout-dependent, according to this page: https://wiki.libsdl.org/CategoryKeyboard
There may still be exceptions. For instance, if you're using a layout on Windows for which AltGr is mapped to Ctrl+LAlt, then you might get two separate key press events after pressing on AltGr.
There's also SDL2's separate text input API: https://wiki.libsdl.org/Tutorials/TextInput
Hah! That's very interesting, and another thing I didn't know about. Thank you!! I think this shouldn't be hard to fix š¤
@DarthGandalf Can you check that my PR fixes your issue?
Yes, it follows the layout now with your patch. I don't remember, only arrows and space is used in other parts of the game, never letter keys?
@DarthGandalf In the name creation that should matter.
Of course. I meant, whether it doesn't break anything else, like WASD keys which are not used here
Ah - pretty sure everything else uses the scancode still, which will work as it has before (positional on keyboard). Maybe a nice idea in the future to support remapping them...
Typing player name doesn't honor current layout. I configured my keyboard to use Colemak but the game treats it like Qwerty.
It's not a too big deal, since there's not much typing involved in this game, but still...
Platform is linux, as you could guess :)