SDL_GETRENDERLOGICALPRESENTATION(3)

πŸ’– SDL_GetRenderLogicalPresentation β€” the SDL3 FUNCTIONS manual page, bestie edition πŸ’–

okay so real talk, you're in the SDL3 FUNCTIONS corner of the manual and this little function is about to tell you how big your logical rendering canvas actually is. no cap. let's get into it πŸ¦‹


✨ NAME ✨

SDL_GetRenderLogicalPresentation β€” get the device independent resolution and presentation mode you're using for rendering. it's giving "read the receipts" energy, fr fr πŸ’…


✨ SYNOPSIS ✨

#include <SDL3/SDL_render.h>

bool SDL_GetRenderLogicalPresentation(SDL_Renderer *renderer, int *w, int *h, SDL_RendererLogicalPresentation *mode);

like, one line of C, four arguments, zero drama 🌸


✨ DESCRIPTION ✨

so the way this works: this function gets the width and height of the logical rendering output, or 0 if a logical resolution is not enabled. that's the whole vibe check right there 😭

and here's the part that's lowkey important: each render target has its own logical presentation state. so this function? it gets the state for the current render target. not all of them. the one you're on right now. main character energy only πŸ‘‘


✨ FUNCTION PARAMETERS ✨

  • renderer β€” the rendering context. you know, the whole operation πŸŽ€
  • w β€” an int filled with the logical presentation width.
  • h β€” an int filled with the logical presentation height.
  • mode β€” a variable filled with the logical presentation mode being used. so it literally hands you back which mode you're in, iconic πŸ’…

✨ RETURN VALUE ✨

Returns true on success or false on failure. and if it fails? call SDL_GetError() for more information, bestie. she'll tell you what went wrong 🫢


✨ THREAD SAFETY ✨

⚠️ okay listen. this function should only be called on the main thread. do not try to be cute and call it from a worker thread. i'm serious πŸ™ˆ

✨ AVAILABILITY ✨

this function is available since SDL 3.2.0. so if you're on anything older, sorry babe, no logical presentation for you πŸ’€


✨ SEE ALSO ✨


Simple Directmedia Layer Β· SDL 3.4.18 β€” that's the source and version, babes, and this lil page is SDL_GetRender...lPresentation(3). mwah, go render something cute πŸ’–βœ¨πŸŽ€

πŸ“¦ where this page comes from