SDL_GetKeyFromScancode(3)
β¨ SDL_GetKeyFromScancode β¨
okay bestie, welcome to the SDL3 FUNCTIONS corner of the manual, where we're decoding SDL_GetKeyFromScancode β the lil glow-up machine that tells you which key code a scancode turns into, based on whatever keyboard layout your user is currently living in. π
π NAME π
SDL_GetKeyFromScancode β get the key code corresponding to the given scancode according to the current keyboard layout. periodt.
πΈ SYNOPSIS πΈ
#include <SDL3/SDL_keyboard.h>
SDL_Keycode SDL_GetKeyFromScancode(SDL_Scancode scancode, SDL_Keymod modstate, bool key_event);
π¦ DESCRIPTION π¦
so here's the tea. β
If you want the keycode exactly how it would show up in actual key events β like, including whatever options got specified in SDL_HINT_KEYCODE_OPTIONS β then you pass key_event as true. slay.
Otherwise, this function is just doing the simple thing: it translates the scancode based on the modstate you handed it. no hint energy, no extras, just vibes. β¨
π FUNCTION PARAMETERS π
scancodeβ the desiredSDL_Scancodeyou wanna query. the thing you're curious about. πmodstateβ the modifier state to use when translating the scancode into a keycode. shift? ctrl? whatever you're holding, tell it here.key_eventβtrueif the keycode is gonna be used in key events. that's it, that's the whole flag. π«Ά
β RETURN VALUE β
Returns the SDL_Keycode that corresponds to the given SDL_Scancode. it gives you the answer, bestie. that's the whole point. π₯
π THREAD SAFETY π
π¨ not thread safe. do NOT be out here calling this from multiple threads thinking it's gonna behave. it will not. one thread at a time, queen. π
π AVAILABILITY π
this icon has been available since SDL 3.2.0. so if you're on something olderβ¦ bestie, update. π
π§ SEE ALSO π§
and that's the whole page, no cap. π brought to you by the fine folks at Simple Directmedia Layer, version SDL 3.4.18 β go forth and translate your scancodes, main character. πβ¨π¦
π¦ where this page comes from
- fedora 43: SDL3-devel 3.4.18-1.fc43 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 43: SDL3-devel 3.4.18-1.fc43 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 44: SDL3-devel 3.4.18-1.fc44 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 44: SDL3-devel 3.4.18-1.fc44 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms