SDL_GetWindowAspectRatio(3)

πŸ’– SDL_GetWindowAspectRatio(3) πŸ’–

okay bestie, so this one lives in the SDL3 FUNCTIONS section of the SDL_GetWindowAspectRatio(3) manual page, and it's literally the "hey what's my window's aspect ratio" function πŸ¦‹


✨ NAME ✨

SDL_GetWindowAspectRatio β€” get the aspect ratio of a window's client area. that's it, that's the whole vibe πŸ’…


✨ SYNOPSIS ✨

#include <SDL3/SDL_video.h>

bool SDL_GetWindowAspectRatio(SDL_Window *window, float *min_aspect, float *max_aspect);

like yes she's a one-liner, she's serving compact πŸ‘‘


✨ FUNCTION PARAMETERS ✨

  • window β€” the window you wanna query the width and height from πŸͺŸ
  • min_aspect β€” a pointer that gets filled in with the minimum aspect ratio of the window. may be NULL, no pressure, she's flexible πŸ’œ
  • max_aspect β€” a pointer that gets filled in with the maximum aspect ratio of the window. also may be NULL, twin behaviour fr fr πŸ™ˆ

✨ RETURN VALUE ✨

Returns true on success or false on failure 😭 β€” and if it's a fail, call SDL_GetError() for more information, she will tell you exactly what went wrong, no cap.


✨ THREAD SAFETY ✨

⚠️ bestie. listen. This function should only be called on the main thread. not the side threads, not the little background gremlins, the main one. periodt πŸ’€

✨ AVAILABILITY ✨

This function is available since SDL 3.2.0 ✨ so if you're on anything older, she simply does not exist yet, sorry babe 🌸


✨ SEE ALSO ✨


and that's the whole page, mwah πŸ’‹

Simple Directmedia Layer made this, it's SDL 3.4.18, and yeah, that's the version tag at the bottom of the page β€” go forth and query those ratios, you absolute main character πŸŒˆβ­πŸ‘‘

πŸ“¦ where this page comes from