Enabled HW acceleration in the game - it's now much faster
This commit is contained in:
@@ -72,8 +72,23 @@ SDL_Surface *SurfaceDB::loadSurface( string fn, bool alpha ) {
|
|||||||
}
|
}
|
||||||
SDL_SetColorKey( newSurface, SDL_SRCCOLORKEY,
|
SDL_SetColorKey( newSurface, SDL_SRCCOLORKEY,
|
||||||
SDL_MapRGB(newSurface->format, transR, transG, transB) );
|
SDL_MapRGB(newSurface->format, transR, transG, transB) );
|
||||||
|
|
||||||
|
SDL_Surface * hwSurface = SDL_DisplayFormat(newSurface);
|
||||||
|
|
||||||
|
if( hwSurface ) {
|
||||||
|
SDL_FreeSurface(newSurface);
|
||||||
|
newSurface = hwSurface;
|
||||||
|
}
|
||||||
|
|
||||||
if ( alpha ) {
|
if ( alpha ) {
|
||||||
|
hwSurface = SDL_DisplayFormatAlpha(newSurface);
|
||||||
|
if( hwSurface ) {
|
||||||
|
SDL_FreeSurface(newSurface);
|
||||||
|
newSurface = hwSurface;
|
||||||
|
}
|
||||||
SDL_SetAlpha( newSurface, SDL_SRCALPHA, 128 );
|
SDL_SetAlpha( newSurface, SDL_SRCALPHA, 128 );
|
||||||
|
SDL_SetColorKey( newSurface, SDL_SRCCOLORKEY,
|
||||||
|
SDL_MapRGB(newSurface->format, transR, transG, transB) );
|
||||||
}
|
}
|
||||||
|
|
||||||
surfaceDB[ fn ] = newSurface;
|
surfaceDB[ fn ] = newSurface;
|
||||||
|
|||||||
Reference in New Issue
Block a user