/* Get the ball axis change since the last poll  */
int SDL_JoystickGetBall(SDL_Joystick *joystick, int ball, int *dx, int *dy)
/* Get the ball axis change since the last poll  */
int SDL_JoystickGetBall(SDL_Joystick *joystick, int ball, int *dx, int *dy)
{
	int retval;
	if ( ! ValidJoystick(&joystick) ) {
		return(-1);
	}
	retval = 0;
	if ( ball < joystick->nballs ) {
		if ( dx ) {
			*dx = joystick->balls[ball].dx;
		}
		if ( dy ) {
			*dy = joystick->balls[ball].dy;
		}
		joystick->balls[ball].dx = 0;
		joystick->balls[ball].dy = 0;
	} else {
		SDL_SetError("Joystick only has %d balls", joystick->nballs);
		retval = -1;
	}
	return(retval);
}