SDL_JoystickGetBall(3)

SDL_JoystickGetBall3

Get relative trackball motion

Usage

#include "SDL.h"

int SDL_JoystickGetBall(SDL_Joystick *joystick, int ball, int *dx, int *dy);

Overview

Get the ball axis change.

Trackballs can only return relative motion since the last call to SDL_JoystickGetBall, these motion deltas a placed into dx and dy.

Return value

Returns 0 on success or -1 on failure

Examples

int delta_x, delta_y;
SDL_Joystick *joy;
.
.
.
SDL_JoystickUpdate();
if(SDL_JoystickGetBall(joy, 0, &delta_x, &delta_y)==-1)
  printf("TrackBall Read Error!
");
printf("Trackball Delta- X:%d, Y:%d
", delta_x, delta_y);

Releases

11 releases since Debian 3.0 (Woody); the text changed 1 time.

  1. 3.0–5.0
  2. 6.0–12

From libsdl1.2-dev 1.2.15+dfsg2-8 in Debian 12 (Bookworm). Parsed by carta from the page's man source.