---
name: "SDL_GetGamepadButton"
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_GetGamepadButton"
---

# SDL\_GetGamepadButton(3)

Get the current state of a button on a gamepad.

## NAME

SDL\_GetGamepadButton - Get the current state of a button on a gamepad.

## HEADER FILE

Defined in SDL3/SDL\_gamepad.h

## SYNOPSIS

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

**bool SDL\_GetGamepadButton(SDL\_Gamepad \*gamepad, SDL\_GamepadButton button);**

## FUNCTION PARAMETERS

- *gamepad*

  a gamepad.

- *button*

  a button index (one of the  **SDL\_GamepadButton**\
    values).

## RETURN VALUE

Returns true if the button is pressed, false otherwise.

## AVAILABILITY

This function is available since SDL 3.2.0.

## SEE ALSO

**•**(3), [**SDL\_GamepadHasButton**(3)](/SDL_GamepadHasButton/3.md), **•**(3), [**SDL\_GetGamepadAxis**(3)](/SDL_GetGamepadAxis/3.md)
