SDL_Rect(3)

✨ SDL_Rect(3) ✨

okay bestie, welcome to the SDL API Reference πŸ’– this one's short and sweet, it's literally just a lil rectangle, and yet she's everywhere in SDL. iykyk.


🌸 NAME 🌸

SDL_Rect β€” defines a rectangular area πŸŽ€


🧚 STRUCTURE DEFINITION 🧚

here's the whole entire girl, no cap:

typedef struct{
  Sint16 x, y;
  Uint16 w, h;
} SDL_Rect;

look at her. four fields. perfect. iconic. πŸ‘‘


πŸ¦‹ STRUCTURE DATA πŸ¦‹

  • x, y β€” the position of the upper-left corner of the rectangle πŸ“ like where does she start, top-left energy, main character origin point.
  • w, h β€” the width and height of the rectangle πŸ“ how big she is, how much room she takes up, periodt.

πŸ’… DESCRIPTION πŸ’…

so an SDL_Rect defines a rectangular area of pixels. that's it, that's the vibe ✨

and the way that she's used EVERYWHERE?? she's the one who tells SDL_BlitSurface which blitting regions to work with 🫢 and several other video functions are obsessed with her too. lowkey the backbone of the whole video pipeline, fr fr πŸ’€


πŸ‘‘ SEE ALSO πŸ‘‘

  • SDL_BlitSurface
  • SDL_UpdateRect

go read those next bestie, they're the ones who actually put her to work 🌈


and that's the whole page!! 🌸 this came to you from SDL, dated Tue 11 Sep 2001, 23:01 πŸŽ€ ty for reading, mwah, slay, go draw some rectangles πŸ’œ

πŸ“¦ where this page comes from