SDL_GetRectEnclosingPoints(3)

πŸ’– SDL_GetRectEnclosingPoints πŸ’–

okay so bestie, welcome to SDL_GetRectEnclosingPoints(3) β€” it's a lil function from the SDL3 crew and it's literally just "draw me the smallest box that fits all these points" energy. no cap. she's giving bounding box, she's giving minimal rectangle, she's iconic. πŸŽ€


✨ SYNOPSIS ✨

#include <SDL3/SDL_rect.h>

bool SDL_GetRectEnclosingPoints(const SDL_Point *points, int count, const SDL_Rect *clip, SDL_Rect *result);

🌸 DESCRIPTION 🌸

So like, here's the tea πŸ“: if clip is not NULL, then only the points that are inside the clipping rectangle get considered. that's it, that's the whole vibe. everyone else gets left on read. πŸ’…


🫢 FUNCTION PARAMETERS 🫢

  • points β€” an array of SDL_Point structures, aka the lil guys you wanna enclose. the squad. the whole group chat. ✨
  • count β€” how many structures are chillin' in that points array. bestie needs a headcount, she doesn't do surprises.
  • clip β€” an SDL_Rect you use for clipping, or NULL if you want to enclose all the points, no filter, no gatekeeping, let everybody in. πŸ‘‘
  • result β€” an SDL_Rect structure that gets filled in with the minimal enclosing rectangle. she gets dressed up with your answer. cute. πŸ’–

🌈 RETURN VALUE 🌈

Returns true if any points were enclosed, or false if all the points were outside of the clipping rectangle β€” which is the sad path, the "nobody made it in" path, the 😭 path. fr fr.


🧚 THREAD SAFETY 🧚

It is safe to call this function from any thread. periodt. call her from wherever, she does not care, she is unbothered, she is thriving. πŸ¦‹


⭐ AVAILABILITY ⭐

This function is available since SDL 3.2.0. so if you're on something older, no she's not there yet, you gotta upgrade bestie. πŸ’€


mwah πŸ’‹ that's the whole page. go enclose some points, you got this.

this lil love letter came to you from Simple Directmedia Layer, living in SDL 3.4.18, and she answers to the name SDL_GetRectEnclosingPoints(3). 🌸

πŸ“¦ where this page comes from