1 // ============================================================================
2 // Artsoft Retro-Game Library
3 // ----------------------------------------------------------------------------
4 // (c) 1995-2014 by Artsoft Entertainment
7 // http://www.artsoft.org/
8 // ----------------------------------------------------------------------------
10 // ============================================================================
17 #define JOYSTICK_NOT_AVAILABLE 0
18 #define JOYSTICK_AVAILABLE (1 << 0)
19 #define JOYSTICK_ACTIVE (1 << 1)
20 #define JOYSTICK_CONFIGURED (1 << 2)
21 #define JOYSTICK_NOT_CONFIGURED (1 << 3)
22 #define JOYSTICK_ACTIVATED (JOYSTICK_AVAILABLE | JOYSTICK_ACTIVE)
24 #define MAX_JOYSTICK_NAME_LEN 40
26 #if defined(PLATFORM_FREEBSD)
27 #define DEV_JOYSTICK_0 "/dev/joy0"
28 #define DEV_JOYSTICK_1 "/dev/joy1"
29 #define DEV_JOYSTICK_2 "/dev/joy2"
30 #define DEV_JOYSTICK_3 "/dev/joy3"
32 #define DEV_JOYSTICK_0 "/dev/js0"
33 #define DEV_JOYSTICK_1 "/dev/js1"
34 #define DEV_JOYSTICK_2 "/dev/js2"
35 #define DEV_JOYSTICK_3 "/dev/js3"
38 /* get these values from the program 'js' from the joystick package, */
39 /* set JOYSTICK_PERCENT to a threshold appropriate for your joystick */
41 #define JOYSTICK_MAX_AXIS_POS 32767
43 #define JOYSTICK_XLEFT -JOYSTICK_MAX_AXIS_POS
44 #define JOYSTICK_XMIDDLE 0
45 #define JOYSTICK_XRIGHT +JOYSTICK_MAX_AXIS_POS
46 #define JOYSTICK_YUPPER -JOYSTICK_MAX_AXIS_POS
47 #define JOYSTICK_YMIDDLE 0
48 #define JOYSTICK_YLOWER +JOYSTICK_MAX_AXIS_POS
50 #define JOYSTICK_PERCENT 25
52 #define JOY_NO_ACTION 0
53 #define JOY_LEFT MV_LEFT
54 #define JOY_RIGHT MV_RIGHT
56 #define JOY_DOWN MV_DOWN
57 #define JOY_BUTTON_1 KEY_BUTTON_1
58 #define JOY_BUTTON_2 KEY_BUTTON_2
59 #define JOY_BUTTON_SNAP KEY_BUTTON_SNAP
60 #define JOY_BUTTON_DROP KEY_BUTTON_DROP
61 #define JOY_MOTION KEY_MOTION
62 #define JOY_BUTTON KEY_BUTTON
63 #define JOY_ACTION KEY_ACTION
65 #define JOY_BUTTON_NOT_PRESSED 0
66 #define JOY_BUTTON_PRESSED 1
67 #define JOY_BUTTON_NEW_PRESSED 2
68 #define JOY_BUTTON_NEW_RELEASED 3
70 char *getJoyNameFromJoySymbol(int);
71 int getJoySymbolFromJoyName(char *);
72 int getJoystickNrFromDeviceName(char *);
73 char *getDeviceNameFromJoystickNr(int);
74 char *getFormattedJoystickName(const char *);
76 void CheckJoystickData(void);
78 int JoystickExt(int, boolean);
79 int JoystickButton(int);
80 int AnyJoystick(void);
81 int AnyJoystickButton(void);
83 void DeactivateJoystick();
84 void ActivateJoystick();
86 #endif /* JOYSTICK_H */