/*
*     ___                       ____               __
*    / _ \___ _    _____ ____  /  _/__  ___  __ __/ /_
*   / ___/ _ \ |/|/ / -_) __/ _/ // _ \/ _ \/ // / __/
*  /_/   \___/__,__/\__/_/   /___/_//_/ .__/\_,_/\__/
*                                    /_/
*
*   Original Code by John Garrison
*   Written August 27, 1999
*   To be released under the LGPL
*
*   Joystick interface routines
*
*   See LICENSE.TXT for more LGPL info
*/
#ifndef _PI_joystick_H
#define _PI_joystick_H

#ifdef __cplusplus
extern "C" {
#endif

#include "powerinput.h"

typedef struct _JoyData{
   int axis[6];
   int button[8];
}PI_JoyData;

SDL_Joystick *PIJoysticks[4];

extern int *axis, num_of_axis, num_of_buttons;
extern int PIJoyHighValue;
extern char name_of_joystick[80];
extern int joy_fd1, joy_fd2;

int PI_OpenJoystick(int Joy);
int PI_CloseJoystick(int Joy);
PI_JoyData PI_ReadJoystick(int Joy);

int PI_IsJoyButtonDown(int Joy, int Button);
int PI_WasJoyButtonPressed(PI_JoyData JoyData, int Button);

int PI_JoyAxisDirection(int Joy, int Axis);
int PI_JoyX(int Joy);
int PI_JoyY(int Joy);
void PI_SetJoystickHighValue(int Value);
int PI_AreAnyJoyButtonsDown(int Joy);

#ifdef __cplusplus
};
#endif

#endif
