From: Guus Sliepen Date: Thu, 6 Aug 2015 16:49:33 +0000 (+0200) Subject: Fix mouse scaling in fullscreen mode. X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=48e6672d111f3787b86cb5e0c51b0dcad8d30c53;p=quix0rs-blobwars.git Fix mouse scaling in fullscreen mode. --- 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)