/* Get the current state of an axis control on a joystick  */
Sint16 SDL_JoystickGetAxis(SDL_Joystick *joystick, int axis)
/* Get the current state of an axis control on a joystick  */
Sint16 SDL_JoystickGetAxis(SDL_Joystick *joystick, int axis)
{
    Sint16 state;
    if (!SDL_PrivateJoystickValid(joystick)) {
        return 0;
    }
    if (axis < joystick->naxes) {
        state = joystick->axes[axis].value;
    } else {
        SDL_SetError("Joystick only has %d axes", joystick->naxes);
        state = 0;
    }
    return state;
}