]> icculus.org git repositories - taylor/freespace2.git/blob - include/mouse.h
Initial revision
[taylor/freespace2.git] / include / mouse.h
1 /*
2  * $Logfile: /Freespace2/code/Io/Mouse.h $
3  * $Revision$
4  * $Date$
5  * $Author$
6  *
7  * Include file for mouse reading routines
8  *
9  * $Log$
10  * Revision 1.1  2002/05/03 03:28:12  root
11  * Initial revision
12  *
13  * 
14  * 2     10/07/98 10:53a Dave
15  * Initial checkin.
16  * 
17  * 1     10/07/98 10:49a Dave
18  * 
19  * 17    5/11/98 5:29p Hoffoss
20  * Added mouse button mapped to joystick button support.
21  * 
22  * 16    5/07/98 6:58p Hoffoss
23  * Made changes to mouse code to fix a number of problems.
24  * 
25  * 15    5/05/98 8:38p Hoffoss
26  * Added sensitivity adjustment to options menu and made it save to pilot
27  * file.
28  * 
29  * 14    5/01/98 5:45p Hoffoss
30  * Made further improvements to the mouse code.
31  * 
32  * 13    5/01/98 1:14p Hoffoss
33  * Changed mouse usage so directInput is only used for release version.
34  * 
35  * 12    4/30/98 5:40p Hoffoss
36  * Added mouse as a supported control to fly the ship.
37  * 
38  * 11    4/29/98 12:13a Lawrance
39  * Add function to check down count of mouse button without reseting the
40  * internal count.  Added hook to reset demo trailer timer when a button
41  * is pressed.
42  * 
43  * 10    4/02/98 5:26p John
44  * 
45  * 9     12/04/97 3:47p John
46  * Made joystick move mouse cursor
47  * 
48  * 8     11/20/97 5:36p Dave
49  * Hooked in a bunch of main hall changes (including sound). Made it
50  * possible to reposition (rewind/ffwd) 
51  * sound buffer pointers. Fixed animation direction change framerate
52  * problem.
53  * 
54  * 7     4/22/97 12:32p John
55  * added mouse_init function
56  * 
57  * 6     3/26/97 10:52a Lawrance
58  * mouse always on in menus, disappears in gameplay after 1 second
59  * 
60  * 5     3/11/97 1:37p Lawrance
61  * added mouse_up_count(), changed mouse_mark() to mouse_mark_button() &
62  * mouse_mark_move()
63  * 
64  * 4     2/17/97 5:18p John
65  * Added a bunch of RCS headers to a bunch of old files that don't have
66  * them.
67  *
68  * $NoKeywords: $
69  */
70
71 #ifndef _MOUSE_H
72 #define _MOUSE_H
73
74 #include "pstypes.h"
75
76 extern int Mouse_sensitivity;
77 extern int Use_mouse_to_fly;
78 extern int Mouse_hidden;
79 extern int Keep_mouse_centered;
80
81 // call once to init the mouse
82 void mouse_init();
83
84 extern void mouse_mark_button( uint flags, int set );
85
86 // Fills in xpos & ypos if not NULL.
87 // Returns Button states
88 // Always returns coordinates clipped to screen coordinates.
89 extern int mouse_get_pos( int *xpos, int *ypos );
90
91 // get_real_pos could be negative.
92 extern void mouse_get_real_pos(int *mx, int *my);
93
94 extern void mouse_set_pos(int xpos,int ypos);
95
96 #define MOUSE_LEFT_BUTTON               (1<<0)
97 #define MOUSE_RIGHT_BUTTON              (1<<1)
98 #define MOUSE_MIDDLE_BUTTON     (1<<2)
99
100 #define MOUSE_NUM_BUTTONS               3
101
102 // keep the following two #defines up to date with the #defines above
103 #define LOWEST_MOUSE_BUTTON     (1<<0)
104 #define HIGHEST_MOUSE_BUTTON    (1<<2)
105
106 // Returns the number of times button n went from up to down since last call
107 int mouse_down_count(int n, int reset_count = 1);
108 // Returns the number of times button n went from down to up since last call
109 int mouse_up_count(int n);
110
111 extern void mouse_flush();
112
113 int mouse_down(int btn);                        // returns 1 if mouse button btn is down, 0 otherwise
114 float mouse_down_time(int btn); // returns the fraction of time btn has been down since last call
115 int mouse_is_visible();                         // returns 1 if mouse is visible, 0 otherwise
116
117 void mouse_eval_deltas();
118 void mouse_get_delta(int *dx = NULL, int *dy = NULL, int *dz = NULL);
119
120 #endif
121