SDL_GetWindowPixelDensity(3)

SDL_GetWindowPixelDensity3

Get the pixel density of a window.

Usage

#include "SDL3/SDL.h"

float SDL_GetWindowPixelDensity(SDL_Window *window);

Header file

Defined in SDL3/SDL_video.h

Overview

This is a ratio of pixel size to window size. For example, if the window is 1920x1080 and it has a high density back buffer of 3840x2160 pixels, it would have a pixel density of 2.0.

Function parameters

window

the window to query.

Return value

Returns the pixel density 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.

From libsdl3-doc 3.2.10+ds-1 in Debian 13 (Trixie). Parsed by carta from the page's man source.