sdlIntersectRect function
Calculate the intersection of two rectangles.
If result
is NULL then this function will return SDL_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 SDL_TRUE if there is an intersection, SDL_FALSE otherwise.
\since This function is available since SDL 2.0.0.
\sa SDL_HasIntersection
extern DECLSPEC SDL_bool SDLCALL SDL_IntersectRect(const SDL_Rect * A, const SDL_Rect * B, SDL_Rect * result)
Implementation
bool sdlIntersectRect(
Pointer<SdlRect> a, Pointer<SdlRect> b, Pointer<SdlRect> result) {
final sdlIntersectRectLookupFunction = libSdl2.lookupFunction<
Int32 Function(
Pointer<SdlRect> a, Pointer<SdlRect> b, Pointer<SdlRect> result),
int Function(Pointer<SdlRect> a, Pointer<SdlRect> b,
Pointer<SdlRect> result)>('SDL_IntersectRect');
return sdlIntersectRectLookupFunction(a, b, result) == 1;
}