From 9e08a693c72e689bf2c2b2e9056a664d84e9f580 Mon Sep 17 00:00:00 2001 From: Raimon Zamora Date: Tue, 13 Feb 2024 13:20:07 +0100 Subject: [PATCH] =?UTF-8?q?-=20[FIX]=20Ara=20les=20coordinades=20del=20rat?= =?UTF-8?q?ol=C3=AD=20son=20lo=20que=20toca=20respecte=20al=20joc,=20no=20?= =?UTF-8?q?al=20tamany=20real=20de=20la=20finestra?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- mini.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/mini.cpp b/mini.cpp index 71ca544..fbb5b1a 100644 --- a/mini.cpp +++ b/mini.cpp @@ -391,8 +391,13 @@ int main(int argc,char*argv[]){ }*/ } keys = SDL_GetKeyboardState(NULL); - mouse_buttons = SDL_GetMouseState(&mouse_x, &mouse_y); - mouse_x /= screen_zoom; mouse_y /= screen_zoom; + int real_mouse_x, real_mouse_y; + mouse_buttons = SDL_GetMouseState(&real_mouse_x, &real_mouse_y); + float mx, my; + SDL_RenderWindowToLogical(mini_ren, real_mouse_x, real_mouse_y, &mx, &my); + mouse_x = int(mx); + mouse_y = int(my); + //mouse_x /= screen_zoom; mouse_y /= screen_zoom; if (SDL_GetTicks()-dt>13) { dt = SDL_GetTicks();