---
name: "SDL_JoystickGetButton"
section: "3"
platform: "linux"
package: "libsdl1.2-dev"
version: "1.2.15+dfsg2-8"
release: "Debian 12 (Bookworm)"
platforms: ["linux"]
url: "https://new.carta.tech/SDL_JoystickGetButton"
---

# SDL\_JoystickGetButton(3)

Get the current state of a given button on a given joystick

## NAME

SDL\_JoystickGetButton - Get the current state of a given button on a given joystick

## SYNOPSIS

**#include "SDL.h"**

**Uint8 SDL\_JoystickGetButton**(**SDL\_Joystick \*joystick, int button**);

## DESCRIPTION

SDL\_JoystickGetButton returns the current state of the given **button** on the given **joystick**.

## RETURN VALUE

**1** if the button is pressed. Otherwise, **0**.

## SEE ALSO

**SDL\_JoystickNumButtons**
