| SDL_GetKeyboardState(3) | SDL3 FUNCTIONS | SDL_GetKeyboardState(3) |
SDL_GetKeyboardState - Get a snapshot of the current state of the keyboard.
Defined in SDL3/SDL_keyboard.h
#include "SDL3/SDL.h"
const bool * SDL_GetKeyboardState(int *numkeys);
The pointer returned is a pointer to an internal SDL array. It will be valid for the whole lifetime of the application and should not be freed by the caller.
A array element with a value of true means that the key is pressed
and a value of false means that it is not. Indexes into this array are
obtained by using SDL_Scancode
values.
Use SDL_PumpEvents () to update the state array.
This function gives you the current state after all events have been processed, so if a key or button has been pressed and released before you process events, then the pressed state will never show up in the
SDL_GetKeyboardState () calls.
Note: This function doesn't take into account whether shift has been pressed or not.
Returns a pointer to an array of key states.
It is safe to call this function from any thread.
This function is available since SDL 3.2.0.
•(3), SDL_PumpEvents(3), •(3), SDL_ResetKeyboard(3)
| SDL 3.2.10 | Simple Directmedia Layer |