glfwSetWindowAspectRatio

Sets the aspect ratio of the specified window.

This function sets the required aspect ratio of the content area of the specified window. If the window is full screen, the aspect ratio only takes effect once it is made windowed. If the window is not resizable, this function does nothing.

The aspect ratio is specified as a numerator and a denominator and both values must be greater than zero. For example, the common 16:9 aspect ratio is specified as 16 and 9, respectively.

If the numerator and denominator is set to GLFW_DONT_CARE then the aspect ratio limit is disabled.

The aspect ratio is applied immediately to a windowed mode window and may cause it to be resized.

extern (C) @nogc nothrow __gshared
void
glfwSetWindowAspectRatio

Parameters

window GLFWwindow*

The window to set limits for.

numer int

The numerator of the desired aspect ratio, or GLFW_DONT_CARE.

denom int

The denominator of the desired aspect ratio, or GLFW_DONT_CARE.

Errors: Possible errors include @ref GLFW_NOT_INITIALIZED, @ref GLFW_INVALID_VALUE and @ref GLFW_PLATFORM_ERROR.

@remark If you set size limits and an aspect ratio that conflict, the results are undefined.

@remark @wayland The aspect ratio will not be applied until the window is actually resized, either by the user or by the compositor.

Thread Safety

This function must only be called from the main thread.

@sa @ref window_sizelimits @sa @ref glfwSetWindowSizeLimits

Meta

Since

Added in version 3.2.

Ingroup: window