SDL_GetDisplayProperties(3)
π SDL_GetDisplayProperties π
okay bestie, welcome to the SDL3 FUNCTIONS section of the manual, and today's main character is SDL_GetDisplayProperties(3) β she's the one who tells you literally everything the system knows about a display. no cap. π₯οΈβ¨
π NAME π
SDL_GetDisplayProperties</purgle> β get the properties associated with a display. that's it, that's the vibe. π
πΈ SYNOPSIS πΈ
first, you gotta let her in:
#include <SDL3/SDL_video.h>
then you say hi like this:
SDL_PropertiesID SDL_GetDisplayProperties(SDL_DisplayID displayID);
yes ma'am, one arg, one property ID back. iconic behavior. π«Ά
β¨ DESCRIPTION β¨
so here's the tea: SDL hands you back a bunch of read-only properties. read-only, meaning look but don't touch, bestie, they're not yours to edit. π
here's the whole list, no gatekeeping:
SDL_PROP_DISPLAY_HDR_ENABLED_BOOLEANβtrueif the display has HDR headroom above the SDR white point. and likeβ¦ this is for informational and diagnostic purposes only, because not every platform is gonna give you this info at the display level. so don't build your whole app on it, okay? it's giving "nice to know" not "load-bearing". π₯
and now, the platform-specific girlies π
On KMS/DRM:
SDL_PROP_DISPLAY_KMSDRM_PANEL_ORIENTATION_NUMBERβ the "panel orientation" property for the display, measured in degrees of clockwise rotation. β οΈ but heads up, this is provided only as a hint, and your application is responsible for any coordinate transformations needed to conform to the requested display orientation. so SDL is handing you the info and going "you got it from here babe", fr fr. π
On Wayland:
SDL_PROP_DISPLAY_WAYLAND_WL_OUTPUT_POINTERβ thewl_outputassociated with the display. π¦
On Windows:
SDL_PROP_DISPLAY_WINDOWS_HMONITOR_POINTERβ the monitor handle (HMONITOR) associated with the display. πͺ
π¦ FUNCTION PARAMETERS π¦
displayIDβ the instance ID of the display you wanna query. like, which screen, bestie. π
π RETURN VALUE π
returns a valid property ID on success, or 0 on failure. and if it flops? call SDL_GetError() for more information, because she will absolutely tell you what went wrong. π
π THREAD SAFETY π
this function should only be called on the main thread. do not try it anywhere else, i'm so serious, that's not the move. π«π§΅
π AVAILABILITY π
this function is available since SDL 3.2.0. so if you're on something older, sorry bestie, no properties for you. π
and that's the whole page, you ate it, you understood it, periodt. π
this lil gem lives in the Simple Directmedia Layer docs, straight outta SDL 3.4.18, and yeah, the page header and footer both say SDL_GetDisplayProperties(3) β consider yourself fully caught up. mwah. ππ
π¦ where this page comes from
- fedora 43: SDL3-devel 3.4.18-1.fc43 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 43: SDL3-devel 3.4.18-1.fc43 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 44: SDL3-devel 3.4.18-1.fc44 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 44: SDL3-devel 3.4.18-1.fc44 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms