2 * Copyright (C) Volition, Inc. 1999. All rights reserved.
4 * All source code herein is the property of Volition, Inc. You may not sell
5 * or otherwise commercially exploit the source or things you created based on
10 * $Logfile: /Freespace2/code/Io/Mouse.h $
15 * Include file for mouse reading routines
18 * Revision 1.2 2002/06/09 04:41:14 relnev
19 * added copyright header
21 * Revision 1.1.1.1 2002/05/03 03:28:12 root
25 * 2 10/07/98 10:53a Dave
28 * 1 10/07/98 10:49a Dave
30 * 17 5/11/98 5:29p Hoffoss
31 * Added mouse button mapped to joystick button support.
33 * 16 5/07/98 6:58p Hoffoss
34 * Made changes to mouse code to fix a number of problems.
36 * 15 5/05/98 8:38p Hoffoss
37 * Added sensitivity adjustment to options menu and made it save to pilot
40 * 14 5/01/98 5:45p Hoffoss
41 * Made further improvements to the mouse code.
43 * 13 5/01/98 1:14p Hoffoss
44 * Changed mouse usage so directInput is only used for release version.
46 * 12 4/30/98 5:40p Hoffoss
47 * Added mouse as a supported control to fly the ship.
49 * 11 4/29/98 12:13a Lawrance
50 * Add function to check down count of mouse button without reseting the
51 * internal count. Added hook to reset demo trailer timer when a button
54 * 10 4/02/98 5:26p John
56 * 9 12/04/97 3:47p John
57 * Made joystick move mouse cursor
59 * 8 11/20/97 5:36p Dave
60 * Hooked in a bunch of main hall changes (including sound). Made it
61 * possible to reposition (rewind/ffwd)
62 * sound buffer pointers. Fixed animation direction change framerate
65 * 7 4/22/97 12:32p John
66 * added mouse_init function
68 * 6 3/26/97 10:52a Lawrance
69 * mouse always on in menus, disappears in gameplay after 1 second
71 * 5 3/11/97 1:37p Lawrance
72 * added mouse_up_count(), changed mouse_mark() to mouse_mark_button() &
75 * 4 2/17/97 5:18p John
76 * Added a bunch of RCS headers to a bunch of old files that don't have
87 extern int Mouse_sensitivity;
88 extern int Use_mouse_to_fly;
89 extern int Mouse_hidden;
90 extern int Keep_mouse_centered;
92 // call once to init the mouse
95 extern void mouse_mark_button( uint flags, int set );
97 // Fills in xpos & ypos if not NULL.
98 // Returns Button states
99 // Always returns coordinates clipped to screen coordinates.
100 extern int mouse_get_pos( int *xpos, int *ypos );
102 // get_real_pos could be negative.
103 extern void mouse_get_real_pos(int *mx, int *my);
105 extern void mouse_set_pos(int xpos,int ypos);
107 #define MOUSE_LEFT_BUTTON (1<<0)
108 #define MOUSE_RIGHT_BUTTON (1<<1)
109 #define MOUSE_MIDDLE_BUTTON (1<<2)
111 #define MOUSE_NUM_BUTTONS 3
113 // keep the following two #defines up to date with the #defines above
114 #define LOWEST_MOUSE_BUTTON (1<<0)
115 #define HIGHEST_MOUSE_BUTTON (1<<2)
117 // Returns the number of times button n went from up to down since last call
118 int mouse_down_count(int n, int reset_count = 1);
119 // Returns the number of times button n went from down to up since last call
120 int mouse_up_count(int n);
122 extern void mouse_flush();
124 int mouse_down(int btn); // returns 1 if mouse button btn is down, 0 otherwise
125 float mouse_down_time(int btn); // returns the fraction of time btn has been down since last call
126 int mouse_is_visible(); // returns 1 if mouse is visible, 0 otherwise
128 void mouse_eval_deltas();
129 void mouse_get_delta(int *dx = NULL, int *dy = NULL, int *dz = NULL);