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.

--HG--
extra : amend_source : 99ddce333d2a4de7d59adb88d5059b34d731d907
extra : histedit_source : 012e8cb2f7822cd55cbbc124f642ccc530e3f75b%2Cbddf95ecf18ca97e1e3d7840971ef14ca739c9da
This commit is contained in:
Ryan C. Gordon 2016-01-05 02:46:10 -05:00
parent 8afe3ca698
commit 2875d70eba
19 changed files with 174 additions and 0 deletions

View file

@ -1368,6 +1368,24 @@ SDLTest_CommonEvent(SDLTest_CommonState * state, SDL_Event * event, int *done)
}
}
break;
case SDLK_o:
if (withControl) {
/* Ctrl-O (or Ctrl-Shift-O) changes window opacity. */
SDL_Window *window = SDL_GetWindowFromID(event->key.windowID);
if (window) {
float opacity;
if (SDL_GetWindowOpacity(window, &opacity) == 0) {
if (withShift) {
opacity += 0.20f;
} else {
opacity -= 0.20f;
}
SDL_SetWindowOpacity(window, opacity);
}
}
}
break;
case SDLK_c:
if (withControl) {
/* Ctrl-C copy awesome text! */