FreeBASIC  0.91.0
gfx_getmouse.c
Go to the documentation of this file.
1 /* GETMOUSE function support. */
2 
3 #include "fb_gfx.h"
4 
5 
6 /*:::::*/
7 int fb_GfxGetMouse(int *x, int *y, int *z, int *buttons, int *clip)
8 {
9  int failure = TRUE;
10  int temp_z, temp_buttons, temp_clip;
11 
12  if (!z)
13  z = &temp_z;
14  if (!buttons)
15  buttons = &temp_buttons;
16  if (!clip)
17  clip = &temp_clip;
18  if ((__fb_gfx) && (__fb_gfx->driver->get_mouse)) {
19  DRIVER_LOCK();
20  failure = __fb_gfx->driver->get_mouse(x, y, z, buttons, clip);
21  DRIVER_UNLOCK();
22  }
23  if (failure) {
24  *x = *y = *z = *buttons = *clip = -1;
26  }
27  return fb_ErrorSetNum( FB_RTERROR_OK );
28 }