2 * $Logfile: /Freespace2/code/Io/Joy.h $
7 * Include file for joystick stuff
10 * Revision 1.1 2002/05/03 03:28:12 root
14 * 2 10/07/98 10:53a Dave
17 * 1 10/07/98 10:49a Dave
19 * 20 5/13/98 1:17a Hoffoss
20 * Added joystick axes configurability.
22 * 19 5/05/98 8:38p Hoffoss
23 * Added sensitivity adjustment to options menu and made it save to pilot
26 * 18 5/04/98 11:08p Hoffoss
27 * Expanded on Force Feedback code, and moved it all into Joy_ff.cpp.
28 * Updated references everywhere to it.
30 * 17 4/29/98 12:13a Lawrance
31 * Add function for reading down count without resetting internal count.
32 * Add hook to reset demo trailer timer.
34 * 16 3/21/98 11:29a John
35 * Made joy_flush work when a button is held down
37 * 15 3/06/98 10:02a Hoffoss
38 * Made dead zone adjustable, and defaulted it to 10% instead of 5%.
40 * 14 1/29/98 11:04a Sandeep
42 * 13 1/27/98 8:40p Sandeep
44 * 12 1/08/98 6:35p Hoffoss
45 * Fixed joystick undefined detection.
47 * 11 9/15/97 11:42p Lawrance
48 * change button_info to joy_button_info to avoid name conflict
50 * 10 8/07/97 11:26p Lawrance
51 * add support for 4th axis (rudder)
53 * 9 7/29/97 5:30p Lawrance
54 * move gettime() from keyboard module to timer module
56 * 8 7/10/97 12:29a Lawrance
57 * fix problem with NT not recognizing an axis that was set under 95
59 * 7 7/09/97 11:41p Lawrance
60 * added throttle and hat support
62 * 6 2/17/97 5:18p John
63 * Added a bunch of RCS headers to a bunch of old files that don't have
72 #define JOY_NUM_BUTTONS 32
73 #define JOY_NUM_HAT_POS 4
74 #define JOY_TOTAL_BUTTONS (JOY_NUM_BUTTONS + JOY_NUM_HAT_POS)
75 #define JOY_NUM_AXES 6
77 #define JOY_HATBACK (JOY_NUM_BUTTONS)
78 #define JOY_HATFORWARD (JOY_NUM_BUTTONS+1)
79 #define JOY_HATLEFT (JOY_NUM_BUTTONS+2)
80 #define JOY_HATRIGHT (JOY_NUM_BUTTONS+3)
82 #define JOY_AXIS_UNDEFINED -10000
84 typedef struct Joy_info {
85 int axis_valid[JOY_NUM_AXES];
86 int axis_min[JOY_NUM_AXES];
87 int axis_center[JOY_NUM_AXES];
88 int axis_max[JOY_NUM_AXES];
91 extern int Joy_sensitivity;
92 extern int Dead_zone_size; // percentage of range that is dead zone
96 int joy_get_pos(int * x, int * y, int *z, int *r);
97 int joy_down_count(int btn, int reset_count = 1);
98 int joy_down(int btn);
99 int joy_up_count(int btn);
100 float joy_down_time(int btn);
101 void joy_get_cal_vals(int *axis_min, int *axis_center, int *axis_max);
102 void joy_set_cal_vals(int *axis_min, int *axis_center, int *axis_max);
106 void joy_cheap_cal();
107 int joystick_read_raw_axis( int num_axes, int * axis );
108 void joy_get_delta(int *dx, int *dy);
109 int joy_get_scaled_reading(int raw, int axn);
110 int joy_get_unscaled_reading(int raw, int axn);
112 #endif /* __JOY_H__ */