[SDL] HARD WARE SURFACES

Patricia Curtis patricia.curtis at gmail.com
Fri Oct 5 02:13:48 PDT 2007


Hi Guys
         I have some hardware surfaces, and if i understand correctly,
when i change from Full Screen to Windowed, i need to reload them,
which is what i am doing. but my memory is getting bigger and bigger
every time i change from full screen to windowed and vice versa.

I am freeing the surfaces before i create new surfaces as you can see.
So what am i doing wrong?

void	ReloadHardwareLevel()
{
	strcpy(PathName,"Gfx/");
	strcat(PathName,MapInfo[PlayingMap].MapName);	
	strcat(PathName,".jpg");
	if(gLevel)
	{
		SDL_FreeSurface(gLevel);
	}	
	gLevel	=	SDL_DisplayFormatAlpha(SDL_CreateRGBSurface(SDL_HWSURFACE,SCREEN_WIDTH,SCREEN_HEIGHT,32,RMASK,
GMASK, BMASK, AMASK));
	SDL_Surface * TempSurface			=	SDL_DisplayFormatAlpha(IMG_Load(PathName));
	CopySurface(TempSurface,gLevel); // my own function for copying the pixels
	SDL_FreeSurface(TempSurface);
}

Thanks

Trish


More information about the SDL mailing list