SDL_SetScancodeName(3)

✨ SDL_SetScancodeName ✨

okay bestie, we're deep in the SDL3 FUNCTIONS section of the manual and this one is a lil cutie πŸ’– it lives in SDL_keyboard.h and it's all about giving a scancode a human-readable name, like giving your blorbo a nickname. iconic behavior honestly.


🌸 NAME 🌸

SDL_SetScancodeName β€” set a human-readable name for a scancode. no cap, that's literally the whole job πŸ’…


πŸŽ€ SYNOPSIS πŸŽ€

#include <SDL3/SDL_keyboard.h>

bool SDL_SetScancodeName(SDL_Scancode scancode, const char *name);

πŸ¦‹ FUNCTION PARAMETERS πŸ¦‹

  • scancode β€” the desired SDL_Scancode. like, which key are we naming, bestie? πŸ‘€
  • name β€” the name to use for the scancode, encoded as UTF-8. and okay listen, this part is important: the string is not copied, so the pointer you hand to this function has to stay valid for as long as SDL is being used. like it's not taking a screenshot of your string, it's holding your hand the whole time. don't let go 🫢

πŸ’œ RETURN VALUE πŸ’œ

Returns true on success or false on failure. and if it fails? call SDL_GetError() for more info, she'll tell you what went wrong 😭


🌈 THREAD SAFETY 🌈

This function is not thread safe. so pls don't be sharing her across threads, that's giving chaos πŸ’€


⭐ AVAILABILITY ⭐

This function is available since SDL 3.2.0. vintage-ish but not ancient, we love a recent queen πŸ‘‘


πŸ’« SEE ALSO πŸ’«

  • SDL_GetScancodeName(3) β€” the read-only sibling, the getter to this setter, the other half of the duo πŸ’ž

and that's the whole page, bestie!! go forth and name ur scancodes, just keep that pointer alive fr fr πŸ§šβ€β™€οΈ

mwah πŸ’‹ this was Simple Directmedia Layer, SDL 3.4.18, and the page is dated SDL_SetScancodeName(3). periodt. πŸ’…βœ¨

πŸ“¦ where this page comes from