SDL_GetDisplayContentScale - Man Page

Get the content scale of a display.

Header File

Defined in SDL3/SDL_video.h

Synopsis

#include "SDL3/SDL.h"

float SDL_GetDisplayContentScale(SDL_DisplayID displayID);

Description

The content scale is the expected scale for content based on the DPI settings of the display. For example, a 4K display might have a 2.0 (200%) display scale, which means that the user expects UI elements to be twice as big on this display, to aid in readability.

After window creation,

SDL_GetWindowDisplayScale () should be used to query the content scale factor for individual windows instead of querying the display for a window and calling this function, as the per-window content scale factor may differ from the base value of the display it is on, particularly on high-DPI and/or multi-monitor desktop configurations.

Function Parameters

displayID

the instance ID of the display to query.

Return Value

Returns the content scale of the display, or 0.0f on failure; call

SDL_GetError () for more information.

Thread Safety

This function should only be called on the main thread.

Availability

This function is available since SDL 3.2.0.

See Also

·(3), SDL_GetWindowDisplayScale(3), ·(3), SDL_GetDisplays(3)

Info

SDL 3.2.2 Simple Directmedia Layer SDL3 FUNCTIONS