Enabled HW acceleration in the game - it's now much faster

This commit is contained in:
pelya
2010-05-21 15:07:46 +03:00
parent 5778f2aced
commit 6ff2ef40fe

View File

@@ -72,8 +72,23 @@ SDL_Surface *SurfaceDB::loadSurface( string fn, bool alpha ) {
}
SDL_SetColorKey( newSurface, SDL_SRCCOLORKEY,
SDL_MapRGB(newSurface->format, transR, transG, transB) );
SDL_Surface * hwSurface = SDL_DisplayFormat(newSurface);
if( hwSurface ) {
SDL_FreeSurface(newSurface);
newSurface = hwSurface;
}
if ( alpha ) {
hwSurface = SDL_DisplayFormatAlpha(newSurface);
if( hwSurface ) {
SDL_FreeSurface(newSurface);
newSurface = hwSurface;
}
SDL_SetAlpha( newSurface, SDL_SRCALPHA, 128 );
SDL_SetColorKey( newSurface, SDL_SRCCOLORKEY,
SDL_MapRGB(newSurface->format, transR, transG, transB) );
}
surfaceDB[ fn ] = newSurface;