Alien Blaster compiles and works with new SDL 1.3, but the alpha channel fails for SDL_Texture (is that an SDL bug?)

This commit is contained in:
pelya
2012-01-03 17:26:17 +02:00
parent bfcffa7f77
commit 32c68280bf
8 changed files with 86 additions and 32 deletions

View File

@@ -100,13 +100,18 @@ SDL_Surface *SurfaceDB::loadSurfaceInternal( string fn, bool alpha ) {
SDL_SetColorKey( newSurface, SDL_SRCCOLORKEY,
SDL_MapRGB(newSurface->format, transR, transG, transB) );
#if SDL_VERSION_ATLEAST(1,3,0)
// Do not even think of calling SDL_DisplayFormat(), it will return NULL and crash your code! (and kill your cat also)
#else
SDL_Surface * hwSurface = SDL_DisplayFormat(newSurface);
if( hwSurface ) {
SDL_FreeSurface(newSurface);
newSurface = hwSurface;
}
#endif
return newSurface;
}