SDL_GetRenderOutputSize(3)

✨ SDL_GetRenderOutputSize ✨

okay bestie, welcome to the SDL3 FUNCTIONS section of the manual, and today we're getting the output size in pixels of a rendering context πŸ’…


🌸 NAME 🌸

SDL_GetRenderOutputSize β€” get the output size in pixels of a rendering context πŸŽ€


πŸ¦‹ SYNOPSIS πŸ¦‹

#include <SDL3/SDL_render.h>

bool SDL_GetRenderOutputSize(SDL_Renderer *renderer, int *w, int *h);

πŸ’– DESCRIPTION πŸ’–

So like, this one returns the true output size in pixels β€” and the way it does that is by ignoring any render targets, and ignoring logical size and presentation too. It's giving "just the raw pixels, no filter, no edits" ✨

But wait β€” if you actually want the output size of the current rendering target, with all the logical size adjustments baked in, then you want SDL_GetCurrentRenderOutputSize() instead. Different function, different vibe, iykyk 🫢


πŸŽ€ FUNCTION PARAMETERS πŸŽ€

  • renderer β€” the rendering context πŸ’œ
  • w β€” a pointer that gets filled in with the width in pixels.
  • h β€” a pointer that gets filled in with the height in pixels.

🌈 RETURN VALUE 🌈

Returns true on success or false on failure β€” and if it's a fail, call SDL_GetError() for more info, she'll tell you what went wrong 😭


πŸ‘‘ THREAD SAFETY πŸ‘‘

This function should only be called on the main thread. No side-quests, no background threads, main character energy only 🚫🧡

⭐ AVAILABILITY ⭐

This function is available since SDL 3.2.0 πŸ’«


πŸ¦„ SEE ALSO πŸ¦„


Simple Directmedia Layer β€’ SDL 3.4.18 β€’ SDL_GetRenderOutputSize(3)

and that's the whole page bestie, slay πŸ’…βœ¨ go get those pixels πŸ“πŸ¦‹πŸŽ€

πŸ“¦ where this page comes from