SDL_GetDisplays(3)
π SDL_GetDisplays(3) β the SDL3 FUNCTIONS girlies' guide π
okay so bestie, welcome to SDL_GetDisplays(3). this is the one that gives you the whole lineup of screens that are plugged into your machine right now. like, every monitor currently connected? yeah, she knows them. she's got the receipts. π₯οΈβ¨
πΈ NAME πΈ
SDL_GetDisplays β get a list of currently connected displays.
that's it. that's the whole job. she lists your displays. iconic behaviour, honestly. π
β¨ SYNOPSIS β¨
#include <SDL3/SDL_video.h>
SDL_DisplayID * SDL_GetDisplays(int *count);
so you pull in the header, you call the function, you get back a pointer to a whole array of display IDs. it's giving "here's everybody, no cap." π«Ά
π FUNCTION PARAMETERS π
countβ a pointer that gets filled in with the number of displays returned. it may beNULL, so if you literally do not care how many came back, you can just passNULLand vibe. π
π₯ RETURN VALUE π₯
she returns a 0 terminated array of display instance IDs. or, if things went sideways, NULL on failure β and in that case you gotta call SDL_GetError() for more information. that's your bestie telling you what went wrong. π
important: when you're done with that array, free it with SDL_free(). do NOT just walk away from her. that's a memory leak and we don't do that here. π«π
π§ THREAD SAFETY π§
this function should only be called on the main thread. periodt. don't be out here calling her from some random worker thread, she will not answer. main character energy only, on the main thread. π
π AVAILABILITY π
this function is available since SDL 3.2.0. so if you're on something older, no displays for you, sorry babe. π
π¦ and that's the tea π¦
okay so that's SDL_GetDisplays(3) in full. go forth, enumerate your monitors, free your arrays, and stay on the main thread. mwah. π
this lil page comes to you from Simple Directmedia Layer, running SDL 3.4.18. ty for reading, ily, bye bestie!! πβ¨πΈπ«Ά
π¦ 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