sdlGetWindowAspectRatio function

bool sdlGetWindowAspectRatio(
  1. Pointer<SdlWindow> window,
  2. Pointer<Float> minAspect,
  3. Pointer<Float> maxAspect
)

Get the size of a window's client area.

\param window the window to query the width and height from. \param min_aspect a pointer filled in with the minimum aspect ratio of the window, may be NULL. \param max_aspect a pointer filled in with the maximum aspect ratio of the window, may be NULL. \returns true on success or false on failure; call SDL_GetError() for more information.

\threadsafety This function should only be called on the main thread.

\since This function is available since SDL 3.1.3.

\sa SDL_SetWindowAspectRatio

extern SDL_DECLSPEC bool SDLCALL SDL_GetWindowAspectRatio(SDL_Window *window, float *min_aspect, float *max_aspect)

Implementation

bool sdlGetWindowAspectRatio(Pointer<SdlWindow> window,
    Pointer<Float> minAspect, Pointer<Float> maxAspect) {
  final sdlGetWindowAspectRatioLookupFunction = libSdl3.lookupFunction<
      Uint8 Function(Pointer<SdlWindow> window, Pointer<Float> minAspect,
          Pointer<Float> maxAspect),
      int Function(Pointer<SdlWindow> window, Pointer<Float> minAspect,
          Pointer<Float> maxAspect)>('SDL_GetWindowAspectRatio');
  return sdlGetWindowAspectRatioLookupFunction(window, minAspect, maxAspect) ==
      1;
}