From 76f1b9786a93356855eab9d597e894df5960d95e Mon Sep 17 00:00:00 2001 From: Steve Date: Mon, 14 Dec 2015 08:33:14 +0000 Subject: [PATCH] Flush all events when mouse has been warped. --- src/system/input.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/system/input.c b/src/system/input.c index 6f4e4dc..a80ad0c 100644 --- a/src/system/input.c +++ b/src/system/input.c @@ -56,9 +56,16 @@ void doMouseWheel(SDL_MouseWheelEvent *event) void setMouse(int x, int y) { - app.mouse.x = x; - app.mouse.y = y; + SDL_Event event; + + app.mouse.x = x * app.scaleX; + app.mouse.y = y * app.scaleY; + SDL_WarpMouseInWindow(app.window, x, y); + + while (SDL_PollEvent(&event)) + { + } } void drawMouse(void)