SDL_GetDisplayForRect(3)

πŸ’– SDL_GetDisplayForRect(3) πŸ’–

okay bestie, welcome to the SDL3 FUNCTIONS corner of the manual, where we find out which screen a lil rectangle is living on πŸ–₯️✨


🌸 NAME 🌸

SDL_GetDisplayForRect β€” get the display primarily containing a rect. that's the whole vibe, no cap πŸ’…


πŸ¦‹ SYNOPSIS πŸ¦‹

#include <SDL3/SDL_video.h>

SDL_DisplayID SDL_GetDisplayForRect(const SDL_Rect *rect);

πŸŽ€ FUNCTION PARAMETERS πŸŽ€

  • rect β€” the rect you're querying, girl. hand it over and let's see where it belongs 🫢

✨ RETURN VALUE ✨

On success you get back the instance ID of the display that entirely contains the rect β€” or, if nobody fully claims it, the display closest to the center of the rect πŸ‘‘ If it fails? You get 0, and bestie you're gonna wanna call SDL_GetError() for more information because that's where the tea is 😭


πŸ’€ THREAD SAFETY πŸ’€

This function should only be called on the main thread. periodt. don't be out here on a side thread thinking you're the main character, because in this case the main thread literally is 🧚


🌈 AVAILABILITY 🌈

This function is available since SDL 3.2.0 β€” so if you're on anything older, no it isn't, sorry bestie πŸ’œ


⭐ SEE ALSO ⭐

iykyk, go read those next πŸŽ€


mwah πŸ’‹ this page came to you from Simple Directmedia Layer, rockin' SDL 3.4.18 β€” now go find your display and slay πŸ’…βœ¨

πŸ“¦ where this page comes from