SDL_PointInRectFloat(3)
π SDL_PointInRectFloat(3) π
okay bestie, welcome to the SDL3 FUNCTIONS corner of the group chat β today we're learning SDL_PointInRectFloat, and honestly? it's giving "tiny function, big main character energy." π
β¨ NAME β¨
SDL_PointInRectFloat β determine whether a point resides inside a floating point rectangle. π¦
πΈ SYNOPSIS πΈ
#include <SDL3/SDL_rect.h>
SDL_FORCE_INLINE bool SDL_PointInRectFloat(const SDL_FPoint *p, const SDL_FRect *r);
π DESCRIPTION π
so here's the tea β β a point counts as part of a rectangle if both p and r are not NULL, and p's x and y coordinates are >= the rectangle's top left corner, and <= the rectangle's x+w and y+h.
basically the rectangle is inclusive at the edges, no gatekeeping π. so a 1x1 rectangle considers point (0,0) and (0,1) as "inside" and (0,2) as not. not me double-checking the math three times bestie, it's fr fr correct.
π«Ά heads up: this is a forced-inline function in a header, and not a public API function available in the SDL library. which is to say β the code is embedded in the calling program, and the linker and dynamic loader will not be able to find this function inside SDL itself. it's a header girlie, she lives in your code, not in the library. periodt. π
π FUNCTION PARAMETERS π
pβ the point to test. πrβ the rectangle to test. π¦
β RETURN VALUE β
returns true if p is contained by r, false otherwise. simple as that, no cap. β¨
π THREAD SAFETY π
it is safe to call this function from any thread. go off, multithreaded queen π
π AVAILABILITY π
this function is available since SDL 3.2.0. iconic since day one, lowkey. πΈ
and that's the whole vibe check, bestie β this page came to you straight from Simple Directmedia Layer, rockin' SDL 3.4.18, in the SDL_PointInRectFloat(3) era. stay floaty, stay inside the rect πβ¨ππ¦
π¦ 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