SDL_HasRectIntersectionFloat(3)

๐Ÿ’– SDL_HasRectIntersectionFloat(3) ๐Ÿ’–

okay bestie, welcome to the SDL3 FUNCTIONS section of the manual, and today's main character is SDL_HasRectIntersectionFloat. yes she's a whole function. yes she's in the SDL3 manual. let's get into it ๐Ÿซถ


โœจ NAME โœจ

SDL_HasRectIntersectionFloat โ€” figure out whether two rectangles intersect, but like... with float precision. ๐Ÿ’…


๐ŸŒธ SYNOPSIS ๐ŸŒธ

#include <SDL3/SDL_rect.h>

bool SDL_HasRectIntersectionFloat(const SDL_FRect *A, const SDL_FRect *B);

๐Ÿฆ‹ DESCRIPTION ๐Ÿฆ‹

So the vibe check here is simple: you hand her two rectangles, she tells you if they overlap. that's it. that's the whole job. iconic, no notes โœจ

โš ๏ธ but bestie, listen: if either pointer is NULL, the function will return false. not an error, not a crash, just a chill little false. so don't come for her if you passed nothing. ๐Ÿ™ˆ

๐ŸŽ€ FUNCTION PARAMETERS ๐ŸŽ€

  • A โ€” an SDL_FRect structure representing the first rectangle. ๐Ÿ“
  • B โ€” an SDL_FRect structure representing the second rectangle. ๐Ÿ“

two rectangles. two pointers. one destiny. ๐Ÿ’ž


โญ RETURN VALUE โญ

  • Returns true if there is an intersection ๐Ÿ’ฅ
  • Returns false otherwise ๐ŸŒ™

that's the whole range, no secret third option, no "maybe", she does not do situationships. periodt. ๐Ÿ‘‘


๐Ÿงš THREAD SAFETY ๐Ÿงš

It is safe to call this function from any thread. ๐ŸŒˆ

literally any thread. go wild. thread it from the main thread, thread it from a worker, she does not care, she is unbothered and thriving. ๐Ÿ’œ


๐Ÿ‘‘ AVAILABILITY ๐Ÿ‘‘

this one is available since SDL 3.2.0. so if you're on something older, she's not there yet, and no amount of manifestation will summon her. ๐Ÿ”ฎ


๐Ÿ’€ SEE ALSO ๐Ÿ’€


Simple Directmedia Layer ยท SDL 3.4.18 โ€” and that's the whole page bestie, written in the SDL 3.4.18 era of the Simple Directmedia Layer manual, tysm for reading, go check if ur rects overlap, mwah ๐Ÿ’‹โœจ๐ŸŽ€

๐Ÿ“ฆ where this page comes from