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";
}
if ( !color_key.empty() ) {
auto colors = getColorsHEX( color_key );
SDL_SetColorKey( surface, SDL_TRUE,
SDL_MapRGB( surface->format, std::get< 0 >( colors ),
std::get< 1 >( colors ),
std::get< 2 >( colors ) ) );
auto color = getSDLColorHEX( color_key );
SDL_SetColorKey(
surface, SDL_TRUE,
SDL_MapRGB( surface->format, color.r, color.g, color.b ) );
}
setTextureFromSurface( renderer, surface );
}