SDL_GetRenderScale(3)

✨ SDL_GetRenderScale ✨

okay bestie, welcome to the SDL_GetRenderScale(3) page from the SDL3 FUNCTIONS squad πŸ’– lowkey one of the cutest little getters in the whole render API. let's get into it.


🌸 NAME 🌸

SDL_GetRenderScale β€” get the drawing scale for the current target. that's it. that's the whole job. iconic behavior honestly πŸ’…


πŸŽ€ SYNOPSIS πŸŽ€

#include <SDL3/SDL_render.h>

bool SDL_GetRenderScale(SDL_Renderer *renderer, float *scaleX, float *scaleY);

look at her. three params. returns a bool. no drama, no cap 🫢


πŸ¦‹ DESCRIPTION πŸ¦‹

okay so here's the tea: every single render target has its own scale. like, its own personal vibe. this function gets the scale for the current render target β€” nothing more, nothing less.

so whatever target you're currently drawing into? that's whose scale you're asking about. not some other target. the current one. periodt ✨


πŸ’œ FUNCTION PARAMETERS πŸ’œ

  • renderer β€” the rendering context. your main character 🎬
  • scaleX β€” a pointer that gets filled in with the horizontal scaling factor. left-to-right energy 🌈
  • scaleY β€” a pointer that gets filled in with the vertical scaling factor. up-and-down energy ⭐

πŸ‘‘ RETURN VALUE πŸ‘‘

returns true on success or false on failure β€” and if it fails, bestie, call SDL_GetError() for more information. she will tell you what went wrong, fr fr 😭


πŸ”₯ THREAD SAFETY πŸ”₯

this function should only be called on the main thread. do not be cute about it. do not try to sneak it onto a worker thread. main thread only, no exceptions, that's the rule πŸ™ˆ

🌟 AVAILABILITY 🌟

this function is available since SDL 3.2.0. she's not ancient, she's fresh πŸ’…


🧚 SEE ALSO 🧚

  • SDL_SetRenderScale(3) β€” the other half of the duo, the one who sets the scale. you'll wanna check her out too πŸŽ€

and that's the page!! mwah πŸ’–

cute lil sign-off: this is from Simple Directmedia Layer, the manual itself is at version SDL 3.4.18, and the page is SDL_GetRenderScale(3). go forth and scale responsibly, queen πŸ‘‘βœ¨
πŸ“¦ where this page comes from