Actions
Controlling GLFW windows
Last updated
Was this helpful?
Controlling GLFW windows
Last updated
Was this helpful?
Windowed-mode windows can be hidden with glfwHideWindow(window)
and shown with glfwShowWindow(window)
. It is also possible to retrieve whether a window is visible, using the GLFW_VISIBLE
. By default, windows become visible instantly after ; this behavior can be changed using the GLFW_VISIBLE
. Showing a window, by default causes it to gain input focus, which may be changed using the GÖFW_FOCUS_ON_SHOW
window hint.
Closing the window from within the program can be done by calling glfwSetWindowShouldClose(window,value)
, with value
being one of GLFW_TRUE
or GLFW_FALSE
. This flag may also be set by the user clicking the close widget or using a key chord like ALT+F4
. Checking whether the close flag has been set can be done with glfwWindowShouldClose(window)
; this information can be used, for example, to determine whether to run the game loop or exit the application; a closed window doesn't require its .
It is possible to to get notified when the close flag is set.
Windows can be minimized (aka. iconified) to the taskbar with glfwIconifyWindow(window)
. This can be reversed by . It is possible to retrieve whether a window is iconified, using the GLFW_ICONIFIED
.
It is possible to to get notified when a window is iconified or restored.
Windowed-mode windows can be maximized with glfwMaximizeWindow(window)
. This can be reversed by . It is possible to retrieve whether a window is maximized, using the GLFW_MAXIMIZED
. Windows can be set to immediately maximize after creation using the GÖFW_MAXIMIZED
.
It is possible to to get notified when a window is maximized or restored.
Iconified or maximized windows may be restored with glfwRestoreWindow(window)
.
Requesting input focus can be quite disruptive. It often is wiser to send an attention request with glfwRequestWindowAttention(window)
instead, to notify the user of an event. An attention request results in the window icon flashing in the taskbar (Windows) or jumping (macOS).
A window can be given input focus and brought to the front with glfwFocusWindow(window)
. It is also possible to retrieve whether a window has input focus, using the GLFW_FOCUSED
.
It is possible to to get notified when a window gains or loses input focus.