SDL_UpdateWindowSurfaceRects(3)
π SDL_UpdateWindowSurfaceRects(3) π
okay bestie, welcome to the SDL3 FUNCTIONS corner of the manual, where we're talking about SDL_UpdateWindowSurfaceRects β the lil glow-up function that copies areas of the window surface to the screen. no cap. β¨
πΈ NAME πΈ
SDL_UpdateWindowSurfaceRects β copy areas of the window surface to the screen. it's giving "tell the screen what changed, but only the bits you care about." π
π¦ SYNOPSIS π¦
#include <SDL3/SDL_video.h>
bool SDL_UpdateWindowSurfaceRects(SDL_Window *window, const SDL_Rect *rects, int numrects);
β¨ DESCRIPTION β¨
so like, this is the function you reach for when you've changed portions of the surface and you want those changes to actually show up on the screen. that's the whole vibe. π
fun fact: this function is equivalent to the SDL 1.2 API SDL_UpdateRects(). the legacy icon. π
β οΈ okay important thing, no skipping: this function will update _at least_ the rectangles you specify. but pls pls pls understand that's only intended as an optimization β in practice it might update more of the screen (or literally all of the screen!! π) depending on what method SDL uses to send pixels to the system. so it's a "at least" situation, never a "exactly this much" situation. iykyk.
π FUNCTION PARAMETERS π
windowβ the window to update. that's your main character. πͺrectsβ an array ofSDL_Rectstructures representing areas of the surface to copy, in pixels. yes bestie, in pixels, don't forget. πnumrectsβ the number of rectangles. count 'em. π’
π RETURN VALUE π
returns true on success or false on failure. and if it fails? call SDL_GetError() for more information β she will tell you what went wrong, fr fr. π
π§ THREAD SAFETY π§
this function should only be called on the main thread. do not try to be cute and call it from a side thread, it's not that girl. π«π§΅
β AVAILABILITY β
this function is available since SDL 3.2.0. so if you're on something older... it's giving nothing, sorry. π
π«Ά SEE ALSO π«Ά
go read those too, they're iconic in their own right. π₯
Simple Directmedia Layer β SDL 3.4.18 π¦ that's the source and the version, and this page was dated alongside SDL_UpdateWindowSurfaceRects(3). mwah, love u, go update some rects responsibly πβ¨π
π¦ where this page comes from
- fedora 43: SDL3-devel 3.4.18-1.fc43 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 43: SDL3-devel 3.4.18-1.fc43 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 44: SDL3-devel 3.4.18-1.fc44 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 44: SDL3-devel 3.4.18-1.fc44 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms