glfwSetWindowAspectRatio function

void glfwSetWindowAspectRatio(
  1. Pointer<GLFWwindow> window,
  2. int numer,
  3. int denom
)

! @brief 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.

@paramin window The window to set limits for. @paramin numer The numerator of the desired aspect ratio, or GLFW_DONT_CARE. @paramin denom 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

@since Added in version 3.2.

@ingroup window

GLFWAPI void glfwSetWindowAspectRatio(GLFWwindow* window, int numer, int denom)

Implementation

void glfwSetWindowAspectRatio(
    Pointer<GLFWwindow> window, int numer, int denom) {
  final glfwSetWindowAspectRatioLookupFunction = libglfw.lookupFunction<
      Void Function(Pointer<GLFWwindow> window, Int32 numer, Int32 denom),
      void Function(Pointer<GLFWwindow> window, int numer,
          int denom)>('glfwSetWindowAspectRatio');
  return glfwSetWindowAspectRatioLookupFunction(window, numer, denom);
}