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 NULL on failure 😭
  • If you get NULL, hit up SDL_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