MCPcopy Create free account
hub / github.com/TASEmulators/fceux / GetMouseData

Function GetMouseData

src/drivers/sdl/input.cpp:871–911  ·  view source on GitHub ↗

* Return the state of the mouse buttons. Input 'd' is an array of 3 * integers that store . */

Source from the content-addressed store, hash-verified

869 * integers that store <x, y, button state>.
870 */
871void // removed static for a call in lua-engine.cpp
872GetMouseData (uint32 (&d)[3])
873{
874 int x, y;
875 uint32 t;
876
877 // retrieve the state of the mouse from SDL
878 t = SDL_GetMouseState (&x, &y);
879#ifdef _GTK
880 if (noGui == 0)
881 {
882 // don't ask for gtk mouse info when in fullscreen
883 // we can use sdl directly in fullscreen
884 int fullscreen = 0;
885 g_config->getOption ("SDL.Fullscreen", &fullscreen);
886 if (fullscreen == 0)
887 {
888 x = GtkMouseData[0];
889 y = GtkMouseData[1];
890 t = GtkMouseData[2];
891 }
892 }
893#endif
894
895 d[2] = 0;
896 if (t & SDL_BUTTON (1))
897 {
898 d[2] |= 0x1;
899 }
900 if (t & SDL_BUTTON (3))
901 {
902 d[2] |= 0x2;
903 }
904
905 // get the mouse position from the SDL video driver
906 t = PtoV (x, y);
907 d[0] = t & 0xFFFF;
908 d[1] = (t >> 16) & 0xFFFF;
909 // debug print
910 // printf("mouse %d %d %d\n", d[0], d[1], d[2]);
911}
912
913void GetMouseRelative (int32 (&d)[3])
914{

Callers 2

GetMouseRelativeFunction · 0.70
FCEUD_UpdateInputFunction · 0.70

Calls 2

getOptionMethod · 0.80
PtoVFunction · 0.70

Tested by

no test coverage detected