Documentation work

This commit is contained in:
Camilla Berglund 2015-10-19 16:01:42 +02:00
parent 42efd26698
commit af5b82acf5
2 changed files with 25 additions and 19 deletions

View File

@ -488,38 +488,45 @@ example if the window is dragged between a regular monitor and a high-DPI one.
@subsection window_sizelimits Window size limits @subsection window_sizelimits Window size limits
The minimum and maximum size of the client area of a windowed mode window can be The minimum and maximum size of the client area of a windowed mode window can be
set with @ref glfwSetWindowSizeLimits. The user may resize the window to any enforced with @ref glfwSetWindowSizeLimits. The user may resize the window to
size and aspect ratio within the specified limits, unless the aspect ratio is any size and aspect ratio within the specified limits, unless the aspect ratio
also set. is also set.
@code @code
glfwSetWindowSizeLimits(window, 200, 200, 400, 400); glfwSetWindowSizeLimits(window, 200, 200, 400, 400);
@endcode @endcode
To disable size limits for a window, set them to `GLFW_DONT_CARE`. To specify only a minimum size or only a maximum one, set the other pair to
`GLFW_DONT_CARE`.
@code @code
glfwSetWindowSizeLimits(window, GLFW_DONT_CARE, GLFW_DONT_CARE, GLFW_DONT_CARE, GLFW_DONT_CARE); glfwSetWindowSizeLimits(window, 640, 480, GLFW_DONT_CARE, GLFW_DONT_CARE);
@endcode @endcode
The aspect ratio of the client area of a windowed mode window can be set with To disable size limits for a window, set them all to `GLFW_DONT_CARE`.
@ref glfwSetWindowAspectRatio. The user may resize the window freely unless
size limits are also set, but the size will be constrained to maintain the
aspect ratio.
The aspect ratio is specified as a numerator and denominator, corresponding to The aspect ratio of the client area of a windowed mode window can be enforced
the width and height, respectively. with @ref glfwSetWindowAspectRatio. The user may resize the window freely
unless size limits are also set, but the size will be constrained to maintain
the aspect ratio.
@code @code
glfwSetWindowAspectRatio(window, 16, 9); glfwSetWindowAspectRatio(window, 16, 9);
@endcode @endcode
To disable aspect ratio for a window, set it to `GLFW_DONT_CARE`. The aspect ratio is specified as a numerator and denominator, corresponding to
the width and height, respectively. If you want a window to maintain its
current aspect ratio, simply use its current size as the ratio.
@code @code
glfwSetWindowAspectRatio(window, GLFW_DONT_CARE, GLFW_DONT_CARE); int width, height;
glfwGetWindowSize(window, &width, &height);
glfwSetWindowAspectRatio(window, width, height);
@endcode @endcode
To disable the aspect ratio limit for a window, set both terms to
`GLFW_DONT_CARE`.
You can have both size limits and aspect ratio set for a window, but the results You can have both size limits and aspect ratio set for a window, but the results
are undefined if they conflict. are undefined if they conflict.

View File

@ -1885,13 +1885,12 @@ GLFWAPI void glfwSetWindowSizeLimits(GLFWwindow* window, int minwidth, int minhe
* specified window. If the window is full screen or not resizable, this * specified window. If the window is full screen or not resizable, this
* function does nothing. * function does nothing.
* *
* The aspect ratio is specified as a numerator and a denominator. For * The aspect ratio is specified as a numerator and a denominator and both
* example, the common 16:9 aspect ratio is specified as 16 and 9, * values must be greater than zero. For example, the common 16:9 aspect ratio
* respectively. The denominator may not be zero. * is specified as 16 and 9, respectively.
* *
* If the numerator and denominator is set to `GLFW_DONT_CARE` then the window * If the numerator and denominator is set to `GLFW_DONT_CARE` then the aspect
* may be resized to any aspect ratio permitted by the window system and any * ratio limit is disabled.
* limits set by @ref glfwSetWindowSizeLimits.
* *
* The aspect ratio is applied immediately and may cause the window to be * The aspect ratio is applied immediately and may cause the window to be
* resized. * resized.