SDL_GETFULLSCREENDISPLAYMODES(3)

πŸ’– SDL_GetFullscreenDisplayModes(3) πŸ’–

okay bestie, so this is a page from the SDL3 FUNCTIONS manual, and today we're talking about SDL_GetFullscreenDisplayModes β€” literally the girl who tells you every single fullscreen glow-up your display can serve. no cap. πŸ¦‹


✨ NAME ✨

SDL_GetFullscreenDisplayModes β€” get a list of fullscreen display modes available on a display. that's it, that's the whole job, and she does it flawlessly. πŸ’…


🌸 SYNOPSIS 🌸

#include <SDL3/SDL_video.h>

SDL_DisplayMode ** SDL_GetFullscreenDisplayModes(SDL_DisplayID displayID, int *count);

like… look at her signature. iconic. 😌


πŸ‘‘ DESCRIPTION πŸ‘‘

so you hand her a display, she hands you back every fullscreen mode that display can do. and not in some chaotic random order β€” she sorts them with actual main character energy, this exact priority:

  • w -> largest to smallest
  • h -> largest to smallest
  • bits per pixel -> more colors to fewer colors
  • packed pixel layout -> largest to smallest
  • refresh rate -> highest to lowest
  • pixel density -> lowest to highest

so yeah, the big juicy resolutions come first, and it trickles down from there. she's organized, she's picky, she's right. periodt. πŸ’–


πŸŽ€ FUNCTION PARAMETERS πŸŽ€

  • displayID β€” the instance ID of the display to query. like, which screen are we talking about, bestie? πŸ‘€
  • count β€” a pointer filled in with the number of display modes returned, and it may be NULL. no pressure, she handles it either way.

⭐ RETURN VALUE ⭐

she returns a NULL terminated array of display mode pointers… or NULL on failure 😭 (in which case pls call SDL_GetError() for more info, she'll tell you what went wrong, she's not mysterious about it).

and listen β€” it's a single allocation, so when you're done with it you HAVE to free it with SDL_free(). do not ghost that array, that's rude and also a leak. 🫢

no like fr, SDL_free() it. one allocation, one free. we love a clean exit. ✨

πŸ”₯ THREAD SAFETY πŸ”₯

this function should only be called on the main thread. do not be out here trying to run her from a side thread, she will not answer, that's not her vibe. πŸ’€


🌈 AVAILABILITY 🌈

this function is available since SDL 3.2.0. so if you're on something older… bestie, upgrade. πŸ™ˆ


πŸ¦‹ SEE ALSO πŸ¦‹

like yeah, go meet her friends, they're all lovely.


Simple Directmedia Layer β€” SDL 3.4.18 πŸ’œ

and that's the whole page, mwah. go get those display modes, you're gonna slay. πŸŽ€βœ¨πŸ‘‘

πŸ“¦ where this page comes from