---
name: "SDL_GetGamepadAxisFromString"
section: "3"
platform: "linux"
package: "libsdl3-doc"
version: "3.2.10+ds-1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/SDL_GetGamepadAxisFromString"
---

# SDL\_GetGamepadAxisFromString(3)

Convert a string into SDL\_GamepadAxis enum.

## NAME

SDL\_GetGamepadAxisFromString - Convert a string into  **SDL\_GamepadAxis**\
  enum.

## HEADER FILE

Defined in SDL3/SDL\_gamepad.h

## SYNOPSIS

```
#include "SDL3/SDL.h"
```

**SDL\_GamepadAxis SDL\_GetGamepadAxisFromString(const char \*str);**

## DESCRIPTION

This function is called internally to translate  **SDL\_Gamepad**

mapping strings for the underlying joystick device into the consistent

**SDL\_Gamepad**\
  mapping. You do not normally need to call this function unless you are parsing  **SDL\_Gamepad**\
  mappings in your own code.

Note specially that "righttrigger" and "lefttrigger" map to

**SDL\_GAMEPAD\_AXIS\_RIGHT\_TRIGGER** and

**SDL\_GAMEPAD\_AXIS\_LEFT\_TRIGGER** , respectively.

## FUNCTION PARAMETERS

- *str*

  string representing a  **SDL\_Gamepad**\
    axis.

## RETURN VALUE

( **SDL\_GamepadAxis** ) Returns the

**SDL\_GamepadAxis**\
  enum corresponding to the input string, or  **SDL\_GAMEPAD\_AXIS\_INVALID** if no match was found.

## AVAILABILITY

This function is available since SDL 3.2.0.

## SEE ALSO

**•**(3), [**SDL\_GetGamepadStringForAxis**(3)](/SDL_GetGamepadStringForAxis/3.md)
