Alt+Enter using Right Alt now toggles fullscreen mode (previously only Left Alt worked)
Alt+Enter using Numeric Keypad Enter now toggles fullscreen mode (previously only Enter worked)
Numeric Keypad Enter now functions the same as Enter when inputting text
altdown is explicitly set to 0 when fulscreen mode is toggled
Details
I was getting frustrated with entering an IP address for network connections using the numeric keypad, only to find that Numeric Keypad Enter didn't work. 😅
SDL appears to be handling SDLK_KP_ENTER differently than SDLK_RETURN when text input is active? Although I was easily able to add Numeric Keypad Enter when checking for Alt+Enter, I had to explicitly push \n into the input buffer when the key is pressed during text input.
Although I don't regularly press Alt+Enter using Numeric Keypad Enter myself, I decided to support it after verifying that it's customary in other games. (Downwell, RimWorld, Tony Hawk's Pro Skater 1+2)
Finally, I ran into a curious issue in my WSL development environment:
Normally, when you toggle fullscreen mode in SDL Sopwith on Windows or MacOS, Alt is considered no longer pressed even if you're still holding it. Meaning that if you want to want to toggle fullscreen mode a second time, you must first let go of Alt, and then press Alt+Enter again. (Which is totally fine.)
But, under WSL, that doesn't seem to happen naturally, and in fact the SDL_KEYUP for Alt doesn't always appear to be caught. So I've added an altdown = 0 line that explicitly forces the normal behavior:
Summary
Changes keyboard handling in these ways:
altdown
is explicitly set to 0 when fulscreen mode is toggledDetails
I was getting frustrated with entering an IP address for network connections using the numeric keypad, only to find that Numeric Keypad Enter didn't work. 😅
SDL appears to be handling
SDLK_KP_ENTER
differently thanSDLK_RETURN
when text input is active? Although I was easily able to add Numeric Keypad Enter when checking for Alt+Enter, I had to explicitly push\n
into the input buffer when the key is pressed during text input.Although I don't regularly press Alt+Enter using Numeric Keypad Enter myself, I decided to support it after verifying that it's customary in other games. (Downwell, RimWorld, Tony Hawk's Pro Skater 1+2)
Finally, I ran into a curious issue in my WSL development environment:
Normally, when you toggle fullscreen mode in SDL Sopwith on Windows or MacOS, Alt is considered no longer pressed even if you're still holding it. Meaning that if you want to want to toggle fullscreen mode a second time, you must first let go of Alt, and then press Alt+Enter again. (Which is totally fine.)
But, under WSL, that doesn't seem to happen naturally, and in fact the
SDL_KEYUP
for Alt doesn't always appear to be caught. So I've added analtdown = 0
line that explicitly forces the normal behavior:By adding this, my WSL build behaves as it should, and does not cause any changes in behavior for Windows and MacOS.
Testing
I verified that the keys I worked on still behave as expected elsewhere, such as the key bindings menu.