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 beNULL, no pressure, she's flexible πmax_aspectβ a pointer that gets filled in with the maximum aspect ratio of the window. also may beNULL, 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 β¨
- SDL_SetWindowAspectRatio(3) β the setter to this getter, they're a matched set, iconic duo π«Ά
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
- 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