From 85751a70522765b975c8ca960db0b5c2276b3bce Mon Sep 17 00:00:00 2001 From: tanolino Date: Wed, 31 May 2023 00:34:52 +0200 Subject: [PATCH] Fix full screen resolution issue I was writing a image viewer in Raylib and high res images appeared in the same low resolution as the small window. Investigating the issue showed that glfwSetWindowMonitor is called with the screen resolution, not the current monitor resolution. It is possible I am misunderstanding things here and the current work flow is desired for pixelart games with not resizable windows ? --- src/rcore.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/rcore.c b/src/rcore.c index 7a31b5ed6..a3a945c79 100644 --- a/src/rcore.c +++ b/src/rcore.c @@ -1230,8 +1230,17 @@ void ToggleFullscreen(void) { CORE.Window.fullscreen = true; CORE.Window.flags |= FLAG_FULLSCREEN_MODE; + const GLFWvidmode* mode = glfwGetVideoMode(monitor); + if (!mode) + { + TRACELOG(LOG_WARNING, "GLFW: Failed to get monitor video mode"); + glfwSetWindowMonitor(CORE.Window.handle, monitor, 0, 0, CORE.Window.screen.width, CORE.Window.screen.height, GLFW_DONT_CARE); + } + else + { + glfwSetWindowMonitor(CORE.Window.handle, monitor, 0, 0, mode->width, mode->height, GLFW_DONT_CARE); + } - glfwSetWindowMonitor(CORE.Window.handle, monitor, 0, 0, CORE.Window.screen.width, CORE.Window.screen.height, GLFW_DONT_CARE); } } else