1 /***********************************************************
2 * Artsoft Retro-Game Library *
3 *----------------------------------------------------------*
4 * (c) 1995-2006 Artsoft Entertainment *
6 * Detmolder Strasse 189 *
9 * e-mail: info@artsoft.org *
10 *----------------------------------------------------------*
12 ***********************************************************/
19 #define JOYSTICK_NOT_AVAILABLE 0
20 #define JOYSTICK_AVAILABLE (1 << 0)
21 #define JOYSTICK_ACTIVE (1 << 1)
22 #define JOYSTICK_ACTIVATED (JOYSTICK_AVAILABLE | JOYSTICK_ACTIVE)
24 #if defined(PLATFORM_FREEBSD)
25 #define DEV_JOYSTICK_0 "/dev/joy0"
26 #define DEV_JOYSTICK_1 "/dev/joy1"
27 #define DEV_JOYSTICK_2 "/dev/joy2"
28 #define DEV_JOYSTICK_3 "/dev/joy3"
30 #define DEV_JOYSTICK_0 "/dev/js0"
31 #define DEV_JOYSTICK_1 "/dev/js1"
32 #define DEV_JOYSTICK_2 "/dev/js2"
33 #define DEV_JOYSTICK_3 "/dev/js3"
36 /* get these values from the program 'js' from the joystick package, */
37 /* set JOYSTICK_PERCENT to a threshold appropriate for your joystick */
39 #if defined(TARGET_SDL)
40 #define JOYSTICK_XLEFT -32767
41 #define JOYSTICK_XMIDDLE 0
42 #define JOYSTICK_XRIGHT 32767
43 #define JOYSTICK_YUPPER -32767
44 #define JOYSTICK_YMIDDLE 0
45 #define JOYSTICK_YLOWER 32767
47 #define JOYSTICK_XLEFT 1
48 #define JOYSTICK_XMIDDLE 128
49 #define JOYSTICK_XRIGHT 255
50 #define JOYSTICK_YUPPER 1
51 #define JOYSTICK_YMIDDLE 128
52 #define JOYSTICK_YLOWER 255
55 #define JOYSTICK_PERCENT 25
57 #define JOY_NO_ACTION 0
58 #define JOY_LEFT MV_LEFT
59 #define JOY_RIGHT MV_RIGHT
61 #define JOY_DOWN MV_DOWN
62 #define JOY_BUTTON_1 KEY_BUTTON_1
63 #define JOY_BUTTON_2 KEY_BUTTON_2
64 #define JOY_BUTTON_SNAP KEY_BUTTON_SNAP
65 #define JOY_BUTTON_DROP KEY_BUTTON_DROP
66 #define JOY_MOTION KEY_MOTION
67 #define JOY_BUTTON KEY_BUTTON
68 #define JOY_ACTION KEY_ACTION
70 #define JOY_BUTTON_NOT_PRESSED 0
71 #define JOY_BUTTON_PRESSED 1
72 #define JOY_BUTTON_NEW_PRESSED 2
73 #define JOY_BUTTON_NEW_RELEASED 3
75 #if defined(PLATFORM_UNIX)
76 void UnixInitJoysticks(void);
77 boolean UnixReadJoystick(int, int *, int *, boolean *, boolean *);
80 char *getJoyNameFromJoySymbol(int);
81 int getJoySymbolFromJoyName(char *);
82 int getJoystickNrFromDeviceName(char *);
83 char *getDeviceNameFromJoystickNr(int);
85 void CheckJoystickData(void);
87 int JoystickButton(int);
88 int AnyJoystick(void);
89 int AnyJoystickButton(void);
91 void DeactivateJoystick();
92 void ActivateJoystick();
94 #endif /* JOYSTICK_H */