```{index} single: SDL_GetKeyboardState (SDL2) ``` ```{index} single: SDL2::SDL_GetKeyboardState ``` # SDL_GetKeyboardState The whole keyboard as a string of bytes, one per scancode, each 1 when that key is down. Index it with a `SDL_SCANCODE_*` constant: ```perl my $keys = SDL_GetKeyboardState(); my $left = ord substr $keys, SDL_SCANCODE_LEFT, 1; ``` `SDL2::key_pressed($scancode)` is the same question without building the string, and is what a per-frame check should use.