mirror of
https://github.com/vcmi/vcmi.git
synced 2025-08-15 20:03:15 +02:00
change SDL color key alpha to transparent
This commit is contained in:
committed by
Andrii Danylchenko
parent
27b3a88dda
commit
83f690e059
@@ -819,12 +819,15 @@ void CSDL_Ext::setDefaultColorKey(SDL_Surface * surface)
|
||||
|
||||
void CSDL_Ext::setDefaultColorKeyPresize(SDL_Surface * surface)
|
||||
{
|
||||
uint32_t key = mapColor(surface,Colors::DEFAULT_KEY_COLOR);
|
||||
uint32_t key = mapColor(surface, Colors::DEFAULT_KEY_COLOR);
|
||||
auto & color = surface->format->palette->colors[key];
|
||||
|
||||
// set color key only if exactly such color was found
|
||||
if (color.r == Colors::DEFAULT_KEY_COLOR.r && color.g == Colors::DEFAULT_KEY_COLOR.g && color.b == Colors::DEFAULT_KEY_COLOR.b)
|
||||
{
|
||||
SDL_SetColorKey(surface, SDL_TRUE, key);
|
||||
color.a = SDL_ALPHA_TRANSPARENT;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user