SDL_GETGAMEPADBUTTONFROMSTRING(3)

โœจ NAME โœจ

SDL_GetGamepadButtonFromString โ€” bestie, this one takes a string and turns it into an SDL_GamepadButton enum ๐Ÿ’–

(also hi, this page lives in the SDL3 FUNCTIONS manual, section 3, mwah)


๐ŸŽ€ SYNOPSIS ๐ŸŽ€

#include <SDL3/SDL_gamepad.h>

SDL_GamepadButton SDL_GetGamepadButtonFromString(const char *str);

๐Ÿฆ‹ DESCRIPTION ๐Ÿฆ‹

okay so picture this: SDL is out here translating SDL_Gamepad mapping strings for the underlying joystick device into the consistent SDL_Gamepad mapping, and this function is the lil internal glow-up artist doing that work. it's called internally, no cap.

so likeโ€ฆ you do not normally need to call this function. fr fr. the only time you'd even touch it is if you are out here parsing SDL_Gamepad mappings in your own code, in which case go off, main character ๐Ÿ’…


๐ŸŒธ FUNCTION PARAMETERS ๐ŸŒธ

  • str โ€” a string that's giving "SDL_Gamepad button" ๐ŸŽฎ (it's the string representing a SDL_Gamepad button, bestie)

โญ RETURN VALUE โญ

it hands you back the SDL_GamepadButton enum that corresponds to the input string ๐Ÿ’–

โ€ฆand if no match was found? it returns SDL_GAMEPAD_BUTTON_INVALID. not me getting ghosted by a string ๐Ÿ˜ญ


๐Ÿงš THREAD SAFETY ๐Ÿงš

it is safe to call this function from any thread. any. thread. periodt ๐Ÿ‘‘


๐ŸŒˆ AVAILABILITY ๐ŸŒˆ

this function has been available since SDL 3.2.0 โœจ (so if you're on something olderโ€ฆ yeah, no ๐Ÿซถ)


๐Ÿ’œ SEE ALSO ๐Ÿ’œ


and that's the whole page, bestie!! this lil icon was brought to you by Simple Directmedia Layer, sitting pretty at SDL 3.4.18 โ€” mwah, go slay some gamepad mappings ๐Ÿ’…๐ŸŽ€

๐Ÿ“ฆ where this page comes from