Fix issue with SetWindowSize that caused drawing to fail after

resizing the window on a retina display.
This commit is contained in:
JoeStrout 2026-03-29 16:24:29 -07:00
parent 8743e11285
commit 7bd8238e8d

View File

@ -739,6 +739,22 @@ void SetWindowSize(int width, int height)
CORE.Window.screen.height = height; CORE.Window.screen.height = height;
glfwSetWindowSize(platform.handle, width, height); glfwSetWindowSize(platform.handle, width, height);
// Update render size and viewport to match new screen size immediately,
// rather than waiting for the async FramebufferSizeCallback.
if (FLAG_IS_SET(CORE.Window.flags, FLAG_WINDOW_HIGHDPI))
{
Vector2 scaleDpi = GetWindowScaleDPI();
CORE.Window.render.width = (int)(width*scaleDpi.x);
CORE.Window.render.height = (int)(height*scaleDpi.y);
}
else
{
CORE.Window.render.width = width;
CORE.Window.render.height = height;
}
CORE.Window.currentFbo = CORE.Window.render;
SetupViewport(CORE.Window.render.width, CORE.Window.render.height);
} }
// Set window opacity, value opacity is between 0.0 and 1.0 // Set window opacity, value opacity is between 0.0 and 1.0