SDL_GetPrimaryDisplay(3)
β¨ SDL_GetPrimaryDisplay β¨
okay bestie, welcome to the SDL_GetPrimaryDisplay(3) page, straight outta the SDL3 FUNCTIONS manual. this one is short, sweet, and lowkey iconic: it tells you which display is the primary one. main character screen energy, no cap. π
πΈ NAME πΈ
SDL_GetPrimaryDisplay β Return the primary display. that's it, that's the whole vibe. it hands you the display that the system considers the main one. β¨
π¦ SYNOPSIS π¦
#include <SDL3/SDL_video.h>
SDL_DisplayID SDL_GetPrimaryDisplay(void);
so you include <SDL3/SDL_video.h>, and you call SDL_GetPrimaryDisplay() with void β no args, she takes nothing, she gives you a SDL_DisplayID. periodt. π
π RETURN VALUE π
on success, this returns the instance ID of the primary display. if it fails? it returns 0. and if you're sitting there like "bestie why 0??" β call SDL_GetError() for more information. that's the group chat receipt. π§Ύ
no cap: 0 means failure here, so don't treat it like a valid display ID. π
π§΅ THREAD SAFETY π§΅
This function should only be called on the main thread. that's the rule, bestie. main thread only. don't be out here calling it from some random worker thread, it's not that kind of party. π
π AVAILABILITY π
this function is available since SDL 3.2.0. so if you're on something older, it's giving "not invited." π
π SEE ALSO π
SDL_GetDisplays(3)β the whole display list, if you want the full roster instead of just the primary. π
and that's the page, bestie π brought to you by Simple Directmedia Layer, SDL 3.4.18. slay, stay on the main thread, and go get that primary display. πβ¨
π¦ 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