Scroll to navigation

SDL_GetClosestFullscreenDisplayMode(3) SDL3 FUNCTIONS SDL_GetClosestFullscreenDisplayMode(3)

NAME

SDL_GetClosestFullscreenDisplayMode - Get the closest match to the requested display mode.

SYNOPSIS

#include "SDL3/SDL.h"
const SDL_DisplayMode* SDL_GetClosestFullscreenDisplayMode(SDL_DisplayID displayID, int w, int h, float refresh_rate, SDL_bool include_high_density_modes);

DESCRIPTION

The available display modes are scanned and closest is filled in with the closest mode matching the requested mode and returned. The mode format and refresh rate default to the desktop mode if they are set to 0. The modes are scanned with size being first priority, format being second priority, and finally checking the refresh rate. If all the available modes are too small, then NULL is returned.

FUNCTION PARAMETERS

the instance ID of the display to query
the width in pixels of the desired display mode
the height in pixels of the desired display mode
the refresh rate of the desired display mode, or 0.0f for the desktop refresh rate
Boolean to include high density modes in the search

RETURN VALUE

Returns a pointer to the closest display mode equal to or larger than the desired mode, or NULL on error; call SDL_GetError () for more information.

AVAILABILITY

This function is available since SDL 3.0.0.

SEE ALSO

SDL_GetDisplays(3), SDL_GetFullscreenDisplayModes(3)

SDL 3.1.0 SDL