sdlHasRectIntersection function

bool sdlHasRectIntersection(
  1. Pointer<SdlRect> a,
  2. Pointer<SdlRect> b
)

Determine whether two rectangles intersect.

If either pointer is NULL the function will return false.

\param A an SDL_Rect structure representing the first rectangle. \param B an SDL_Rect structure representing the second rectangle. \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.1.3.

\sa SDL_GetRectIntersection

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

Implementation

bool sdlHasRectIntersection(Pointer<SdlRect> a, Pointer<SdlRect> b) {
  final sdlHasRectIntersectionLookupFunction = libSdl3.lookupFunction<
      Uint8 Function(Pointer<SdlRect> a, Pointer<SdlRect> b),
      int Function(
          Pointer<SdlRect> a, Pointer<SdlRect> b)>('SDL_HasRectIntersection');
  return sdlHasRectIntersectionLookupFunction(a, b) == 1;
}