From b6fd7342768e07cf7210cadc348d2a0bad302481 Mon Sep 17 00:00:00 2001 From: David Lyhed Danielsson Date: Tue, 25 Apr 2023 21:22:42 +0200 Subject: [PATCH] Update screen scale and mouse scale when window size is changed --- src/rcore.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/rcore.c b/src/rcore.c index bb8852826..839b2c1a1 100644 --- a/src/rcore.c +++ b/src/rcore.c @@ -5376,6 +5376,13 @@ static void WindowSizeCallback(GLFWwindow *window, int width, int height) CORE.Window.screen.width = (unsigned int)(width/windowScaleDPI.x); CORE.Window.screen.height = (unsigned int)(height/windowScaleDPI.y); + + int fbWidth = 0; + int fbHeight = 0; + glfwGetFramebufferSize(CORE.Window.handle, &fbWidth, &fbHeight); + + CORE.Window.screenScale = MatrixScale((float)fbWidth/CORE.Window.screen.width, (float)fbHeight/CORE.Window.screen.height, 1.0f); + SetMouseScale((float)CORE.Window.screen.width/fbWidth, (float)CORE.Window.screen.height/fbHeight); } else {