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 π
SDL_GetGamepadStringForAxis(3)β the reverse girlypop, the other half of the duo π
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
- fedora 43: SDL3-devel 3.4.18-1.fc43 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 43: SDL3-devel 3.4.18-1.fc43 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 44: SDL3-devel 3.4.18-1.fc44 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 44: SDL3-devel 3.4.18-1.fc44 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms