SDL_GetKeyboardNameForID(3)

πŸ’– SDL_GetKeyboardNameForID(3) β€” SDL3 FUNCTIONS πŸ’–

okay bestie, so like... you got a keyboard. you got an ID for that keyboard. and now you're sitting there like "girl, what is this thing even CALLED??" and honestly? valid. that's literally what this function is for, and it's part of the SDL3 fam. no cap.


✨ SYNOPSIS ✨

#include <SDL3/SDL_keyboard.h>

const char * SDL_GetKeyboardNameForID(SDL_KeyboardID instance_id);

🌸 DESCRIPTION 🌸

this is the "what's ur name, gorgeous?" function πŸ’… you hand it a keyboard's instance ID and it gives you back the name of that keyboard.

lowkey important: if the keyboard doesn't have a name, this function returns "". like, an empty string. not a NULL. an actual empty lil string. she's just ✨nameless✨ and that's fine.

πŸŽ€ FUNCTION PARAMETERS πŸŽ€

  • instance_id β€” the keyboard instance ID. that's the lil number/tag thingy that tells you which keyboard we're talking about. every keyboard's got one, iykyk.

πŸ¦‹ RETURN VALUE πŸ¦‹

  • you get the name of the selected keyboard πŸŽ‰
  • or NULL on failure 😭 β€” and if that happens, bestie, go call SDL_GetError() for more info, she'll tell you what went wrong fr fr.

🧚 THREAD SAFETY 🧚

🚨 main thread ONLY. this function should only be called on the main thread. do not be passing this off to some random background thread, i am begging you πŸ™ˆ

⭐ AVAILABILITY ⭐

this function is available since SDL 3.2.0. so if you're on something older... no she's not there yet, sorry babe πŸ’€


🌈 SEE ALSO 🌈

  • SDL_GetKeyboards(3) β€” the whole squad of keyboards, if you want the full roster πŸ’–

k that's the whole page, you're literally a keyboard-name-knower now, periodt πŸ‘‘

this was brought to you by the Simple Directmedia Layer girlies, SDL 3.4.18 edition πŸ’œ

πŸ“¦ where this page comes from