sdlGetJoystickBall function joystick
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.
\threadsafety It is safe to call this function from any thread.
\since This function is available since SDL 3.2.0.
\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 = _libSdl
.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;
}