X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Flibgame%2Fjoystick.h;h=d778c88c178cc9abaaa22fbc307e4481735184e0;hb=a7c06161253796a30a0237a7f5a044f459c8cf35;hp=b1fca495273fe601e76ed63becc45959c53ea780;hpb=41e8d55b767c898f20c29a1b0b8d2ef8840be2f5;p=rocksndiamonds.git diff --git a/src/libgame/joystick.h b/src/libgame/joystick.h index b1fca495..d778c88c 100644 --- a/src/libgame/joystick.h +++ b/src/libgame/joystick.h @@ -1,7 +1,7 @@ /*********************************************************** * Artsoft Retro-Game Library * *----------------------------------------------------------* -* (c) 1995-2002 Artsoft Entertainment * +* (c) 1995-2006 Artsoft Entertainment * * Holger Schemel * * Detmolder Strasse 189 * * 33604 Bielefeld * @@ -16,11 +16,9 @@ #include "system.h" -/* values for the joystick */ #define JOYSTICK_NOT_AVAILABLE 0 #define JOYSTICK_AVAILABLE (1 << 0) #define JOYSTICK_ACTIVE (1 << 1) - #define JOYSTICK_ACTIVATED (JOYSTICK_AVAILABLE | JOYSTICK_ACTIVE) #if defined(PLATFORM_FREEBSD) @@ -38,7 +36,7 @@ /* get these values from the program 'js' from the joystick package, */ /* set JOYSTICK_PERCENT to a threshold appropriate for your joystick */ -#ifdef TARGET_SDL +#if defined(TARGET_SDL) #define JOYSTICK_XLEFT -32767 #define JOYSTICK_XMIDDLE 0 #define JOYSTICK_XRIGHT 32767 @@ -46,57 +44,51 @@ #define JOYSTICK_YMIDDLE 0 #define JOYSTICK_YLOWER 32767 #else -#define JOYSTICK_XLEFT 30 -#define JOYSTICK_XMIDDLE 530 -#define JOYSTICK_XRIGHT 1250 -#define JOYSTICK_YUPPER 40 -#define JOYSTICK_YMIDDLE 680 -#define JOYSTICK_YLOWER 1440 +#define JOYSTICK_XLEFT 1 +#define JOYSTICK_XMIDDLE 128 +#define JOYSTICK_XRIGHT 255 +#define JOYSTICK_YUPPER 1 +#define JOYSTICK_YMIDDLE 128 +#define JOYSTICK_YLOWER 255 #endif #define JOYSTICK_PERCENT 25 +#define JOY_NO_ACTION 0 #define JOY_LEFT MV_LEFT #define JOY_RIGHT MV_RIGHT #define JOY_UP MV_UP #define JOY_DOWN MV_DOWN -#define JOY_BUTTON_1 (1 << 4) -#define JOY_BUTTON_2 (1 << 5) -#define JOY_BUTTON (JOY_BUTTON_1 | JOY_BUTTON_2) +#define JOY_BUTTON_1 KEY_BUTTON_1 +#define JOY_BUTTON_2 KEY_BUTTON_2 +#define JOY_BUTTON_SNAP KEY_BUTTON_SNAP +#define JOY_BUTTON_DROP KEY_BUTTON_DROP +#define JOY_MOTION KEY_MOTION +#define JOY_BUTTON KEY_BUTTON +#define JOY_ACTION KEY_ACTION #define JOY_BUTTON_NOT_PRESSED 0 #define JOY_BUTTON_PRESSED 1 #define JOY_BUTTON_NEW_PRESSED 2 #define JOY_BUTTON_NEW_RELEASED 3 -#ifdef NO_JOYSTICK -#define JOYSTICK_STATUS JOYSTICK_NOT_AVAILABLE -#else -#define JOYSTICK_STATUS JOYSTICK_AVAILABLE +#if defined(PLATFORM_UNIX) +void UnixInitJoysticks(void); +boolean UnixReadJoystick(int, int *, int *, boolean *, boolean *); #endif - char *getJoyNameFromJoySymbol(int); int getJoySymbolFromJoyName(char *); int getJoystickNrFromDeviceName(char *); char *getDeviceNameFromJoystickNr(int); -#if defined(TARGET_SDL) -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 Joystick(int); int JoystickButton(int); int AnyJoystick(void); int AnyJoystickButton(void); -void DeactivateJoystickForCalibration(); -void ActivateJoystickIfAvailable(); +void DeactivateJoystick(); +void ActivateJoystick(); #endif /* JOYSTICK_H */