---
name: "SDL_GetJoystickBall"
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_GetJoystickBall"
---

# SDL\_GetJoystickBall(3)

Get the ball axis change since the last poll.

## NAME

SDL\_GetJoystickBall - Get the ball axis change since the last poll.

## HEADER FILE

Defined in SDL3/SDL\_joystick.h

## SYNOPSIS

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

**bool SDL\_GetJoystickBall(SDL\_Joystick \*joystick, int ball, int \*dx, int \*dy);**

## DESCRIPTION

Trackballs can only return relative motion since the last call to

**SDL\_GetJoystickBall** (), these motion deltas are placed into **dx** and **dy** .

Most joysticks do not have trackballs.

## FUNCTION PARAMETERS

- *joystick*

  the  **SDL\_Joystick**\
    to query.

- *ball*

  the ball index to query; ball indices start at index 0.

- *dx*

  stores the difference in the x axis position since the last poll.

- *dy*

  stores the difference in the y axis position since the last poll.

## RETURN VALUE

Returns true on success or false on failure; call

**SDL\_GetError** () for more information.

## AVAILABILITY

This function is available since SDL 3.2.0.

## SEE ALSO

**•**(3), [**SDL\_GetNumJoystickBalls**(3)](/SDL_GetNumJoystickBalls/3.md)
