X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Fjoystick.h;h=3632b7a706f6a82a9b79897ddcb78fb0795045d6;hb=a8b2caa1d373c84c1b3fc2f615370c2a319051ca;hp=56c5b43d939379b456cae79449c59b01440fbebb;hpb=823bddb0d9cc63ddda17a2cd20266aa3b82bde38;p=rocksndiamonds.git diff --git a/src/joystick.h b/src/joystick.h index 56c5b43d..3632b7a7 100644 --- a/src/joystick.h +++ b/src/joystick.h @@ -19,24 +19,41 @@ /* values for the joystick */ #define JOYSTICK_OFF 0 #define JOYSTICK_AVAILABLE 1 + #ifdef __FreeBSD__ #include #define DEV_JOYSTICK_0 "/dev/joy0" #define DEV_JOYSTICK_1 "/dev/joy1" +#define DEV_JOYSTICK_2 "/dev/joy2" +#define DEV_JOYSTICK_3 "/dev/joy3" #else #define DEV_JOYSTICK_0 "/dev/js0" #define DEV_JOYSTICK_1 "/dev/js1" +#define DEV_JOYSTICK_2 "/dev/js2" +#define DEV_JOYSTICK_3 "/dev/js3" #endif /* get these values from the program 'js' from the joystick package, */ /* set JOYSTICK_PERCENT to a threshold appropriate for your joystick */ + +#ifdef TARGET_SDL +#define JOYSTICK_XLEFT -32767 +#define JOYSTICK_XMIDDLE 0 +#define JOYSTICK_XRIGHT 32767 +#define JOYSTICK_YUPPER -32767 +#define JOYSTICK_YMIDDLE 0 +#define JOYSTICK_YLOWER 32767 +#else #define JOYSTICK_XLEFT 30 -#define JOYSTICK_XRIGHT 1250 #define JOYSTICK_XMIDDLE 530 +#define JOYSTICK_XRIGHT 1250 #define JOYSTICK_YUPPER 40 -#define JOYSTICK_YLOWER 1440 #define JOYSTICK_YMIDDLE 680 +#define JOYSTICK_YLOWER 1440 +#endif + #define JOYSTICK_PERCENT 25 + #define JOY_LEFT MV_LEFT #define JOY_RIGHT MV_RIGHT #define JOY_UP MV_UP @@ -44,6 +61,7 @@ #define JOY_BUTTON_1 (1<<4) #define JOY_BUTTON_2 (1<<5) #define JOY_BUTTON (JOY_BUTTON_1 | JOY_BUTTON_2) + #define JOY_BUTTON_NOT_PRESSED 0 #define JOY_BUTTON_PRESSED 1 #define JOY_BUTTON_NEW_PRESSED 2 @@ -56,9 +74,19 @@ #endif +#ifdef USE_SDL_JOYSTICK +SDL_Joystick *Get_SDL_Joystick(int); +boolean Open_SDL_Joystick(int); +void Close_SDL_Joystick(int); +boolean Check_SDL_JoystickOpened(int); +void HandleJoystickEvent(Event *); +int Get_SDL_Joystick_Axis(int, int); +#endif + void CheckJoystickData(void); -int JoystickPosition(int, int, int); -int Joystick(void); -int JoystickButton(void); +int Joystick(int); +int JoystickButton(int); +int AnyJoystick(void); +int AnyJoystickButton(void); #endif