SDL_UpdateRect(3)

πŸ’– SDL_UpdateRect(3) β€” the SDL API Reference glow-up ✨

okay bestie, so this one's from the SDL API Reference and it's giving "make my pixels show up" energy. let's get into it 🫢


🌸 NAME 🌸

SDL_UpdateRect β€” makes sure the given area is updated on the given screen. that's it, that's the whole job, and she does it flawlessly πŸ’…


✨ SYNOPSIS ✨

#include "SDL.h"

void SDL_UpdateRect(SDL_Surface *screen, Sint32 x, Sint32 y, Sint32 w,
Sint32 h);

like yes, she takes five args. we love a thorough queen πŸ‘‘


πŸŽ€ DESCRIPTION πŸŽ€

so basically, SDL_UpdateRect makes sure the given area is updated on the given screen. iconic. that's her main character moment.

⚠️ but listen, the rectangle must be confined within the screen boundaries β€” no clipping is done. not a single pixel gets trimmed for you. so don't come at her with a rectangle that's hanging off the edge, she will NOT be fixing that for you 😭

if x, y, w and h are all 0, then SDL_UpdateRect will update the entire screen. zeroes across the board = full-screen slay, no cap 🌈

🚫 and this part is important fr fr: this function should not be called while screen is locked. locked screen + update = do not. just don't. πŸ™ˆ

πŸ¦‹ SEE ALSO πŸ¦‹

  • SDL_UpdateRects β€” the plural version, she does many at once πŸ’–
  • SDL_Rect β€” the rectangle struct of your dreams
  • SDL_Surface β€” the screen/thing you're drawing on
  • SDL_LockSurface β€” the lock in question. remember the warning above bestie, iykyk πŸ”’

and that's the whole page, periodt. πŸ’œ this was pulled straight from the SDL API Reference, dated Tue 11 Sep 2001, 23:01 β€” a vintage queen, honestly, and she still ate. mwah πŸŽ€βœ¨πŸ’…

πŸ“¦ where this page comes from