FS2_Open
Open source remastering of the Freespace 2 engine
mouse.h
Go to the documentation of this file.
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 the
6  * source.
7  *
8 */
9 
10 
11 
12 #ifndef _MOUSE_H
13 #define _MOUSE_H
14 
15 #include "globalincs/pstypes.h"
16 
17 #ifdef _WIN32
18 #include <windows.h>
19 #endif
20 
21 extern int Mouse_sensitivity;
22 extern int Use_mouse_to_fly;
23 extern int Mouse_hidden;
24 extern int Keep_mouse_centered;
25 
26 // call once to init the mouse
27 void mouse_init();
28 
29 extern void mouse_mark_button( uint flags, int set );
30 
31 // Fills in xpos & ypos if not NULL.
32 // Returns Button states
33 // Always returns coordinates clipped to screen coordinates.
34 extern int mouse_get_pos( int *xpos, int *ypos );
35 // same as above but gets an unscaled reading (ie. the 1024x768/640x480 equivalent)
36 extern int mouse_get_pos_unscaled( int *xpos, int *ypos );
37 
38 // get_real_pos could be negative.
39 extern void mouse_get_real_pos(int *mx, int *my);
40 
41 extern void mouse_set_pos(int xpos,int ypos);
42 
43 #define MOUSE_LEFT_BUTTON (1<<0)
44 #define MOUSE_RIGHT_BUTTON (1<<1)
45 #define MOUSE_MIDDLE_BUTTON (1<<2)
46 
47 #define MOUSE_NUM_BUTTONS 3
48 
49 // keep the following two #defines up to date with the #defines above
50 #define LOWEST_MOUSE_BUTTON (1<<0)
51 #define HIGHEST_MOUSE_BUTTON (1<<2)
52 
53 // Returns the number of times button n went from up to down since last call
54 int mouse_down_count(int n, int reset_count = 1);
55 // Returns the number of times button n went from down to up since last call
56 int mouse_up_count(int n);
57 
58 extern void mouse_flush();
59 
60 int mouse_down(int btn); // returns 1 if mouse button btn is down, 0 otherwise
61 float mouse_down_time(int btn); // returns the fraction of time btn has been down since last call
62 int mouse_is_visible(); // returns 1 if mouse is visible, 0 otherwise
63 
64 void mouse_lost_focus();
65 void mouse_got_focus();
66 
67 void mouse_eval_deltas();
68 void mouse_get_delta(int *dx = NULL, int *dy = NULL, int *dz = NULL);
69 
70 // portable routines to get and set the mouse position, relative
71 // to current window
72 void getWindowMousePos(POINT * pt);
73 void setWindowMousePos(POINT * pt);
74 
75 extern void mouse_force_pos(int x, int y);
76 
77 #endif
Definition: config.h:286
int Use_mouse_to_fly
Definition: mouse.cpp:51
void mouse_force_pos(int x, int y)
Definition: mouse.cpp:369
float mouse_down_time(int btn)
Definition: mouse.cpp:339
void mouse_mark_button(uint flags, int set)
Definition: mouse.cpp:156
int mouse_down_count(int n, int reset_count=1)
Definition: mouse.cpp:236
void mouse_init()
Definition: mouse.cpp:103
void mouse_get_delta(int *dx=NULL, int *dy=NULL, int *dz=NULL)
Definition: mouse.cpp:358
int mouse_up_count(int n)
Definition: mouse.cpp:278
int Mouse_hidden
Definition: mouse.cpp:52
unsigned int uint
Definition: pstypes.h:64
int mouse_is_visible()
Definition: mouse.cpp:83
void mouse_eval_deltas()
Definition: mouse.cpp:383
void getWindowMousePos(POINT *pt)
Definition: mouse.cpp:709
void setWindowMousePos(POINT *pt)
Definition: mouse.cpp:724
int mouse_get_pos(int *xpos, int *ypos)
Definition: mouse.cpp:512
GLint GLint GLint GLint GLint x
Definition: Glext.h:5182
GLclampd n
Definition: Glext.h:7286
int Mouse_sensitivity
Definition: mouse.cpp:50
void mouse_got_focus()
Definition: mouse.cpp:65
GLbitfield flags
Definition: Glext.h:6722
int Keep_mouse_centered
Definition: mouse.cpp:53
int mouse_get_pos_unscaled(int *xpos, int *ypos)
Definition: mouse.cpp:580
void mouse_set_pos(int xpos, int ypos)
Definition: mouse.cpp:604
int mouse_down(int btn)
Definition: mouse.cpp:315
void mouse_get_real_pos(int *mx, int *my)
Definition: mouse.cpp:589
void mouse_flush()
Definition: mouse.cpp:221
GLint y
Definition: Gl.h:1505
void mouse_lost_focus()
Definition: mouse.cpp:74