sdlGetRectIntersection function rect

bool sdlGetRectIntersection(
  1. Pointer<SdlRect> a,
  2. Pointer<SdlRect> b,
  3. Pointer<SdlRect> result
)

Calculate the intersection of two rectangles.

If result is NULL then this function will return false.

\param A an SDL_Rect structure representing the first rectangle. \param B an SDL_Rect structure representing the second rectangle. \param result an SDL_Rect structure filled in with the intersection of rectangles A and B. \returns true if there is an intersection, false otherwise.

\threadsafety It is safe to call this function from any thread.

\since This function is available since SDL 3.2.0.

\sa SDL_HasRectIntersection

extern SDL_DECLSPEC bool SDLCALL SDL_GetRectIntersection(const SDL_Rect *A, const SDL_Rect *B, SDL_Rect *result)

Implementation

bool sdlGetRectIntersection(
  Pointer<SdlRect> a,
  Pointer<SdlRect> b,
  Pointer<SdlRect> result,
) {
  final sdlGetRectIntersectionLookupFunction = _libSdl
      .lookupFunction<
        Uint8 Function(
          Pointer<SdlRect> a,
          Pointer<SdlRect> b,
          Pointer<SdlRect> result,
        ),
        int Function(
          Pointer<SdlRect> a,
          Pointer<SdlRect> b,
          Pointer<SdlRect> result,
        )
      >('SDL_GetRectIntersection');
  return sdlGetRectIntersectionLookupFunction(a, b, result) == 1;
}