SDL_GetCurrentDisplayMode(3)

πŸ’– SDL_GetCurrentDisplayMode πŸ’–

okay bestie, welcome to the SDL3 FUNCTIONS manual, page SDL_GetCurrentDisplayMode(3) πŸŽ€ β€” yes it's a whole vibe, yes it's in <SDL3/SDL_video.h>, and yes we're gonna get you fluent in it. no cap.


✨ NAME ✨

SDL_GetCurrentDisplayMode β€” get information about the current display mode. that's it, that's the whole job. iconic. πŸ‘‘


🌸 SYNOPSIS 🌸

#include <SDL3/SDL_video.h>

const SDL_DisplayMode * SDL_GetCurrentDisplayMode(SDL_DisplayID displayID);

look at her. returns a const SDL_DisplayMode *, takes one SDL_DisplayID. clean, simple, slay. πŸ’…


πŸ¦‹ DESCRIPTION πŸ¦‹

okay so here's the tea β˜• β€” there's a difference between this function and SDL_GetDesktopDisplayMode() when SDL runs fullscreen and has changed the resolution. and that difference is the entire point of this function, so pay attention bestie πŸ™ˆ

in that case, this function will return the current display mode, and not the previous native display mode. so like, if SDL went fullscreen and swapped the resolution on you, SDL_GetCurrentDisplayMode is the one telling you what's happening right now, while the desktop one is still out here living in the past. main character vs. nostalgia. ✨


πŸŽ€ FUNCTION PARAMETERS πŸŽ€

  • displayID β€” the instance ID of the display to query. just hand her the display you're curious about, she'll do the rest. 🫢

πŸ’œ RETURN VALUE πŸ’œ

  • *) Returns a pointer to the desktop display mode, or NULL on failure. 😭
if you get NULL, do not panic β€” call SDL_GetError() for more information. she'll tell you what went wrong, fr fr.

πŸ”₯ THREAD SAFETY πŸ”₯

This function should only be called on the main thread. that's it. no side quests, no background threads, no sneaking it into a worker. main thread only, periodt. πŸ’€


🌈 AVAILABILITY 🌈

This function is available since SDL 3.2.0. so if your SDL is older than that, sorry babe, she's not home. 🧚


⭐ SEE ALSO ⭐

go read those too, they're literally her sisters. iykyk. πŸ’–


and that's the whole page, bestie!! πŸŽ€βœ¨ this came to you from the Simple Directmedia Layer girlies, SDL 3.4.18, and yeah β€” SDL_GetCurrentDisplayMode(3). go query your displays, you absolute icon. πŸ¦‹πŸ’…πŸŒΈ

πŸ“¦ where this page comes from