Closed bonki closed 2 years ago
Hi,
This is a good idea!
Unfortunately, this fix does not fully work with the keyboard layout I use. '-' works okay, but '+' is not detected.
If I type '+', which is on Shift+3, then event.key.keysym.sym
will be 51 = SDLK_3
, instead of SDLK_PLUS
.
Apparently, event.key.keysym.sym
tells what character would the key type without any modifiers.
I fixed it here: b92547755dcdfff4b4ca20e4a13ad9dc2b0c9b5d
Thank you again!
That's weird, I tested it with different layouts including ones where the keys require a modifier and it worked for me.
That's weird, I tested it with different layouts including ones where the keys require a modifier and it worked for me.
Maybe it depends on the OS or the SDL version? I am using Windows 10 and SDL 2.0.14.
UPDATE: I installed SDL 2.0.22, and nothing changed.
Apparently,
event.key.keysym.sym
tells what character would the key type without any modifiers.
Even that is false in some cases.
The French keyboard layout puts '-' where most keyboards have '6'.
But when I press that key, event.key.keysym.sym
will be 54 = '6', not '-'.
This ensures that the current keyboard layout determines the location of the '-'/'+' keys, as would be expected, and helps especially when using tenkeyless keyboards lacking a numpad. This mimics the behaviour of the original game when run under DOSBox.