SDL_GetWindowPosition(3)
π SDL_GetWindowPosition(3) β the SDL3 FUNCTIONS era π
okay bestie, sit down, hydrate, and let me tell you about SDL_GetWindowPosition, aka the little guy who tells you where your window is at πͺβ¨
πΈ NAME πΈ
SDL_GetWindowPosition β get the position of a window. that's it. that's the whole job. she's focused, she's employed, she ate π
β¨ SYNOPSIS β¨
#include <SDL3/SDL_video.h>
bool SDL_GetWindowPosition(SDL_Window *window, int *x, int *y);
yes queen, one include, one function call, three args. we love a low-effort slay π
π¦ DESCRIPTION π¦
So like. This is the current position of the window, as last reported by the windowing system. Not a guess, not a vibe, not what you think it should be β what the windowing system actually told you most recently. no cap π
And here's the little gift: if you genuinely do not need the value for one of the positions, you can pass NULL in the x or y parameter. don't care about the x? don't pass an x pointer. she's flexible like that, fr fr π
π FUNCTION PARAMETERS π
- window β the window to query. the one we're asking about. the main character π«Ά
- x β a pointer that gets filled in with the x position of the window. may be
NULL. if you pass NULL she's just not gonna tell you, and that's fine π - y β a pointer that gets filled in with the y position of the window. may be
NULL. same deal, no judgement πΈ
β RETURN VALUE β
Returns true on success or false on failure β and if it's a fail, call SDL_GetError() for more information. like, she will NOT elaborate unprompted, you have to ask. classic π
bestie if it returnsfalse, do NOT just move on and pretend nothing happened. callSDL_GetError(). the lore is right there.
π§ THREAD SAFETY π§
This function should only be called on the main thread. no side quests. no background threads thinking they can just roll up. main thread only, periodt π«π§΅
π AVAILABILITY π
This function is available since SDL 3.2.0. if you're on anything older, she does not exist yet, and you're gonna have to cope π
π₯ SEE ALSO π₯
SDL_SetWindowPosition(3)β the getter's chaotic counterpart. go read her too π
and that's the whole page, bestie!! this lil doc lives under Simple Directmedia Layer, SDL 3.4.18, and it's part of the SDL3 FUNCTIONS fam. go forth and query your windows responsibly ππ¦π
π¦ 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