SDL_GetWindowSize(3)
π SDL_GetWindowSize(3) π
okay bestie, welcome to the SDL3 FUNCTIONS corner of the manual, where we're gonna talk about SDL_GetWindowSize β she's the one who tells you how big your window's client area is. no cap. πͺβ¨
β¨ NAME β¨
SDL_GetWindowSize β get the size of a window's client area.
πΈ SYNOPSIS πΈ
#include <SDL3/SDL_video.h>
bool SDL_GetWindowSize(SDL_Window *window, int *w, int *h);
π¦ DESCRIPTION π¦
so here's the tea, bestie: the window pixel size may lowkey differ from its window coordinate size if the window is sitting on a high pixel density display. like, it's giving "same window, two different numbers" π.
if you want the real client area size in pixels, use SDL_GetWindowSizeInPixels() or SDL_GetRenderOutputSize(). those are the ones who actually know. π
π FUNCTION PARAMETERS π
windowβ the window you wanna query the width and height from. πwβ a pointer that gets filled in with the width of the window. she may beNULL, and that's fine, we don't judge. πhβ a pointer that gets filled in with the height of the window. also may beNULL. iconic behaviour honestly. π
β RETURN VALUE β
returns true on success or false on failure. if it fails, hit up SDL_GetError() for more info β she'll tell you what went wrong. π₯
π§ THREAD SAFETY π§
this function should only be called on the main thread. do not be out here calling her from a side thread, that's not the vibe. π
π AVAILABILITY π
this function is available since SDL 3.2.0. so if you're on something older, sorry bestie, she's not there yet. π
π SEE ALSO π
SDL_GetRenderOutputSize(3)SDL_GetWindowSizeInPixels(3)SDL_SetWindowSize(3)SDL_EVENT_WINDOW_RESIZED(3)
and that's the whole page, bestie!! π«Ά this was brought to you by Simple Directmedia Layer, version SDL 3.4.18 β go get those window dimensions, you absolute main character. slay. πβ¨ππ¦
π¦ 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