From 640c827efb4c0cc9a7124e5521df05d2a282c3b9 Mon Sep 17 00:00:00 2001 From: ubkp <118854183+ubkp@users.noreply.github.com> Date: Sat, 21 Oct 2023 21:51:32 -0300 Subject: [PATCH] Fix window resizes to update the viewport --- src/platforms/rcore_desktop_sdl.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/platforms/rcore_desktop_sdl.c b/src/platforms/rcore_desktop_sdl.c index 37a03c45c..6b7293200 100644 --- a/src/platforms/rcore_desktop_sdl.c +++ b/src/platforms/rcore_desktop_sdl.c @@ -983,6 +983,8 @@ void PollInputEvents(void) } */ + CORE.Window.resizedLastFrame = false; + SDL_Event event = { 0 }; while (SDL_PollEvent(&event) != 0) { @@ -996,6 +998,18 @@ void PollInputEvents(void) { switch (event.window.event) { + case SDL_WINDOWEVENT_RESIZED: + case SDL_WINDOWEVENT_SIZE_CHANGED: + { + int width = event.window.data1; + int height = event.window.data2; + SetupViewport(width, height); + CORE.Window.screen.width = width; + CORE.Window.screen.height = height; + CORE.Window.currentFbo.width = width; + CORE.Window.currentFbo.height = height; + CORE.Window.resizedLastFrame = true; + } break; case SDL_WINDOWEVENT_LEAVE: case SDL_WINDOWEVENT_HIDDEN: case SDL_WINDOWEVENT_MINIMIZED: