SDL_GetGamepadAxisFromString(3)

πŸ’– SDL_GetGamepadAxisFromString(3) πŸ’–

okay bestie, welcome to the SDL3 FUNCTIONS corner of the manual, where we turn silly little strings into big important enums πŸŽ€


✨ NAME ✨

SDL_GetGamepadAxisFromString β€” the glow-up machine that converts a string into an SDL_GamepadAxis enum πŸ’…


🌸 SYNOPSIS 🌸

#include <SDL3/SDL_gamepad.h>

SDL_GamepadAxis SDL_GetGamepadAxisFromString(const char *str);

πŸ¦‹ DESCRIPTION πŸ¦‹

so like, this function is the internal translator 🧚 β€” SDL calls it itself to take SDL_Gamepad mapping strings for the underlying joystick device and turn them into the consistent SDL_Gamepad mapping. it's giving backstage crew, doing the work so you don't have to ✨

ngl, you do not normally need to call this yourself. the only time it's your moment is if you're parsing SDL_Gamepad mappings in your own code πŸ‘‘ iykyk.

and a lil heads-up that the original is very specific about, so I'm being very specific too: note specially that "righttrigger" and "lefttrigger" map to SDL_GAMEPAD_AXIS_RIGHT_TRIGGER and SDL_GAMEPAD_AXIS_LEFT_TRIGGER, respectively. like, respectively respectively, in that exact order, don't get it twisted πŸ™ˆ


🫢 FUNCTION PARAMETERS 🫢

  • str β€” a string representing a SDL_Gamepad axis. that's the whole vibe, that's the whole job πŸ’œ

⭐ RETURN VALUE ⭐

it hands you back the SDL_GamepadAxis enum that corresponds to the input string 🌈

and if nothing matched? you get SDL_GAMEPAD_AXIS_INVALID πŸ’€ no match, no axis, no drama, it's fine, we move on.


🧡 THREAD SAFETY 🧡

fr fr safe to call this function from any thread. every thread can have its turn, no fighting, no cap 🫢


πŸŽ€ AVAILABILITY πŸŽ€

this function has been available since SDL 3.2.0 ✨ iconic behavior, honestly.


πŸ‘€ SEE ALSO πŸ‘€


Simple Directmedia Layer Β· SDL 3.4.18 β€” mwah, that's the whole page bestie, go forth and parse your mappings, you ate πŸ’…βœ¨πŸ¦‹

πŸ“¦ where this page comes from