sdlGetWindowAspectRatio function video

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

Get the aspect ratio 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.2.0.

\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 = _libSdl
      .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;
}