mirror of
https://github.com/glfw/glfw.git
synced 2025-10-04 05:36:35 +00:00
Update fullscreen related docs
This commit is contained in:
parent
061c273da6
commit
390994c3ec
@ -44,12 +44,29 @@ the event.
|
||||
|
||||
@subsubsection window_full_screen Full screen windows
|
||||
|
||||
To create a full screen window, you need to specify which monitor the window
|
||||
should use. In most cases, the user's primary monitor is a good choice.
|
||||
For more information about retrieving monitors, see @ref monitor_monitors.
|
||||
To create a full screen window, you can use the GLFW_FULLSCREEN window hint.
|
||||
It is also possible to specify which monitor the window should use. In most
|
||||
cases, the user's primary monitor is a good choice. For more information about
|
||||
retrieving monitors, see @ref monitor_monitors.
|
||||
|
||||
@code
|
||||
glfwWindowHint(GLFW_FULLSCREEN, GLFW_TRUE);
|
||||
|
||||
GLFWwindow* window = glfwCreateWindow(640, 480, "My Title", glfwGetPrimaryMonitor(), NULL);
|
||||
// same as passing null for the monitor
|
||||
@endcode
|
||||
|
||||
The mode of a window, whether created as fullscreen or as a windowed mode window,
|
||||
can be toggled at any time using @ref glfwToggleWindowFullscreen.
|
||||
|
||||
@code
|
||||
glfwToggleWindowFullscreen(window);
|
||||
@endcode
|
||||
|
||||
You can also get the current window state with @ref glfwGetWindowAttrib.
|
||||
|
||||
@code
|
||||
int fullscreen = glfwGetWindowAttrib(window, GLFW_FULLSCREEN);
|
||||
@endcode
|
||||
|
||||
Full screen windows cover the entire display area of a monitor, have no border
|
||||
@ -92,6 +109,7 @@ such a window, simply request the current video mode.
|
||||
@code
|
||||
const GLFWvidmode* mode = glfwGetVideoMode(monitor);
|
||||
|
||||
glfwWindowHint(GLFW_FULLSCREEN, GLFW_TRUE);
|
||||
glfwWindowHint(GLFW_RED_BITS, mode->redBits);
|
||||
glfwWindowHint(GLFW_GREEN_BITS, mode->greenBits);
|
||||
glfwWindowHint(GLFW_BLUE_BITS, mode->blueBits);
|
||||
@ -174,6 +192,9 @@ above other regular windows, also called topmost or always-on-top. This is
|
||||
intended primarily for debugging purposes and cannot be used to implement proper
|
||||
full screen windows. This hint is ignored for full screen windows.
|
||||
|
||||
`GLFW_FULLSCREEN` specifies whether the window will be created in fullscreen mode.
|
||||
The window can always be switched back to windowed mode using @ref glfwToggleWindowFullscreen.
|
||||
|
||||
|
||||
@subsubsection window_hints_fb Framebuffer related hints
|
||||
|
||||
@ -304,6 +325,7 @@ Window hint | Default value | Supported values
|
||||
`GLFW_FOCUSED` | `GLFW_TRUE` | `GLFW_TRUE` or `GLFW_FALSE`
|
||||
`GLFW_AUTO_ICONIFY` | `GLFW_TRUE` | `GLFW_TRUE` or `GLFW_FALSE`
|
||||
`GLFW_FLOATING` | `GLFW_FALSE` | `GLFW_TRUE` or `GLFW_FALSE`
|
||||
`GLFW_FULLSCREEN` | `GLFW_FALSE` | `GLFW_TRUE` or `GLFW_FALSE`
|
||||
`GLFW_RED_BITS` | 8 | 0 to `INT_MAX` or `GLFW_DONT_CARE`
|
||||
`GLFW_GREEN_BITS` | 8 | 0 to `INT_MAX` or `GLFW_DONT_CARE`
|
||||
`GLFW_BLUE_BITS` | 8 | 0 to `INT_MAX` or `GLFW_DONT_CARE`
|
||||
@ -599,8 +621,9 @@ GLFWmonitor* monitor = glfwGetWindowMonitor(window);
|
||||
|
||||
This monitor handle is one of those returned by @ref glfwGetMonitors.
|
||||
|
||||
For windowed mode windows, this function returns `NULL`. This is the
|
||||
recommended way to tell full screen windows from windowed mode windows.
|
||||
For windowed mode windows, this function returns the monitor that will be used
|
||||
if the mode would be switched to fullscreen. Using this function to query the mode
|
||||
of the window will no longer work and @glfwGetWindowAttrib should be used instead.
|
||||
|
||||
|
||||
@subsection window_iconify Window iconification
|
||||
@ -663,7 +686,8 @@ glfwHideWindow(window);
|
||||
|
||||
This makes the window completely invisible to the user, including removing it
|
||||
from the task bar, dock or window list. Full screen windows cannot be hidden
|
||||
and calling @ref glfwHideWindow on a full screen window does nothing.
|
||||
and calling @ref glfwHideWindow on a full screen window does nothing. The window
|
||||
should be switched to windowed mode first and then hidden.
|
||||
|
||||
Hidden windows can be shown with @ref glfwShowWindow.
|
||||
|
||||
|
@ -1571,11 +1571,12 @@ GLFWAPI void glfwWindowHint(int target, int hint);
|
||||
* of the created window, framebuffer and context, see @ref
|
||||
* glfwGetWindowAttrib, @ref glfwGetWindowSize and @ref glfwGetFramebufferSize.
|
||||
*
|
||||
* To create a full screen window, you need to specify the monitor the window
|
||||
* will cover. If no monitor is specified, windowed mode will be used. Unless
|
||||
* you have a way for the user to choose a specific monitor, it is recommended
|
||||
* that you pick the primary monitor. For more information on how to query
|
||||
* connected monitors, see @ref monitor_monitors.
|
||||
* To create a full screen window, you can use the GLFW_FULLSCREEN window hint.
|
||||
* It is also possible to specify which monitor the window should use. If no
|
||||
* monitor is specified, the primary monitor is used. Unless you have a way for
|
||||
* the user to choose a specific monitor, it is recommended that you pick the
|
||||
* primary monitor. For more information on how to query connected monitors,
|
||||
* see @ref monitor_monitors.
|
||||
*
|
||||
* For full screen windows, the specified size becomes the resolution of the
|
||||
* window's _desired video mode_. As long as a full screen window has input
|
||||
@ -1606,7 +1607,7 @@ GLFWAPI void glfwWindowHint(int target, int hint);
|
||||
* This must be greater than zero.
|
||||
* @param[in] title The initial, UTF-8 encoded window title.
|
||||
* @param[in] monitor The monitor to use for full screen mode, or `NULL` to use
|
||||
* windowed mode.
|
||||
* the primary monitor.
|
||||
* @param[in] share The window whose context to share resources with, or `NULL`
|
||||
* to not share resources.
|
||||
* @return The handle of the created window, or `NULL` if an
|
||||
@ -2108,7 +2109,7 @@ GLFWAPI void glfwHideWindow(GLFWwindow* window);
|
||||
* in windowed mode. If the window is already in fullscreen mode, the fuctions restores
|
||||
* the monitor video mode and the specified window switches back to windowed mode.
|
||||
*
|
||||
* @param[in] window The window to toggle his mode.
|
||||
* @param[in] window The window to toggle the mode on.
|
||||
*
|
||||
* @ingroup window
|
||||
*/
|
||||
|
@ -249,7 +249,6 @@ void glfwDefaultWindowHints(void)
|
||||
_glfw.hints.window.decorated = GLFW_TRUE;
|
||||
_glfw.hints.window.focused = GLFW_TRUE;
|
||||
_glfw.hints.window.autoIconify = GLFW_TRUE;
|
||||
_glfw.hints.window.fullscreen = GLFW_FALSE;
|
||||
|
||||
// The default is 24 bits of color, 24 bits of depth and 8 bits of stencil,
|
||||
// double buffered
|
||||
@ -572,7 +571,7 @@ GLFWAPI void glfwShowWindow(GLFWwindow* handle)
|
||||
_GLFW_REQUIRE_INIT();
|
||||
|
||||
if (window->fullscreen)
|
||||
_glfwPlatformToggleWindowFullscreen(window);
|
||||
return;
|
||||
|
||||
_glfwPlatformShowWindow(window);
|
||||
}
|
||||
@ -584,7 +583,7 @@ GLFWAPI void glfwHideWindow(GLFWwindow* handle)
|
||||
_GLFW_REQUIRE_INIT();
|
||||
|
||||
if (window->fullscreen)
|
||||
_glfwPlatformToggleWindowFullscreen(window);
|
||||
return;
|
||||
|
||||
_glfwPlatformHideWindow(window);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user