Created
March 19, 2023 18:15
-
-
Save slouken/146fda70e9c919422c70731378ef882d to your computer and use it in GitHub Desktop.
SDL 3.0 - Get desktop UI scale
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
float scale = 1.0f; | |
SDL_DisplayID display = SDL_GetDisplayForWindow(window); | |
const SDL_DisplayMode *mode = SDL_GetDesktopDisplayMode(display); | |
if (mode) { | |
scale = mode->display_scale; | |
} | |
SDL_Log("Window content scale: %d%%\n", (int)(scale * 100.0f)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment