SDL_RectsEqual(3)

πŸ’– SDL_RectsEqual(3) πŸ’–

okay bestie, welcome to the SDL3 FUNCTIONS section of the manual, and today's main character is SDL_RectsEqual β€” the little header function that tells you whether two rectangles are, like, the same rectangle. πŸ¦‹


✨ NAME ✨

SDL_RectsEqual β€” figure out whether two rectangles are equal, no cap. πŸŽ€


✨ SYNOPSIS ✨

#include <SDL3/SDL_rect.h>

SDL_FORCE_INLINE bool SDL_RectsEqual(const SDL_Rect *a, const SDL_Rect *b);

✨ DESCRIPTION ✨

so here's the vibe check: two rectangles count as equal only if both of them are not NULL and each of their x, y, width and height all match. every single one. all four. no skipping. πŸ’…

⚠️ now the important part, bestie, listen up: this is a forced-inline function in a header, not a public API function that lives in the SDL library. which is to say β€” the code gets embedded straight into the calling program, and the linker and the dynamic loader will not be able to find this function inside SDL itself. it's giving "I live in your code now". 😭 so don't go looking for it in the library, she's not there, she's already home. 🫢

✨ FUNCTION PARAMETERS ✨

  • a β€” the first rectangle you wanna test. πŸ“
  • b β€” the second rectangle you wanna test. 🌸

✨ RETURN VALUE ✨

returns true if the rectangles are equal, and false otherwise. that's it, that's the whole answer. ⭐


✨ THREAD SAFETY ✨

it is safe to call this function from any thread. go off, parallel besties. 🧚


✨ AVAILABILITY ✨

this function has been available since SDL 3.2.0. so if you're on anything older… girl. πŸ‘‘


and that's the whole page, periodt. πŸ’œ

signing off from the Simple Directmedia Layer, running SDL 3.4.18 β€” stay iconic, keep your rects equal, and don't forget to check for NULL. mwah. πŸ’–βœ¨πŸŽ€

πŸ“¦ where this page comes from