summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorubkp <[email protected]>2023-10-22 04:45:04 -0300
committerGitHub <[email protected]>2023-10-22 09:45:04 +0200
commit8cda4273ece19fe349bad73cb7e118352ea1cc42 (patch)
tree2cf82fcf15417168103d2e0a3f5ccd18b7d69069
parente5993c4a4b27cb30617f1d07b0d9583e8f556902 (diff)
downloadraylib-8cda4273ece19fe349bad73cb7e118352ea1cc42.tar.gz
raylib-8cda4273ece19fe349bad73cb7e118352ea1cc42.zip
[core] Complement implementations for `SDL` (3) (#3450)
* Fix SetWindowMinSize and SetWindowMaxSize * Fix window resizes to update the viewport * Fix window resizes to update the viewport 2
-rw-r--r--src/platforms/rcore_desktop_sdl.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/platforms/rcore_desktop_sdl.c b/src/platforms/rcore_desktop_sdl.c
index b261b042..d2f550ac 100644
--- a/src/platforms/rcore_desktop_sdl.c
+++ b/src/platforms/rcore_desktop_sdl.c
@@ -618,6 +618,8 @@ void SetWindowMonitor(int monitor)
// Set window minimum dimensions (FLAG_WINDOW_RESIZABLE)
void SetWindowMinSize(int width, int height)
{
+ SDL_SetWindowMinimumSize(platform.window, width, height);
+
CORE.Window.screenMin.width = width;
CORE.Window.screenMin.height = height;
}
@@ -625,6 +627,8 @@ void SetWindowMinSize(int width, int height)
// Set window maximum dimensions (FLAG_WINDOW_RESIZABLE)
void SetWindowMaxSize(int width, int height)
{
+ SDL_SetWindowMaximumSize(platform.window, width, height);
+
CORE.Window.screenMax.width = width;
CORE.Window.screenMax.height = height;
}
@@ -979,6 +983,8 @@ void PollInputEvents(void)
}
*/
+ CORE.Window.resizedLastFrame = false;
+
SDL_Event event = { 0 };
while (SDL_PollEvent(&event) != 0)
{
@@ -992,6 +998,18 @@ void PollInputEvents(void)
{
switch (event.window.event)
{
+ case SDL_WINDOWEVENT_RESIZED:
+ case SDL_WINDOWEVENT_SIZE_CHANGED:
+ {
+ const int width = event.window.data1;
+ const 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: