SDL Wiki
(This is the documentation for SDL3, which is the current stable version. SDL2 was the previous version!)

SDL_GetWindowDisplayScale

Get the content display scale relative to a window's pixel size.

Header File

Defined in <SDL3/SDL_video.h>

Syntax

float SDL_GetWindowDisplayScale(SDL_Window *window);

Function Parameters

SDL_Window * window the window to query.

Return Value

(float) Returns the display scale, or 0.0f on failure; call SDL_GetError() for more information.

Remarks

This is a combination of the window pixel density and the display content scale, and is the expected scale for displaying content in this window. For example, if a 3840x2160 window had a display scale of 2.0, the user expects the content to take twice as many pixels and be the same physical size as if it were being displayed in a 1920x1080 window with a display scale of 1.0.

Conceptually this value corresponds to the scale display setting, and is updated when that setting is changed, or the window moves to a display with a different scale setting.

Version

This function is available since SDL 3.1.3.


CategoryAPI, CategoryAPIFunction, CategoryVideo


[ edit | delete | history | feedback | raw ]

[ front page | index | search | recent changes | git repo | offline html ]

All wiki content is licensed under Creative Commons Attribution 4.0 International (CC BY 4.0).
Wiki powered by ghwikipp.