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 desired SDL_Keycode you 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 be NULL, 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 πŸ’œ


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