Reputation: 29
How can I see if a key is released via keystates in sdl.
const Uint8 *keystate = SDL_GetKeyboardState(NULL);
if (keystate[SDL_SCANCODE_UP])
{
renderer();
}
Upvotes: 2
Views: 735
Reputation: 539
You'll need to store and update every frame a list of states for the keys you are interested. A key is released if it was pressed in the previous frame and it is not pressed in this frame.
Upvotes: 1