sdlSetWindowOpacity function

bool sdlSetWindowOpacity(
  1. Pointer<SdlWindow> window,
  2. double opacity
)

Set the opacity for a window.

The parameter opacity will be clamped internally between 0.0f (transparent) and 1.0f (opaque).

This function also returns false if setting the opacity isn't supported.

\param window the window which will be made transparent or opaque. \param opacity the opacity value (0.0f - transparent, 1.0f - opaque). \returns true on success or false on failure; call SDL_GetError() for more information.

\threadsafety This function should only be called on the main thread.

\since This function is available since SDL 3.1.3.

\sa SDL_GetWindowOpacity

extern SDL_DECLSPEC bool SDLCALL SDL_SetWindowOpacity(SDL_Window *window, float opacity)

Implementation

bool sdlSetWindowOpacity(Pointer<SdlWindow> window, double opacity) {
  final sdlSetWindowOpacityLookupFunction = libSdl3.lookupFunction<
      Uint8 Function(Pointer<SdlWindow> window, Float opacity),
      int Function(
          Pointer<SdlWindow> window, double opacity)>('SDL_SetWindowOpacity');
  return sdlSetWindowOpacityLookupFunction(window, opacity) == 1;
}