---
name: "SDL_JoyButtonEvent"
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_JoyButtonEvent"
---

# SDL\_JoyButtonEvent(3)

Joystick button event structure

## NAME

SDL\_JoyButtonEvent - Joystick button event structure

## STRUCTURE DEFINITION

```
typedef struct{
  Uint8 type;
  Uint8 which;
  Uint8 button;
  Uint8 state;
} SDL_JoyButtonEvent;
```

## STRUCTURE DATA

- **type**

  **SDL\_JOYBUTTONDOWN** or **SDL\_JOYBUTTONUP**

- **which**

  Joystick device index

- **button**

  Joystick button index

- **state**

  **SDL\_PRESSED** or **SDL\_RELEASED**

## DESCRIPTION

**SDL\_JoyButtonEvent** is a member of the **SDL\_Event** union and is used when an event of type **SDL\_JOYBUTTONDOWN** or **SDL\_JOYBUTTONUP** is reported.

A **SDL\_JOYBUTTONDOWN** or **SDL\_JOYBUTTONUP** event occurs when ever a user presses or releases a button on a joystick. The field **which** is the index of the joystick that reported the event and **button** is the index of the button (for a more detailed explaination see the *Joystick section*). **state** is the current state or the button which is either **SDL\_PRESSED** or **SDL\_RELEASED**.

## SEE ALSO

**SDL\_Event**, *Joystick Functions*, **SDL\_JoystickEventState**, **SDL\_JoystickGetButton**
