SDL_GetDisplayBounds(3)

✨ SDL_GetDisplayBounds(3) ✨

okay bestie, so this is a page from the SDL3 FUNCTIONS manual β€” the whole Simple Directmedia Layer situation β€” and today we're talking about SDL_GetDisplayBounds. it's giving "where even IS my monitor, actually". πŸ’…


πŸŽ€ NAME πŸŽ€

SDL_GetDisplayBounds β€” get the desktop area represented by a display.

like, the actual rectangle of screen real estate that a display owns. no cap. πŸ–₯️✨


🌸 SYNOPSIS 🌸

#include <SDL3/SDL_video.h>

bool SDL_GetDisplayBounds(SDL_DisplayID displayID, SDL_Rect *rect);

πŸ¦‹ DESCRIPTION πŸ¦‹

so the whole vibe here is: you hand it a display, it tells you the rectangle that display occupies. easy.

the thing to know β€” and this is the iconic detail β€” is that the primary display is often located at (0,0), but it may be placed at a different location depending on monitor layout. so don't just assume (0,0) is home, bestie. multi-monitor setups said "not today". 😭


πŸ’– FUNCTION PARAMETERS πŸ’–

  • displayID β€” the instance ID of the display you wanna query. the one you're being nosy about. πŸ‘€
  • rect β€” the SDL_Rect structure filled in with the display bounds. this is the lil box that gets the answer dropped into it. 🎁

πŸ”₯ RETURN VALUE πŸ”₯

returns true on success or false on failure β€” and if it fails, call SDL_GetError() for more information. so like, if you get a false, don't spiral, just go read the error. 🫢


πŸ‘‘ THREAD SAFETY πŸ‘‘

this function should only be called on the main thread.

periodt. don't be cute and try it from a worker thread, it's not that girl. 🚫🧡


⭐ AVAILABILITY ⭐

this function is available since SDL 3.2.0. so if you're on anything older, sorry babe, no bounds for you. πŸ™ˆ


🌈 SEE ALSO 🌈

iykyk β€” go read those next, they're the rest of the display lore. πŸ’œ


and that's the whole page, bestie!! πŸŽ€ this came to you straight from the Simple Directmedia Layer manual, version SDL 3.4.18 β€” go forth and query your displays responsibly. mwah. πŸ’–βœ¨πŸ¦‹πŸ“πŸ§š

πŸ“¦ where this page comes from