rolmodl
C++ API for the Simple Directmedia Library 2 (SDL2)
Functions
rolmodl::sys::display::mode::unsafe Namespace Reference

Unsafe display mode information functions. More...

Functions

unsigned int countForDisplayN (unsigned int n)
 Get the amount of display modes available for the nth display. More...
 
DisplayMode fromSDL_DisplayMode (const SDL_DisplayMode x)
 
DisplayMode desktopForDisplayN (unsigned int n)
 Get the display mode used by the system desktop for the nth display. Unsafe because there is no bounds checking on the index. More...
 
DisplayMode currentForDisplayN (unsigned int n)
 Get the current display mode for the nth display. Unsafe because there is no bounds checking on the index. More...
 
DisplayMode forDisplayNByIndexI (unsigned int n, unsigned int i)
 Get the ith display mode for the nth display. Unsafe because there is no bounds checking on either index. More...
 
DisplayMode closestForDisplayN (unsigned int n, const DisplayMode ideal)
 Get the display mode closest to the one specified for the nth display. Unsafe because there is no bounds checking on the index and because it will throw if no display is found. More...
 

Detailed Description

Unsafe display mode information functions.

Function Documentation

◆ countForDisplayN()

unsigned int rolmodl::sys::display::mode::unsafe::countForDisplayN ( unsigned int  n)

Get the amount of display modes available for the nth display.

Unsafe because there is no bounds checking on the index and because the return value is unreliable and may lead to out-of-bounds errors if its cached and used for loop iteration.

See also
https://wiki.libsdl.org/SDL_GetNumDisplayModes

Definition at line 284 of file Base.cpp.

References rolmodl::sys::display::unsafe::count(), and countForDisplayN().

Referenced by countForDisplayN(), and forDisplayNByIndexI().

◆ desktopForDisplayN()

DisplayMode rolmodl::sys::display::mode::unsafe::desktopForDisplayN ( unsigned int  n)

Get the display mode used by the system desktop for the nth display. Unsafe because there is no bounds checking on the index.

See also
https://wiki.libsdl.org/SDL_GetDesktopDisplayMode

Definition at line 304 of file Base.cpp.

References rolmodl::sys::display::unsafe::count(), desktopForDisplayN(), and rolmodl::detail::throwOnErr().

Referenced by desktopForDisplayN().

◆ currentForDisplayN()

DisplayMode rolmodl::sys::display::mode::unsafe::currentForDisplayN ( unsigned int  n)

Get the current display mode for the nth display. Unsafe because there is no bounds checking on the index.

See also
https://wiki.libsdl.org/SDL_GetCurrentDisplayMode

Definition at line 313 of file Base.cpp.

References rolmodl::sys::display::unsafe::count(), currentForDisplayN(), and rolmodl::detail::throwOnErr().

Referenced by currentForDisplayN().

◆ forDisplayNByIndexI()

DisplayMode rolmodl::sys::display::mode::unsafe::forDisplayNByIndexI ( unsigned int  n,
unsigned int  i 
)

Get the ith display mode for the nth display. Unsafe because there is no bounds checking on either index.

See also
https://wiki.libsdl.org/SDL_GetDisplayMode

Definition at line 322 of file Base.cpp.

References rolmodl::sys::display::unsafe::count(), countForDisplayN(), forDisplayNByIndexI(), and rolmodl::detail::throwOnErr().

Referenced by forDisplayNByIndexI().

◆ closestForDisplayN()

DisplayMode rolmodl::sys::display::mode::unsafe::closestForDisplayN ( unsigned int  n,
const DisplayMode  ideal 
)

Get the display mode closest to the one specified for the nth display. Unsafe because there is no bounds checking on the index and because it will throw if no display is found.

Pixel format and refresh rate default to the system desktop's display mode's if they are not set.

Todo:
: what does that equal in terms of pixelfmt::Id, the doc said it needs to be 0

Parameter priority for what is considered "closest": size, pixel format, refresh rate. If all available display modes are too small, returns nullptr

See also
https://wiki.libsdl.org/SDL_GetClosestDisplayMode

Definition at line 335 of file Base.cpp.

References closestForDisplayN(), rolmodl::sys::display::unsafe::count(), rolmodl::sys::DisplayMode::fmt, std::optional::has_value(), rolmodl::sys::DisplayMode::refreshRate, rolmodl::sys::DisplayMode::size, and rolmodl::sys::DisplayMode::unsafeDriverData.

Referenced by closestForDisplayN().