diff options
| author | Ray <[email protected]> | 2022-04-23 23:40:56 +0200 |
|---|---|---|
| committer | Ray <[email protected]> | 2022-04-23 23:40:56 +0200 |
| commit | 47d768c3d653ae15fe006e9ec2f9515e8e416ce6 (patch) | |
| tree | c673df10332da11301fd95347522dc35d42dd9e4 | |
| parent | 015a71fc407e6cba3162b120ea20651df40e0c13 (diff) | |
| download | raylib-47d768c3d653ae15fe006e9ec2f9515e8e416ce6.tar.gz raylib-47d768c3d653ae15fe006e9ec2f9515e8e416ce6.zip | |
REVIEWED: ToggleFullscreen()
| -rw-r--r-- | src/rcore.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/src/rcore.c b/src/rcore.c index 12e68db3..b7a96938 100644 --- a/src/rcore.c +++ b/src/rcore.c @@ -1175,39 +1175,39 @@ bool IsWindowState(unsigned int flag) void ToggleFullscreen(void) { #if defined(PLATFORM_DESKTOP) - // NOTE: glfwSetWindowMonitor() doesn't work properly (bugs) + // TODO: glfwSetWindowMonitor() doesn't work properly (bugs) if (!CORE.Window.fullscreen) { // Store previous window position (in case we exit fullscreen) glfwGetWindowPos(CORE.Window.handle, &CORE.Window.position.x, &CORE.Window.position.y); int monitorCount = 0; - GLFWmonitor** monitors = glfwGetMonitors(&monitorCount); - int monitorIndex = GetCurrentMonitor(); + GLFWmonitor **monitors = glfwGetMonitors(&monitorCount); // Use current monitor, so we correctly get the display the window is on - GLFWmonitor* monitor = monitorIndex < monitorCount ? monitors[monitorIndex] : NULL; + GLFWmonitor *monitor = (monitorIndex < monitorCount)? monitors[monitorIndex] : NULL; - if (!monitor) + if (monitor == NULL) { TRACELOG(LOG_WARNING, "GLFW: Failed to get monitor"); - CORE.Window.fullscreen = false; // Toggle fullscreen flag + CORE.Window.fullscreen = false; CORE.Window.flags &= ~FLAG_FULLSCREEN_MODE; glfwSetWindowMonitor(CORE.Window.handle, NULL, 0, 0, CORE.Window.screen.width, CORE.Window.screen.height, GLFW_DONT_CARE); - return; } + else + { + CORE.Window.fullscreen = true; + CORE.Window.flags |= FLAG_FULLSCREEN_MODE; - CORE.Window.fullscreen = true; // Toggle fullscreen flag - CORE.Window.flags |= FLAG_FULLSCREEN_MODE; - - glfwSetWindowMonitor(CORE.Window.handle, monitor, 0, 0, CORE.Window.screen.width, CORE.Window.screen.height, GLFW_DONT_CARE); + glfwSetWindowMonitor(CORE.Window.handle, monitor, 0, 0, CORE.Window.screen.width, CORE.Window.screen.height, GLFW_DONT_CARE); + } } else { - CORE.Window.fullscreen = false; // Toggle fullscreen flag + CORE.Window.fullscreen = false; CORE.Window.flags &= ~FLAG_FULLSCREEN_MODE; glfwSetWindowMonitor(CORE.Window.handle, NULL, CORE.Window.position.x, CORE.Window.position.y, CORE.Window.screen.width, CORE.Window.screen.height, GLFW_DONT_CARE); |
