|
|
@ -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 = p">(monitorIndex < monitorCount class="p">)? monitors[monitorIndex] : NULL; |
|
|
|
|
|
|
|
if (o">!monitor) |
|
|
|
if (n">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); |
|
|
|