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

Function GetMouseRelative

src/drivers/sdl/input.cpp:913–940  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

911}
912
913void GetMouseRelative (int32 (&d)[3])
914{
915 // converts absolute mouse positions to relative ones for input devices that require this
916
917 // The windows version additionally in fullscreen will constantly return the mouse to center screen
918 // after reading it, so that the user can endlessly keep moving the mouse.
919 // The same should eventually be implemented here, but this version should minimally provide
920 // the necessary relative input, piggybacking on the already implemented GetMouseData.
921
922 static int cx = -1;
923 static int cy = -1;
924
925 uint32 md[3];
926 GetMouseData (md);
927
928 if (cx < 0 || cy < 0)
929 {
930 cx = md[0];
931 cy = md[1];
932 }
933
934 int dx = md[0] - cx;
935 int dy = md[1] - cy;
936
937 d[0] = dx;
938 d[1] = dy;
939 d[2] = md[2]; // buttons
940}
941
942//static void checkKeyBoardState( int scanCode )
943//{

Callers 1

FCEUD_UpdateInputFunction · 0.70

Calls 1

GetMouseDataFunction · 0.70

Tested by

no test coverage detected