glfwGetWindowContentScale function

void glfwGetWindowContentScale(
  1. Pointer<GLFWwindow> window,
  2. Pointer<Float> xscale,
  3. Pointer<Float> yscale
)

! @brief Retrieves the content scale for the specified window.

This function retrieves the content scale for the specified window. The content scale is the ratio between the current DPI and the platform's default DPI. This is especially important for text and any UI elements. If the pixel dimensions of your UI scaled by this look appropriate on your machine then it should appear at a reasonable size on other machines regardless of their DPI and scaling settings. This relies on the system DPI and scaling settings being somewhat correct.

On systems where each monitors can have its own content scale, the window content scale will depend on which monitor the system considers the window to be on.

@paramin window The window to query. @paramout xscale Where to store the x-axis content scale, or NULL. @paramout yscale Where to store the y-axis content scale, or NULL.

@errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref GLFW_PLATFORM_ERROR.

@thread_safety This function must only be called from the main thread.

@sa @ref window_scale @sa @ref glfwSetWindowContentScaleCallback @sa @ref glfwGetMonitorContentScale

@since Added in version 3.3.

@ingroup window

GLFWAPI void glfwGetWindowContentScale(GLFWwindow* window, float* xscale, float* yscale)

Implementation

void glfwGetWindowContentScale(
    Pointer<GLFWwindow> window, Pointer<Float> xscale, Pointer<Float> yscale) {
  final glfwGetWindowContentScaleLookupFunction = libglfw.lookupFunction<
      Void Function(Pointer<GLFWwindow> window, Pointer<Float> xscale,
          Pointer<Float> yscale),
      void Function(Pointer<GLFWwindow> window, Pointer<Float> xscale,
          Pointer<Float> yscale)>('glfwGetWindowContentScale');
  return glfwGetWindowContentScaleLookupFunction(window, xscale, yscale);
}