SDL_GetWindows(3)

πŸ’– NAME πŸ’–

okay so bestie, this is SDL_GetWindows(3) straight out of the SDL3 FUNCTIONS manual, and it is literally about getting a list of valid windows. that's the whole vibe. no cap. πŸͺŸβœ¨


πŸ¦‹ SYNOPSIS πŸ¦‹

#include <SDL3/SDL_video.h>

SDL_Window ** SDL_GetWindows(int *count);

like, she takes a pointer to an int and hands you back a whole array of window pointers. iconic behavior honestly. πŸ’…


πŸŽ€ FUNCTION PARAMETERS πŸŽ€

  • count β€” a pointer that gets filled in with the number of windows returned. it may be NULL, so like, no pressure if you're not ready for that info yet. πŸ™ˆ

✨ RETURN VALUE ✨

she returns a NULL terminated array of SDL_Window pointers, or NULL on failure β€” and if that happens, bestie, you gotta call SDL_GetError() for more information. 😭

this is a single allocation that should be freed with SDL_free() when it is no longer needed. do not forget to free her, fr fr, she will haunt you otherwise. 🫢


πŸ”₯ THREAD SAFETY πŸ”₯

This function should only be called on the main thread.

that's it. that's the rule. main thread only. do not try to be sneaky and call her from a side thread, she will not slay for you. πŸ’€


🌈 AVAILABILITY 🌈

This function is available since SDL 3.2.0. so if you're on something older, bestie... it's giving outdated. πŸ‘‘


Simple Directmedia Layer girlies made this, we're on SDL 3.4.18, and yeah, this was SDL_GetWindows(3). mwah, go free your arrays. πŸ’–πŸŽ€πŸ¦‹

πŸ“¦ where this page comes from