sdlxGetWindowSize function video

({int h, int w})? sdlxGetWindowSize(
  1. Pointer<SdlWindow> window
)

Get the size of a window's client area.

The window pixel size may differ from its window coordinate size if the window is on a high pixel density display. Use SDL_GetWindowSizeInPixels() or SDL_GetRenderOutputSize() to get the real client area size in pixels.

\param window the window to query the width and height from. \param w a pointer filled in with the width of the window, may be NULL. \param h a pointer filled in with the height 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_GetRenderOutputSize \sa SDL_GetWindowSizeInPixels \sa SDL_SetWindowSize \sa SDL_EVENT_WINDOW_RESIZED

extern SDL_DECLSPEC bool SDLCALL SDL_GetWindowSize(SDL_Window *window, int *w, int *h)

See also:

Implementation

({int w, int h})? sdlxGetWindowSize(Pointer<SdlWindow> window) {
  var result = false;
  var w = 0;
  var h = 0;
  final wPointer = calloc<Int32>();
  final hPointer = calloc<Int32>();
  result = sdlGetWindowSize(window, wPointer, hPointer);
  if (result) {
    w = wPointer.value;
    h = hPointer.value;
  }
  wPointer.callocFree();
  hPointer.callocFree();
  if (!result) {
    return null;
  }
  return (w: w, h: h);
}