SDL_GetKeyFromName(3)

πŸ’– SDL_GetKeyFromName(3) πŸ’–

okay bestie, welcome to the SDL3 FUNCTIONS corner of the man pages, where we take a cute lil human-readable name and turn it into an actual key code. yes, that's the whole gig. it's giving translator energy. 🌈


✨ NAME ✨

SDL_GetKeyFromName β€” get a key code from a human-readable name. that's it, that's the function, she's simple but she works. πŸ’…


πŸ¦‹ SYNOPSIS πŸ¦‹

#include <SDL3/SDL_keyboard.h>

SDL_Keycode SDL_GetKeyFromName(const char *name);

look at her. one parameter. one return. no drama. main character energy fr fr. πŸ‘‘


πŸŽ€ FUNCTION PARAMETERS πŸŽ€

  • name β€” the human-readable key name. like, the actual words a human would say out loud. bestie, she speaks people. πŸ—£οΈ

🌸 RETURN VALUE 🌸

She hands you back a key code β€” yay! πŸŽ‰ But if the name was giving absolutely nothing recognizable, you get SDLK_UNKNOWN instead. 😭 and if you're sitting there like "okay but why tho", call SDL_GetError() for more information. she'll tell you. 🫢


πŸ’€ THREAD SAFETY πŸ’€

This function is not thread safe. do not try to run her from multiple threads at once, bestie, she will not survive that. no cap. 🚫🧡

⭐ AVAILABILITY ⭐

This function is available since SDL 3.2.0. so if you're on something older, she simply does not exist yet. sorry babe. πŸ™ˆ


πŸ‘‘ SEE ALSO πŸ‘‘

iykyk β€” the whole keyboard-name squad, all linked up. go read them too, they're iconic. πŸ’œ


and that's a wrap! this page came to you courtesy of Simple Directmedia Layer, running SDL 3.4.18, and yes she's still out here in SDL_GetKeyFromName(3) form. mwah. take care of her. πŸ’–βœ¨πŸŽ€

πŸ“¦ where this page comes from