SDL_GetDesktopDisplayMode(3)
π SDL_GetDesktopDisplayMode β the SDL3 functions era π
okay bestie, welcome to SDL_GetDesktopDisplayMode(3), fresh out of the SDL3 FUNCTIONS lineup π
β¨ NAME β¨
SDL_GetDesktopDisplayMode β get the tea on the desktop's display mode. like, the actual desktop's, not whatever chaos fullscreen is doing rn π¦
β¨ SYNOPSIS β¨
#include <SDL3/SDL_video.h>
const SDL_DisplayMode * SDL_GetDesktopDisplayMode(SDL_DisplayID displayID);
β¨ DESCRIPTION β¨
so here's the thing, and it's the whole point of this function existing: it is NOT the same as SDL_GetCurrentDisplayMode(). π
The difference shows up when SDL is running fullscreen and has changed the resolution. In that case, this function returns the previous native display mode β not the current display mode. So yeah, if you're sitting there like "why is this not matching SDL_GetCurrentDisplayMode()", that's why, and it's intentional, and it's iconic behavior actually π
β¨ FUNCTION PARAMETERS β¨
displayIDβ the instance ID of the display you wanna query. that's it, that's the whole vibe check πΈ
β¨ RETURN VALUE β¨
- Returns a pointer to the desktop display mode, or
NULLon failure π - If you get
NULL, hit upSDL_GetError()for more info β it'll tell you what went wrong, fr fr π«Ά
β¨ THREAD SAFETY β¨
main thread ONLY bestie. do not pass go, do not call this from a worker thread. main character energy only π
β¨ AVAILABILITY β¨
this one's been around since SDL 3.2.0 β
β¨ SEE ALSO β¨
and that's the whole page, no cap π shoutout to Simple Directmedia Layer for shipping this in SDL 3.4.18 β go forth and query your displays, you absolute legend πβ¨π¦
π¦ 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