SDL_GetRenderViewport(3)

πŸ’… SDL_GetRenderViewport β€” get the drawing area for the current target ✨

okay bestie, welcome to the SDL_GetRenderViewport(3) page from the SDL3 FUNCTIONS lineup πŸŽ€ no cap, it's a short one but it's lowkey iconic.


πŸ¦‹ SYNOPSIS

#include <SDL3/SDL_render.h>

bool SDL_GetRenderViewport(SDL_Renderer *renderer, SDL_Rect *rect);

🌸 DESCRIPTION

so every render target has its own viewport, right? like, its own lil personal drawing zone πŸ’– and this function right here gets you the viewport for the current render target. that's it. that's the whole vibe. the way it just hands you the drawing area, periodt.


✨ FUNCTION PARAMETERS

  • renderer β€” the rendering context. your main character, the one doing the rendering πŸ’…
  • rect β€” an SDL_Rect structure that gets filled in with the current drawing area. she comes back changed, she comes back filled in 🫢

πŸ‘‘ RETURN VALUE

returns true on success or false on failure β€” and if it fails, bestie, you call SDL_GetError() for more info. do not skip that step, i'm begging πŸ™ˆ


🧚 THREAD SAFETY

this function should only be called on the main thread. fr fr. no side-quest threads on this one 😭


⭐ AVAILABILITY

this function is available since SDL 3.2.0. so if you're on anything older... girl, upgrade 🌈


πŸ’œ SEE ALSO

iykyk πŸ‘‘


k bye, this page came to you from Simple Directmedia Layer, running SDL 3.4.18, and it's SDL_GetRenderViewport(3) β€” mwah, go set some viewports bestie πŸŽ€βœ¨

πŸ“¦ where this page comes from