SDL_GetScancodeFromKey(3)
π SDL_GetScancodeFromKey(3) π
okay bestie, welcome to the SDL3 FUNCTIONS section of the SDL_GetScancodeFromKey(3) manual β yes we're doing keyboard archaeology today and honestly? it's giving detective energy πβ¨
β¨ NAME β¨
SDL_GetScancodeFromKey β get the scancode that matches the keycode you hand it, according to whatever keyboard layout is currently vibing on the system. π
πΈ SYNOPSIS πΈ
#include <SDL3/SDL_keyboard.h>
SDL_Scancode SDL_GetScancodeFromKey(SDL_Keycode key, SDL_Keymod *modstate);
like, that's it. two args, one return, no drama. π
π¦ DESCRIPTION π¦
so here's the tea, bestie: there may be multiple scancode + modifier states that can generate this keycode, and this function will just return the first one found. no deliberation, no committee meeting, no "let me think about it" β first match wins, periodt. π
π FUNCTION PARAMETERS π
keyβ the desiredSDL_Keycodeyou wanna query. that's the thing you're asking about. π«Άmodstateβ a pointer to the modifier state that would be used when the scancode generates this key. may beNULL, so don't stress if you don't have one handy. π
β RETURN VALUE β
Returns the SDL_Scancode that corresponds to the given SDL_Keycode. iconic behaviour, truly. π₯
π THREAD SAFETY π
This function is not thread safe.
not me having to say this but: do NOT call this from multiple threads at the same time, bestie. it will not go well. π
π AVAILABILITY π
This function is available since SDL 3.2.0. so if you're on anything older, it's giving nothing, i'm so sorry. π
π SEE ALSO π
SDL_GetKeyFromScancode(3)β the reverse direction, the remix πSDL_GetScancodeName(3)β for when you want the scancode to have a cute little name π·οΈ
okay bye bestie, this page was brought to you by Simple Directmedia Layer π running SDL 3.4.18 β go forth and translate your keycodes, you absolute 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