SDL_ResizeEvent(3)

πŸ’– SDL_ResizeEvent(3) πŸ’–

okay bestie, welcome to the SDL API Reference ✨ this one's about the window-resize event structure, and it's genuinely so straightforward you're gonna eat it up πŸ“


🌸 NAME 🌸

SDL_ResizeEvent β€” the window resize event structure πŸͺŸβœ¨


🧚 STRUCTURE DEFINITION 🧚

here's the whole lil guy, no cap:

typedef struct{
  Uint8 type;
  int w, h;
} SDL_ResizeEvent;

literally three fields. iconic, honestly. πŸ‘‘


πŸŽ€ STRUCTURE DATA πŸŽ€

  • type β€” it's SDL_VIDEORESIZE πŸ’«
  • w, h β€” the new width and height of the window, respectively πŸ“

πŸ¦‹ DESCRIPTION πŸ¦‹

so SDL_ResizeEvent is a member of the SDL_Event union, and it's the one that shows up when an event of type SDL_VIDEORESIZE gets reported 🫢

the way it works: when you pass SDL_RESIZABLE as a flag to SDL_SetVideoMode, the user is allowed to resize the application's window πŸ‘€ and when they actually do resize it, an SDL_VIDEORESIZE gets reported, with the new window width and height values stored in w and h, respectively πŸ’…

and here's the part that matters, bestie β€” when you receive an SDL_VIDEORESIZE, the window should be resized to the new dimensions using SDL_SetVideoMode. don't just sit there with your new w and h doing nothing, that's not the vibe 😭

fr fr: you get the event, then you call SDL_SetVideoMode with the fresh dimensions. that's the whole loop. periodt. πŸ’–

🌈 SEE ALSO 🌈

  • SDL_Event
  • SDL_SetVideoMode

and that's the tea, bestie πŸ΅πŸ’œ this page came from the SDL library, dated Tue 11 Sep 2001, 22:59 β€” yeah, she's vintage, she's a classic, she's been serving resize events since the Y2K era and she still slays πŸ‘‘βœ¨ go resize something responsibly πŸͺŸπŸ’–

πŸ“¦ where this page comes from