mirror of
https://github.com/encounter/SDL.git
synced 2025-12-19 09:55:29 +00:00
Added SDL_SetWindowOpacity() and SDL_GetWindowOpacity().
This is currently implemented for X11, Cocoa, Windows, and DirectFB. This patch is based on work in Unreal Engine 4's fork of SDL, compliments of Epic Games.
This commit is contained in:
@@ -121,6 +121,7 @@ DirectFB_CreateDevice(int devindex)
|
||||
device->SetWindowIcon = DirectFB_SetWindowIcon;
|
||||
device->SetWindowPosition = DirectFB_SetWindowPosition;
|
||||
device->SetWindowSize = DirectFB_SetWindowSize;
|
||||
device->SetWindowOpacity = DirectFB_SetWindowOpacity;
|
||||
device->ShowWindow = DirectFB_ShowWindow;
|
||||
device->HideWindow = DirectFB_HideWindow;
|
||||
device->RaiseWindow = DirectFB_RaiseWindow;
|
||||
|
||||
@@ -529,4 +529,17 @@ DirectFB_AdjustWindowSurface(SDL_Window * window)
|
||||
return;
|
||||
}
|
||||
|
||||
int
|
||||
DirectFB_SetWindowOpacity(_THIS, SDL_Window * window, float opacity)
|
||||
{
|
||||
const Uint8 alpha = (Uint8) ((unsigned int) (opacity * 255.0f));
|
||||
SDL_DFB_WINDOWDATA(window);
|
||||
SDL_DFB_CHECKERR(windata->dfbwin->SetOpacity(windata->dfbwin, alpha));
|
||||
windata->opacity = alpha;
|
||||
return 0;
|
||||
|
||||
error:
|
||||
return -1;
|
||||
}
|
||||
|
||||
#endif /* SDL_VIDEO_DRIVER_DIRECTFB */
|
||||
|
||||
@@ -75,6 +75,7 @@ extern SDL_bool DirectFB_GetWindowWMInfo(_THIS, SDL_Window * window,
|
||||
struct SDL_SysWMinfo *info);
|
||||
|
||||
extern void DirectFB_AdjustWindowSurface(SDL_Window * window);
|
||||
extern int DirectFB_SetWindowOpacity(_THIS, SDL_Window * window, float opacity);
|
||||
|
||||
#endif /* _SDL_directfb_window_h */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user