[SDL] Freeing SDL_Surfaces
Sweeney, Steven (FNB)
SweeneS at fnb.co.uk
Fri Nov 29 01:20:02 PST 2002
This is beginning to drive me nuts... Can someone please help,
I have a bunch of surfaces in a array... so,
SDL_Surface *shape[50];
When I load the game's graphics I load each one into a seperate array
index...
shape[0] = loadImage("image1.png");
shape[1] = loadImage("image2.png");
shape[2] = loadImage("image3.png");
etc..
This is all fine. But since I'm reusing the array for different parts of the
game, I want to free the data first,
for (int i = 0 ; i < 50 ; i++)
{
if (shape[i] != NULL)
SDL_FreeSurface(shape[i]);
}
Then I want to load in the new graphics (like I do in the bit above). The
problem is that as I'm looping through the shapes to remove them. It seg
faults. Any ideas?
More information about the SDL
mailing list