X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Flibgame%2Fjoystick.h;h=48202d2efdea8a33bd5ec95e43d717451f888fa8;hb=310781167f731177d6d46b15093dc32606eeac4e;hp=c7f65febe498c88f1c052b11abb82c5861a195f7;hpb=abe44529b439ad39b4d8dbf19cbd67c9b9844279;p=rocksndiamonds.git diff --git a/src/libgame/joystick.h b/src/libgame/joystick.h index c7f65feb..48202d2e 100644 --- a/src/libgame/joystick.h +++ b/src/libgame/joystick.h @@ -17,8 +17,12 @@ #define JOYSTICK_NOT_AVAILABLE 0 #define JOYSTICK_AVAILABLE (1 << 0) #define JOYSTICK_ACTIVE (1 << 1) +#define JOYSTICK_CONFIGURED (1 << 2) +#define JOYSTICK_NOT_CONFIGURED (1 << 3) #define JOYSTICK_ACTIVATED (JOYSTICK_AVAILABLE | JOYSTICK_ACTIVE) +#define MAX_JOYSTICK_NAME_LEN 40 + #if defined(PLATFORM_FREEBSD) #define DEV_JOYSTICK_0 "/dev/joy0" #define DEV_JOYSTICK_1 "/dev/joy1" @@ -34,21 +38,14 @@ /* get these values from the program 'js' from the joystick package, */ /* set JOYSTICK_PERCENT to a threshold appropriate for your joystick */ -#if defined(TARGET_SDL) -#define JOYSTICK_XLEFT -32767 +#define JOYSTICK_MAX_AXIS_POS 32767 + +#define JOYSTICK_XLEFT -JOYSTICK_MAX_AXIS_POS #define JOYSTICK_XMIDDLE 0 -#define JOYSTICK_XRIGHT 32767 -#define JOYSTICK_YUPPER -32767 +#define JOYSTICK_XRIGHT +JOYSTICK_MAX_AXIS_POS +#define JOYSTICK_YUPPER -JOYSTICK_MAX_AXIS_POS #define JOYSTICK_YMIDDLE 0 -#define JOYSTICK_YLOWER 32767 -#else -#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_YLOWER +JOYSTICK_MAX_AXIS_POS #define JOYSTICK_PERCENT 25 @@ -74,9 +71,11 @@ char *getJoyNameFromJoySymbol(int); int getJoySymbolFromJoyName(char *); int getJoystickNrFromDeviceName(char *); char *getDeviceNameFromJoystickNr(int); +char *getFormattedJoystickName(const char *); void CheckJoystickData(void); int Joystick(int); +int JoystickExt(int, boolean); int JoystickButton(int); int AnyJoystick(void); int AnyJoystickButton(void);