21 #define THREADED // to use the proper set of macros
25 #define MOUSE_MODE_DI 0
26 #define MOUSE_MODE_WIN 1
32 LOCAL int Di_mouse_inited = 0;
58 void mouse_eval_deltas_di();
63 static bool Mouse_in_focus =
true;
69 Mouse_in_focus =
true;
78 Mouse_in_focus =
false;
133 SDL_EventState( SDL_MOUSEMOTION, SDL_IGNORE );
137 SDL_EventState( SDL_MOUSEBUTTONDOWN, SDL_ENABLE );
138 SDL_EventState( SDL_MOUSEBUTTONUP, SDL_ENABLE );
164 if ( (flags & MOUSE_LEFT_BUTTON) && (set == 1) ) {
169 if ( (flags & MOUSE_LEFT_BUTTON) && (set == 0) ){
176 if ( (flags & MOUSE_RIGHT_BUTTON) && (set == 1) ){
181 if ( (flags & MOUSE_RIGHT_BUTTON) && (set == 0) ){
188 if ( (flags & MOUSE_MIDDLE_BUTTON) && (set == 1) ){
193 if ( (flags & MOUSE_MIDDLE_BUTTON) && (set == 0) ){
385 static int old_x = 0;
386 static int old_y = 0;
387 int tmp_x, tmp_y, cx, cy;
395 mouse_eval_deltas_di();
447 void mouse_eval_deltas_di()
454 if (!Di_mouse_inited)
458 memset(&mouse_state, 0,
sizeof(mouse_state));
462 hr = Di_mouse->GetDeviceState(
sizeof(mouse_state), &mouse_state);
470 hr = Di_mouse->Acquire();
510 #endif //#ifdef WIN32
631 mprintf((
"DirectInputCreate() failed!\n" ));
636 hr = Di_mouse_obj->CreateDevice(GUID_SysMouse, &Di_mouse, NULL);
638 mprintf((
"CreateDevice() failed!\n" ));
644 mprintf((
"SetDataFormat() failed!\n" ));
650 mprintf((
"SetCooperativeLevel() failed!\n" ));
691 Di_mouse->Unacquire();
699 Di_mouse_obj->Release();
717 SDL_GetMouseState(&pt->
x, &pt->
y);
730 SetCursorPos(pt->
x, pt->
y);
732 SDL_WarpMouse(pt->
x, pt->
y);
void mouse_set_pos(int xpos, int ypos)
#define DELETE_CRITICAL_SECTION(csc)
void RemHookVar(char *name)
#define MOUSE_LEFT_BUTTON
#define MOUSE_MIDDLE_BUTTON
SDL_mutex * CRITICAL_SECTION
int mouse_get_pos(int *xpos, int *ypos)
script_state Script_system("FS2_Open Scripting")
int mouse_get_pos_unscaled(int *xpos, int *ypos)
typedef int(SCP_EXT_CALLCONV *SCPDLL_PFVERSION)(SCPDLL_Version *)
#define HIGHEST_MOUSE_BUTTON
void mouse_force_pos(int x, int y)
float mouse_down_time(int btn)
#define ENTER_CRITICAL_SECTION(csc)
void getWindowMousePos(POINT *pt)
void mouse_get_delta(int *dx, int *dy, int *dz)
GLint GLint GLint GLint GLint x
int Cmdline_fullscreen_window
int RunCondition(int condition, char format='\0', void *data=NULL, class object *objp=NULL, int more_data=0)
bool gr_resize_screen_pos(int *x, int *y, int *w, int *h, int resize_mode)
#define MOUSE_RIGHT_BUTTON
#define LEAVE_CRITICAL_SECTION(csc)
int mouse_up_count(int n)
#define INITIALIZE_CRITICAL_SECTION(csc)
void SetHookVar(char *name, char format, void *data=NULL)
bool gr_unsize_screen_pos(int *x, int *y, int *w, int *h, int resize_mode)
void mouse_get_real_pos(int *mx, int *my)
#define LOWEST_MOUSE_BUTTON
CRITICAL_SECTION mouse_lock
#define CHA_MOUSERELEASED
void setWindowMousePos(POINT *pt)
int mouse_down_count(int n, int reset_count)
void mouse_mark_button(uint flags, int set)