Mouse coordinates are floating point

You can get sub-pixel mouse coordinates and motion depending on the platform and display scaling.

Fixes https://github.com/libsdl-org/SDL/issues/2999
This commit is contained in:
Sam Lantinga
2022-12-29 19:31:12 -08:00
parent 8c3239dee5
commit cefbeb582f
52 changed files with 564 additions and 654 deletions

View File

@@ -253,7 +253,7 @@ void WINRT_ProcessPointerMovedEvent(SDL_Window *window, Windows::UI::Input::Poin
SDL_SendMouseButton(0, window, 0, pressed, button);
}
SDL_SendMouseMotion(0, window, 0, 0, (int)windowPoint.X, (int)windowPoint.Y);
SDL_SendMouseMotion(0, window, 0, 0, windowPoint.X, windowPoint.Y);
} else {
SDL_SendTouchMotion(0,
WINRT_TouchID,
@@ -390,8 +390,8 @@ void WINRT_ProcessMouseMovedEvent(SDL_Window *window, Windows::Devices::Input::M
window,
0,
1,
SDL_lroundf(mouseDeltaInSDLWindowCoords.X),
SDL_lroundf(mouseDeltaInSDLWindowCoords.Y));
mouseDeltaInSDLWindowCoords.X,
mouseDeltaInSDLWindowCoords.Y);
}
#endif // SDL_VIDEO_DRIVER_WINRT