SDL_WINDOWPOS_CENTERED_DISPLAY(3)
π NAME π
SDL_WINDOWPOS_CENTERED_DISPLAY β the lil macro that tells SDL "bestie, center this window on that specific display, mwah" π
It lives in the SDL3 functions manual, and honestly? It's giving "one line of C, infinite power." β¨
πΈ SYNOPSIS πΈ
#include <SDL3/SDL_video.h>
#define SDL_WINDOWPOS_CENTERED_DISPLAY(X) (SDL_WINDOWPOS_CENTERED_MASK|(X))
That's it. That's the whole thing. No cap. π
π¦ DESCRIPTION π¦
Okay so. You want a window centered, right? And you want it centered on a specific display, not just whichever one SDL feels like picking? Say less. π
SDL_WINDOWPOS_CENTERED does the same job, but it always uses the primary display instead of letting you specify one. So if you're on a multi-monitor setup (main character energy, honestly), and you want your window to pop up centered on monitor #2 instead of the boring default one, that's exactly when SDL_WINDOWPOS_CENTERED_DISPLAY comes in to slay. π
π MACRO PARAMETERS π
Xβ theSDL_DisplayIDof the display you want to use. Literally just hand it the display's ID and it does the rest. π«Ά
β¨ AVAILABILITY β¨
This macro is available since SDL 3.2.0. So if you're on anything older, sorry babe, it's not happening. π
π SEE ALSO π
SDL_SetWindowPosition(3)β go read this one too, it's the whole reason you'd be passing these values around in the first place. iykyk. π₯
That's the whole vibe check, bestie β go center some windows on the exact display of your dreams. π§π
Signing off from the Simple Directmedia Layer crew, SDL 3.4.18 edition β catch you in the next SDL_WINDOWPOS...TERED_DISPLAY(3) page. π
β
π¦ 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