SDL_GetRectIntersection(3)
β¨ SDL_GetRectIntersection β¨
okay bestie, welcome to the SDL3 FUNCTIONS corner of the manual, page SDL_GetRectIntersection(3) π
πΈ NAME πΈ
SDL_GetRectIntersection β Calculate the intersection of two rectangles. that's it, that's the whole job, and she does it flawlessly π
π SYNOPSIS π
#include <SDL3/SDL_rect.h>
bool SDL_GetRectIntersection(const SDL_Rect *A, const SDL_Rect *B, SDL_Rect *result);
π¦ DESCRIPTION π¦
so here's the tea, bestie: you hand her two rectangles and she figures out where they overlap and drops that overlap into result. iconic behavior honestly.
BUT β and this is the important part β if result is NULL, then this function will return false. no result to fill, no vibes to give. she's not about to write into the void, periodt.
π FUNCTION PARAMETERS π
Aβ anSDL_Rectstructure representing the first rectangle. the first bestie π«ΆBβ anSDL_Rectstructure representing the second rectangle. the other bestie π«Άresultβ anSDL_Rectstructure filled in with the intersection of rectanglesAandB. this is where the magic lands β¨
π RETURN VALUE π
Returns true if there is an intersection, false otherwise. so like... did they overlap or not. yes or no. slay or not slay. that's the whole answer π
π THREAD SAFETY π
It is safe to call this function from any thread. she's polyamorous with threads and she's thriving π no locks, no drama, no gatekeeping.
β AVAILABILITY β
This function is available since SDL 3.2.0. if you're on anything older she simply does not exist yet, sorry babe π
π₯ SEE ALSO π₯
SDL_HasRectIntersection(3)β the girl who just tells you whether they overlap without giving you the receipts. sometimes that's all you need, iykyk π
and that's the whole page bestie, no cap, you're now certified in rectangle intersection πβ¨
this page came from the Simple Directmedia Layer source, running SDL 3.4.18 β sending you off with love from the SDL3 FUNCTIONS section, mwah ππ¦πΈ
π¦ where this page comes from
- fedora 43: SDL3-devel 3.4.18-1.fc43 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 43: SDL3-devel 3.4.18-1.fc43 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 44: SDL3-devel 3.4.18-1.fc44 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 44: SDL3-devel 3.4.18-1.fc44 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms