sdlxGetDisplayForRect function video

int sdlxGetDisplayForRect(
  1. SdlxRect rect
)

Get the display primarily containing a rect.

\param rect the rect to query. \returns the instance ID of the display entirely containing the rect or closest to the center of the rect on success or 0 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_GetDisplayBounds \sa SDL_GetDisplays

extern SDL_DECLSPEC SDL_DisplayID SDLCALL SDL_GetDisplayForRect(const SDL_Rect *rect)

Implementation

int sdlxGetDisplayForRect(SdlxRect rect) {
  final rectPointer = calloc<SdlRect>();
  rectPointer.ref
    ..x = rect.x
    ..y = rect.y
    ..w = rect.w
    ..h = rect.h;
  final result = sdlGetDisplayForRect(rectPointer);
  rectPointer.callocFree();
  return result;
}