mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-13 15:44:36 +00:00
Fix for transparency in splash images
This commit is contained in:
parent
be3b5ec3aa
commit
ed4a6ffafc
1 changed files with 19 additions and 2 deletions
|
|
@ -81,13 +81,30 @@ bool Platform::displaySplashWindow( String path )
|
||||||
}
|
}
|
||||||
|
|
||||||
gSplashImage = SDL_CreateRGBSurfaceFrom(img->getAddress(0, 0), img->getWidth(), img->getHeight(), depth, pitch, rmask, gmask, bmask, amask);
|
gSplashImage = SDL_CreateRGBSurfaceFrom(img->getAddress(0, 0), img->getWidth(), img->getHeight(), depth, pitch, rmask, gmask, bmask, amask);
|
||||||
|
gSplashImage = SDL_ConvertSurfaceFormat(gSplashImage, SDL_PIXELFORMAT_RGBA8888, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
//now the pop-up window
|
//now the pop-up window
|
||||||
if (gSplashImage)
|
if (gSplashImage)
|
||||||
{
|
{
|
||||||
gSplashWindow = SDL_CreateWindow("", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED,
|
gSplashWindow = SDL_CreateShapedWindow("", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED,
|
||||||
gSplashImage->w, gSplashImage->h, SDL_WINDOW_BORDERLESS | SDL_WINDOW_SHOWN);
|
gSplashImage->w, gSplashImage->h, SDL_WINDOW_BORDERLESS);
|
||||||
|
|
||||||
|
SDL_WindowShapeMode mode;
|
||||||
|
SDL_Color black = { 0,0,0,0xff };
|
||||||
|
SDL_PixelFormat* format = gSplashImage->format;
|
||||||
|
if (SDL_ISPIXELFORMAT_ALPHA(format->format))
|
||||||
|
{
|
||||||
|
mode.mode = ShapeModeBinarizeAlpha;
|
||||||
|
mode.parameters.binarizationCutoff = 255;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mode.mode = ShapeModeColorKey;
|
||||||
|
mode.parameters.colorKey = black;
|
||||||
|
}
|
||||||
|
|
||||||
|
SDL_SetWindowShape(gSplashWindow, gSplashImage, &mode);
|
||||||
|
|
||||||
gSplashRenderer = SDL_CreateRenderer(gSplashWindow, -1, SDL_RENDERER_ACCELERATED);
|
gSplashRenderer = SDL_CreateRenderer(gSplashWindow, -1, SDL_RENDERER_ACCELERATED);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue