From 48e6672d111f3787b86cb5e0c51b0dcad8d30c53 Mon Sep 17 00:00:00 2001 From: Guus Sliepen Date: Thu, 6 Aug 2015 18:49:33 +0200 Subject: [PATCH] Fix mouse scaling in fullscreen mode. --- src/CEngine.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/CEngine.cpp b/src/CEngine.cpp index 32262f1..45f30ef 100644 --- a/src/CEngine.cpp +++ b/src/CEngine.cpp @@ -157,6 +157,12 @@ void Engine::getInput() { SDL_GetMouseState(&mouseX, &mouseY); + // Scale from window coordinates to graphics coordinates + int w, h; + SDL_GetWindowSize(graphics.window, &w, &h); + mouseX = mouseX * 640 / w; + mouseY = mouseY * 480 / h; + while (SDL_PollEvent(&event)) { switch (event.type) -- 2.39.5