always adjust for viewport size in mouse coords now

This commit is contained in:
Tim Felgentreff 2020-04-14 09:30:49 +02:00
parent 0c530a7e6a
commit d3e33a8840

View file

@ -859,13 +859,9 @@ static void SdlDoEvent(const EventCallback &callbacks, SDL_Event &event)
&& (event.motion.x != UI.MouseWarpPos.x || event.motion.y != UI.MouseWarpPos.y)) {
int xw = UI.MouseWarpPos.x;
int yw = UI.MouseWarpPos.y;
#if (defined(USE_OPENGL) || defined(USE_GLES))
// Scale mouse-coordinates to viewport
if (ZoomNoResize) {
xw = (Uint16)floorf(xw * float(Video.ViewportWidth) / Video.Width);
yw = (Uint16)floorf(yw * float(Video.ViewportHeight) / Video.Height);
}
#endif
xw = (Uint16)floorf(xw * float(Video.ViewportWidth) / Video.Width);
yw = (Uint16)floorf(yw * float(Video.ViewportHeight) / Video.Height);
UI.MouseWarpPos.x = -1;
UI.MouseWarpPos.y = -1;
SDL_WarpMouseInWindow(TheWindow, xw, yw);