SDL_GetWindowOpacity(3)
β¨ SDL_GetWindowOpacity β¨
okay bestie, welcome to the SDL3 FUNCTIONS section of the manual, and today's main character is SDL_GetWindowOpacity(3) β she's giving "how see-through is this window rn" energy π
πΈ NAME πΈ
SDL_GetWindowOpacity β get the opacity of a window. that's it. that's the whole job. she tells you how transparent your window is and she does NOT elaborate π«Ά
π¦ SYNOPSIS π¦
#include <SDL3/SDL_video.h>
float SDL_GetWindowOpacity(SDL_Window *window);
look at her. one parameter. one float. no drama. iconic β¨
π DESCRIPTION π
So here's the vibe: you call this, you get the opacity. Simple.
But important caveat, bestie: if transparency isn't supported on this platform, then opacity will just be returned as 1.0f β and it will not throw an error at you. Like, no fuss, no drama, no SDL_GetError() moment. She just quietly hands you a fully opaque 1.0f and moves on. That's the whole note. don't @ me π
π FUNCTION PARAMETERS π
windowβ the window you want to pull the current opacity value from. give her the window, she gives you the number πͺ
π RETURN VALUE π
Returns the opacity, and the scale goes like this:
0.0fβ fully transparent, ghost mode, you can see right through her π»1.0fβ fully opaque, solid, no peeking through, periodt
orrrr -1.0f on failure π β and if that happens you gotta call SDL_GetError() for more info, because she's not gonna tell you what went wrong unprompted. go ask.
π§ THREAD SAFETY π§
β οΈ main thread only, bestie. this function should only be called on the main thread. no side-quests, no background threads, no "but I thought it'd be fine." it will not be fine. stay on main. π€
π AVAILABILITY π
this function has been available since SDL 3.2.0 β so if you're on something older, she simply does not exist yet for you, sorry π
π SEE ALSO π
SDL_SetWindowOpacity(3)β the other half of the duo, the setter to this getter, the yin to her yang, go read it next π«Ά
and that's the page, babe!! source is Simple Directmedia Layer, this is SDL 3.4.18 β the SDL_GetWindowOpacity(3) of it all, no date on the footer because she's timeless like that π thanks for reading, mwah, go check your window opacity 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