Okay so I am making an old school RPG-like game. For the map background I am using a tile engine that I wrote myself. Every frame it blits only the tiles that are around the player to the screen, but when I try to blit the tiles that need to have transparency around them (such as a tree), it slows the game down and it lags horribly, but when I blit the same tiles without transparency, the games runs perfectly smooth. Here is my image loading function:
SDL_Surface *load_image( std::string filename, bool ALPHA=false ) {
SDL_Surface *get_img = IMG_Load( filename.c_str() );
SDL_Surface *loaded_img;
if( ALPHA )
loaded_img = SDL_DisplayFormatAlpha( get_img );
else
loaded_img = SDL_DisplayFormat( get_img );
SDL_FreeSurface( get_img );
return loaded_img;
}
So if I put 'true' in for the second argument, then it will load the image with its transparency, and slows the game down. But if I put 'false', then it doesn't load with transparency and my game runs perfectly. Why is this? And what can I do to solve this? Thanks in advance.[/font][/font][/font]