SDL_GetGamepadTypeFromString(3)

πŸ’– SDL_GetGamepadTypeFromString(3) πŸ’–

okay bestie, welcome to the SDL3 FUNCTIONS section of the manual, we're literally about to make a string into a gamepad type and it's giving ✨magic✨


🌸 NAME 🌸

SDL_GetGamepadTypeFromString β€” Convert a string into SDL_GamepadType enum. πŸŽ€


✨ SYNOPSIS ✨

#include <SDL3/SDL_gamepad.h>

SDL_GamepadType SDL_GetGamepadTypeFromString(const char *str);

πŸ¦‹ DESCRIPTION πŸ¦‹

so here's the tea, bestie πŸ“ β€” this function is called internally to translate SDL_Gamepad mapping strings for the underlying joystick device into the consistent SDL_Gamepad mapping. it's the lil translator goblin working behind the scenes so you don't have to πŸ’…

and like, you do not normally need to call this function unless you are parsing SDL_Gamepad mappings in your own code. that's it, that's the whole vibe. if you're not out here hand-parsing mappings, this one is not your main character moment, no cap. 🧚


πŸ‘‘ FUNCTION PARAMETERS πŸ‘‘

  • str β€” string representing a SDL_GamepadType type. just a lil string, that's all she is πŸ’–

πŸ”₯ RETURN VALUE πŸ”₯

Returns the SDL_GamepadType enum corresponding to the input string, or SDL_GAMEPAD_TYPE_UNKNOWN if no match was found. 😭

so if your string doesn't match anything, you don't get an error, you get SDL_GAMEPAD_TYPE_UNKNOWN. check for that, bestie, fr fr.

πŸ’œ THREAD SAFETY πŸ’œ

It is safe to call this function from any thread. 🌈

go off, thread queen. no locks, no worries, no drama. ✨

⭐ AVAILABILITY ⭐

This function is available since SDL 3.2.0. 🫢


πŸŽ€ SEE ALSO πŸŽ€


Simple Directmedia Layer wrote this one down for y'all, and this page is living in SDL 3.4.18, filed under SDL_GetGamepadTypeFromString(3). mwah, take care of her πŸ’‹πŸ¦‹βœ¨

πŸ“¦ where this page comes from