SDL_RenderFillRects(3)

πŸ’– SDL_RenderFillRects(3) πŸ’–

okay so bestie, welcome to the SDL3 FUNCTIONS corner of the internet πŸŽ€ pull up a chair, we're talking about SDL_RenderFillRects(3) and honestly? it's giving efficiency queen πŸ‘‘


✨ NAME ✨

SDL_RenderFillRects β€” fill some number of rectangles on the current rendering target with the drawing color at subpixel precision πŸ’…

like. MULTIPLE rects. ONE call. the way that she just does that 😭


🌸 SYNOPSIS 🌸

#include <SDL3/SDL_render.h>

bool SDL_RenderFillRects(SDL_Renderer *renderer, const SDL_FRect *rects, int count);

that's it. that's the whole vibe. one line, infinite rectangles ✨


πŸ¦‹ FUNCTION PARAMETERS πŸ¦‹

  • renderer β€” the renderer which should fill multiple rectangles. yes bestie, THE renderer, the one you made, the main character of your whole rendering situation πŸ‘‘
  • rects β€” a pointer to an array of destination rectangles. an ARRAY. as in more than one. as in we're doing this in bulk, no cap πŸ“¦
  • count β€” the number of rectangles. she needs to know how many. tell her how many. don't leave her guessing πŸ™ˆ

⭐ RETURN VALUE ⭐

Returns true on success or false on failure β€” and if it's a false girlie, you gotta call SDL_GetError() for more information πŸ” lowkey mandatory, not optional, do it.

ngl if you get false and just move on with your life, the error message is still sitting there waiting for you. just check it. please. for me 🫢

🧚 THREAD SAFETY 🧚

This function should only be called on the main thread. MAIN THREAD ONLY. periodt πŸ’€ do not be out here calling this from a worker thread and then acting surprised when the universe gets weird. she's monogamous, she's main-thread-only, respect the boundary πŸ’–


🌈 AVAILABILITY 🌈

This function is available since SDL 3.2.0 β€” so if you're on anything older, bestie, this one is not for you, and that's simply the tea β˜•


πŸ‘‘ SEE ALSO πŸ‘‘

  • SDL_RenderFillRect(3) β€” the single-rect little sister πŸŽ€ same energy, one rectangle, still iconic

πŸ’œ the sign-off πŸ’œ

this lil page came to you courtesy of the Simple Directmedia Layer girlies, straight out of SDL 3.4.18 🫢 go fill some rectangles, you're doing amazing, and remember: subpixel precision means she's precise AND she's got range πŸ’…βœ¨ bye bestie πŸ’–

πŸ“¦ where this page comes from