SDL_RectToFRect(3)

πŸ’– SDL_RectToFRect(3) πŸ’–

okay so bestie, welcome to another episode of SDL3 FUNCTIONS that you're gonna wanna know about. This one is SDL_RectToFRect and it's literally exactly what it sounds like β€” it's giving glow-up for your rectangles. πŸ¦‹


✨ NAME ✨

SDL_RectToFRect β€” Convert an SDL_Rect to SDL_FRect πŸ’…


✨ SYNOPSIS ✨

#include <SDL3/SDL_rect.h>

SDL_FORCE_INLINE void SDL_RectToFRect(const SDL_Rect *rect, SDL_FRect *frect);

✨ FUNCTION PARAMETERS ✨

  • rect β€” a pointer to an SDL_Rect. πŸŽ€ That's your regular ol' integer rectangle, the one you're holding right now.
  • frect β€” a pointer filled in with the floating point representation of rect. 🌸 So this is where the glow-up lands. The function writes into it, it doesn't read from it. iykyk.

✨ THREAD SAFETY ✨

It is safe to call this function from any thread. No cap. Every thread, all at once, no drama, no locks, no nothing. πŸ‘‘


✨ AVAILABILITY ✨

This function is available since SDL 3.2.0. So if you're on something older, it's not you, it's your version. 😭


πŸ’€ real talk though: frect is a pointer filled in, so don't go passing an uninitialized or NULL pointer unless you want chaos. The manpage says what it says, and I'm just the messenger. 🫢

k bye bestie, go float some rects, you ate πŸ’…βœ¨

β€” written under the watch of Simple Directmedia Layer, SDL 3.4.18, in SDL_RectToFRect(3), periodt. πŸŽ€πŸŒˆ

πŸ“¦ where this page comes from