]> icculus.org git repositories - taylor/freespace2.git/blob - include/mouse.h
proper padding of PXO stats struct for FS2 demo
[taylor/freespace2.git] / include / mouse.h
1 /*
2  * Copyright (C) Volition, Inc. 1999.  All rights reserved.
3  *
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
6  * the source.
7  */
8
9 /*
10  * $Logfile: /Freespace2/code/Io/Mouse.h $
11  * $Revision$
12  * $Date$
13  * $Author$
14  *
15  * Include file for mouse reading routines
16  *
17  * $Log$
18  * Revision 1.2  2002/06/09 04:41:14  relnev
19  * added copyright header
20  *
21  * Revision 1.1.1.1  2002/05/03 03:28:12  root
22  * Initial import.
23  *
24  * 
25  * 2     10/07/98 10:53a Dave
26  * Initial checkin.
27  * 
28  * 1     10/07/98 10:49a Dave
29  * 
30  * 17    5/11/98 5:29p Hoffoss
31  * Added mouse button mapped to joystick button support.
32  * 
33  * 16    5/07/98 6:58p Hoffoss
34  * Made changes to mouse code to fix a number of problems.
35  * 
36  * 15    5/05/98 8:38p Hoffoss
37  * Added sensitivity adjustment to options menu and made it save to pilot
38  * file.
39  * 
40  * 14    5/01/98 5:45p Hoffoss
41  * Made further improvements to the mouse code.
42  * 
43  * 13    5/01/98 1:14p Hoffoss
44  * Changed mouse usage so directInput is only used for release version.
45  * 
46  * 12    4/30/98 5:40p Hoffoss
47  * Added mouse as a supported control to fly the ship.
48  * 
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
52  * is pressed.
53  * 
54  * 10    4/02/98 5:26p John
55  * 
56  * 9     12/04/97 3:47p John
57  * Made joystick move mouse cursor
58  * 
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
63  * problem.
64  * 
65  * 7     4/22/97 12:32p John
66  * added mouse_init function
67  * 
68  * 6     3/26/97 10:52a Lawrance
69  * mouse always on in menus, disappears in gameplay after 1 second
70  * 
71  * 5     3/11/97 1:37p Lawrance
72  * added mouse_up_count(), changed mouse_mark() to mouse_mark_button() &
73  * mouse_mark_move()
74  * 
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
77  * them.
78  *
79  * $NoKeywords: $
80  */
81
82 #ifndef _MOUSE_H
83 #define _MOUSE_H
84
85 #include "pstypes.h"
86
87 extern int Mouse_sensitivity;
88 extern int Use_mouse_to_fly;
89 extern int Mouse_hidden;
90 extern int Keep_mouse_centered;
91
92 // call once to init the mouse
93 void mouse_init();
94
95 extern void mouse_mark_button( uint flags, int set );
96
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 );
101
102 // get_real_pos could be negative.
103 extern void mouse_get_real_pos(int *mx, int *my);
104
105 extern void mouse_set_pos(int xpos,int ypos);
106
107 #define MOUSE_LEFT_BUTTON               (1<<0)
108 #define MOUSE_RIGHT_BUTTON              (1<<1)
109 #define MOUSE_MIDDLE_BUTTON     (1<<2)
110
111 #define MOUSE_NUM_BUTTONS               3
112
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)
116
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);
121
122 extern void mouse_flush();
123
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
127
128 void mouse_grab(int grab);
129 void mouse_eval_deltas();
130 void mouse_get_delta(int *dx = NULL, int *dy = NULL, int *dz = NULL);
131
132 void mouse_update_pos(int x, int y, int dx, int dy);
133
134 #endif
135