I wanted to scale the windowed version of my game by using Ctrl- and Ctrl+ to scale down and up. This works, I destroy the old window and create a new one with the smaller or bigger size (and the renderer and render texture). However, I’m not able to press Ctrl and press + release - or + twice to scale twice. This is caused by an SDL_KEYUP event for the Ctrl key after creating the new window, even though I keep the Ctrl-key pressed. Is this expected? Is there anything I can do about it?
I realized there’s a better way of doing this, just using SDL_SetWindowSize(), but I’d still like an answer as to why this happens. So if anyone knows…
I’m not sure, but it’s possible that when a window gets focus (which I think happens implicitly when creating it) all the pressed keys are reset to prevent problems like the game missing a key-up when alt-tabbing out of the window (=> it only registered the keys getting pressed, when releasing them another window has focus) and then getting back into the window by clicking on the task bar
Mmm, yeah, that makes sense. Thanks.