SDL_GetWindowDisplayScale(3)
π SDL_GetWindowDisplayScale π
okay bestie, welcome to the manual page for SDL_GetWindowDisplayScale, part of the SDL3 functions fam (that's SDL3 FUNCTIONS to the people who care about the formalities β¨). We're getting the content display scale relative to a window's pixel size, and honestly? it's giving main character energy.
β¨ NAME β¨
SDL_GetWindowDisplayScale β get the content display scale relative to a window's pixel size π¦
πΈ SYNOPSIS πΈ
#include <SDL3/SDL_video.h>
float SDL_GetWindowDisplayScale(SDL_Window *window);
π DESCRIPTION π
So this value is literally a combo meal of two things: the window pixel density and the display content scale. And that combo is the expected scale for displaying content in this window. It's the vibe check for how big your stuff should be π«Ά
Like, example time, because numbers make everything real. Say you've got a 3840x2160 window and its display scale is 2.0. The user expects the content to take twice as many pixels and still be the exact same physical size as if it were being displayed in a 1920x1080 window with a display scale of 1.0. No cap, that's the whole point β more pixels, same size on your actual eyeballs π
Conceptually, this value corresponds to the scale display setting, and it gets updated when:
- that setting is changed π
- or the window moves to a display with a different scale setting π₯οΈ β‘οΈ π₯οΈ
So it stays fresh. It's not stale, it's iconic.
π FUNCTION PARAMETERS π
windowβ the window to query. That's it, that's the whole parameter, she's low maintenance π
β RETURN VALUE β
Returns the display scale, or 0.0f on failure π β and if that happens, call SDL_GetError() for more information, because you deserve to know what went wrong bestie.
π§ THREAD SAFETY π§
This function should only be called on the main thread. Not me catching you trying to call it from a worker thread π Don't. Main thread only. Periodt.
π AVAILABILITY π
This function is available since SDL 3.2.0 β¨
and that's the whole page, bestie!! π brought to you by Simple Directmedia Layer, version SDL 3.4.18 β go forth and scale responsibly, mwah ππ
π¦ where this page comes from
- fedora 43: SDL3-devel 3.4.18-1.fc43 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 43: SDL3-devel 3.4.18-1.fc43 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 44: SDL3-devel 3.4.18-1.fc44 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 44: SDL3-devel 3.4.18-1.fc44 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms