SDLPP: Texture - use SDL_Color

This commit is contained in:
zvon 2021-03-15 14:48:48 +01:00
parent 8540573455
commit 4cd351c7a3

View File

@ -10,11 +10,10 @@ Texture::Texture( std::shared_ptr< Renderer > &renderer,
throw "IMG_Load error"; throw "IMG_Load error";
} }
if ( !color_key.empty() ) { if ( !color_key.empty() ) {
auto colors = getColorsHEX( color_key ); auto color = getSDLColorHEX( color_key );
SDL_SetColorKey( surface, SDL_TRUE, SDL_SetColorKey(
SDL_MapRGB( surface->format, std::get< 0 >( colors ), surface, SDL_TRUE,
std::get< 1 >( colors ), SDL_MapRGB( surface->format, color.r, color.g, color.b ) );
std::get< 2 >( colors ) ) );
} }
setTextureFromSurface( renderer, surface ); setTextureFromSurface( renderer, surface );
} }