sdlGetJoystickBall function

bool sdlGetJoystickBall(
  1. Pointer<SdlJoystick> joystick,
  2. int ball,
  3. Pointer<Int32> dx,
  4. Pointer<Int32> dy,
)

Get the ball axis change since the last poll.

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.

\param joystick the SDL_Joystick to query. \param ball the ball index to query; ball indices start at index 0. \param dx stores the difference in the x axis position since the last poll. \param dy stores the difference in the y axis position since the last poll. \returns true on success or false on failure; call SDL_GetError() for more information.

\since This function is available since SDL 3.1.3.

\sa SDL_GetNumJoystickBalls

extern SDL_DECLSPEC bool SDLCALL SDL_GetJoystickBall(SDL_Joystick *joystick, int ball, int *dx, int *dy)

Implementation

bool sdlGetJoystickBall(Pointer<SdlJoystick> joystick, int ball,
    Pointer<Int32> dx, Pointer<Int32> dy) {
  final sdlGetJoystickBallLookupFunction = libSdl3.lookupFunction<
      Uint8 Function(Pointer<SdlJoystick> joystick, Int32 ball,
          Pointer<Int32> dx, Pointer<Int32> dy),
      int Function(Pointer<SdlJoystick> joystick, int ball, Pointer<Int32> dx,
          Pointer<Int32> dy)>('SDL_GetJoystickBall');
  return sdlGetJoystickBallLookupFunction(joystick, ball, dx, dy) == 1;
}