SDL_WINDOWPOS_CENTERED(3)
β¨ NAME β¨
SDL_WINDOWPOS_CENTERED β bestie, this is the little macro you use to say "put my window in the middle, pls" π
It's part of the SDL3 functions crowd, and it lives at page SDL_WINDOWPOS_CENTERED(3) iykyk π
πΈ SYNOPSIS πΈ
#include <SDL3/SDL_video.h>
#define SDL_WINDOWPOS_CENTERED SDL_WINDOWPOS_CENTERED_DISPLAY(0)
That's it. That's the whole thing. A #define. Not me being obsessed with a one-liner macro πβ¨
π DESCRIPTION π
So like, whenever you drop SDL_WINDOWPOS_CENTERED into your window creation, you're telling SDL: center this thing, babe. π«Ά
And the vibe check here? It always uses the primary display. No cap. It doesn't care which monitor your mouse is chilling on, it doesn't do the "wherever the cursor is" thing β primary display, periodt. π
Translation for the girlies: it expands to SDL_WINDOWPOS_CENTERED_DISPLAY(0), and that 0 is doing a lot of heavy lifting β display zero, the main character display, the primary one. π
β AVAILABILITY β
This macro is available since SDL 3.2.0. So if you're on something older than that... ma'am. Upgrade. π
π¦ SEE ALSO π¦
SDL_SetWindowPosition(3)β for when you've already made the window and now you wanna move it somewhere else π«
Heads up bestie: this is a compile-time macro, not a runtime function, so there's nothing to link against or check the return value of. It just is. π§
And that's the whole page, slay. Written by the Simple Directmedia Layer girlies, documenting SDL 3.4.18 β this edition of the manual is dated with all the love of a SDL_WINDOWPOS_CENTERED(3) footer, which is to say: it's giving "Simple Directmedia Layer, SDL 3.4.18, SDL_WINDOWPOS_CENTERED(3)" energy and I will not be elaborating. π
π¦ 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