SDL_UpdateRects(3)
β¨ SDL_UpdateRects(3) β¨
okay bestie, we're in the SDL API Reference and this one is literally about pushing a whole list of rectangles to the screen π
πΈ NAME πΈ
SDL_UpdateRects β makes sure the given list of rectangles is updated on the given screen. yes, list, plural, we're doing a whole lil squad of rects π
π SYNOPSIS π
#include "SDL.h"
void SDL_UpdateRects(SDL_Surface *screen, int numrects, SDL_Rect
*rects);
copy it exactly like that, no cap π«Ά
π¦ DESCRIPTION π¦
So basically: this function makes sure the given list of rectangles is updated on the given screen. That's the whole job. It takes your little collection of rects and says "okay screen, catch these" β¨
BUT. Important. The rectangles must all be confined within the screen boundaries (no clipping is done). So if you go handing it a rect that hangs off the edge, it is not gonna be nice about it and trim it for you β no clipping, none, zero. You gotta keep them inside the screen yourself. Vibe check your coordinates first, fr fr π
Also: this function should not be called while screen is locked. Like, do not. That's a locked door, bestie, we don't go in there πͺπ
Note: It is adviced to call this function only once per frame, since each call has some processing overhead. This is no restriction since you can pass any number of rectangles each time. (so likeβ¦ one call, many rects, that's the move. efficiency queen behavior π) The rectangles are not automatically merged or checked for overlap. In general, the programmer can use his knowledge about his particular rectangles to merge them in an efficient way, to avoid overdraw. (SDL is not gonna do your homework for you here β you know your rects better than it does, so merge them smart and skip the overdraw πβ¨)
π SEE ALSO π
SDL_UpdateRectSDL_RectSDL_SurfaceSDL_LockSurface
go read those too, they're all part of the same friend group π«Ά
k bye ily, this page came from SDL and it's dated Tue 11 Sep 2001, 23:01 β vintage but iconic, and SDL_UpdateRects(3) is the name, slay π
πβ¨
π¦ where this page comes from
- debian bookworm: libsdl1.2-dev 1.2.15+dfsg2-8 Β· LGPL-2.1-or-later
- nixos 26.05: SDL_sixel 0-unstable-2016-02-06
- nixpkgs unstable: SDL_sixel 0-unstable-2016-02-06
- ubuntu jammy: libsdl1.2-dev 1.2.15+dfsg2-6 Β· LGPL-2.1-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms