SDL_GetKeyboardState
returns an array of Uint8
, not uint
! As you walk through the array, each step you are seeing sizeof(uint)
bytes and checking if an unsigned int
value is non 0. At i=5
, you're checking 4 scancodes, one of them being SDLK_SCANCODE_Q
.
Check the docs: https://wiki.libsdl.org/SDL_GetKeyboardState.
I hope your compiler warned you about this type mismatch.