TerraForge3D  2.3.1
3D Terrain And Landscape Generator

◆ SetFullScreen()

void Window::SetFullScreen ( bool  fullscreen)

Definition at line 79 of file Window.cpp.

80{
81 if (isFullscreen == fullscreen)
82 {
83 return;
84 }
85
86 static int x, y;
87 static int sx, sy;
88 isFullscreen = fullscreen;
89
90 if (fullscreen)
91 {
92 // backup window position and window size
93 glfwGetWindowPos(m_Window, &x, &y);
94 glfwGetWindowSize(m_Window, &sx, &sy);
95 // get resolution of monitor
96 const GLFWvidmode *mode = glfwGetVideoMode(glfwGetPrimaryMonitor());
97 // switch to full screen
98 glfwSetWindowMonitor(m_Window, glfwGetPrimaryMonitor(), 0, 0, mode->width, mode->height, 0);
99 }
100
101 else
102 {
103 // restore last window size and position
104 glfwSetWindowMonitor(m_Window, nullptr, x, y, sx, sy, 0);
105 }
106}