New answers tagged

2

As it says on the SDL documentation, SDL_GetKeyboardState returns an array of the keyboard state, with SDL_SCANCODE values as indices. You can't use the SDLK_ values, they won't reference the right values. So change your code to use the SDL_SCANCODE values. There is a reference page here. Your if-statement should then look like if ...


1

Your issue is that SDL sends keyboard events only when the state changes. So, if you move your current buffer to the previous buffer and then clear the current buffer, your keystate won't be correct on any of the frames after a key press. On the frame when the key was pressed, the current buffer should hold the value, but on frames after, there won't be a ...



Top 50 recent answers are included