rnd-20001201-1-src
[rocksndiamonds.git] / src / libgame / joystick_TMP.h
1 /***********************************************************
2 *  Rocks'n'Diamonds -- McDuffin Strikes Back!              *
3 *----------------------------------------------------------*
4 *  (c) 1995-98 Artsoft Entertainment                       *
5 *              Holger Schemel                              *
6 *              Oststrasse 11a                              *
7 *              33604 Bielefeld                             *
8 *              phone: ++49 +521 290471                     *
9 *              email: aeglos@valinor.owl.de                *
10 *----------------------------------------------------------*
11 *  joystick.h                                              *
12 ***********************************************************/
13
14 #ifndef JOYSTICK_H
15 #define JOYSTICK_H
16
17 /* values for the joystick */
18 #define JOYSTICK_OFF            0
19 #define JOYSTICK_AVAILABLE      1
20
21 #ifdef __FreeBSD__
22 #include <machine/joystick.h>
23 #define DEV_JOYSTICK_0          "/dev/joy0"
24 #define DEV_JOYSTICK_1          "/dev/joy1"
25 #define DEV_JOYSTICK_2          "/dev/joy2"
26 #define DEV_JOYSTICK_3          "/dev/joy3"
27 #else
28 #define DEV_JOYSTICK_0          "/dev/js0"
29 #define DEV_JOYSTICK_1          "/dev/js1"
30 #define DEV_JOYSTICK_2          "/dev/js2"
31 #define DEV_JOYSTICK_3          "/dev/js3"
32 #endif
33
34 /* get these values from the program 'js' from the joystick package, */
35 /* set JOYSTICK_PERCENT to a threshold appropriate for your joystick */
36
37 #ifdef TARGET_SDL
38 #define JOYSTICK_XLEFT          -32767
39 #define JOYSTICK_XMIDDLE        0
40 #define JOYSTICK_XRIGHT         32767
41 #define JOYSTICK_YUPPER         -32767
42 #define JOYSTICK_YMIDDLE        0
43 #define JOYSTICK_YLOWER         32767
44 #else
45 #define JOYSTICK_XLEFT          30
46 #define JOYSTICK_XMIDDLE        530
47 #define JOYSTICK_XRIGHT         1250
48 #define JOYSTICK_YUPPER         40
49 #define JOYSTICK_YMIDDLE        680
50 #define JOYSTICK_YLOWER         1440
51 #endif
52
53 #define JOYSTICK_PERCENT        25
54
55 #define JOY_LEFT                MV_LEFT
56 #define JOY_RIGHT               MV_RIGHT
57 #define JOY_UP                  MV_UP
58 #define JOY_DOWN                MV_DOWN
59 #define JOY_BUTTON_1            (1<<4)
60 #define JOY_BUTTON_2            (1<<5)
61 #define JOY_BUTTON              (JOY_BUTTON_1 | JOY_BUTTON_2)
62
63 #define JOY_BUTTON_NOT_PRESSED  0
64 #define JOY_BUTTON_PRESSED      1
65 #define JOY_BUTTON_NEW_PRESSED  2
66 #define JOY_BUTTON_NEW_RELEASED 3
67
68 #ifdef NO_JOYSTICK
69 #define JOYSTICK_STATUS         JOYSTICK_OFF
70 #else
71 #define JOYSTICK_STATUS         JOYSTICK_AVAILABLE
72 #endif
73
74
75 #if defined(TARGET_SDL)
76 SDL_Joystick *Get_SDL_Joystick(int);
77 boolean Open_SDL_Joystick(int);
78 void Close_SDL_Joystick(int);
79 boolean Check_SDL_JoystickOpened(int);
80 void HandleJoystickEvent(Event *);
81 int Get_SDL_Joystick_Axis(int, int);
82 #endif
83
84 void CheckJoystickData(void);
85 int Joystick(int);
86 int JoystickButton(int);
87 int AnyJoystick(void);
88 int AnyJoystickButton(void);
89
90 #endif  /* JOYSTICK_H */