Hi again,
My SDL Application, when run, seems to work OK, but it never actually appears. My IDE (Code::Blocks) says it's running, and it appears as a running process in Task Manager, but it doesn't appear (neither does it modify a file, as it is supposed to during its run, but that's irrelevant).
I believe the problem may be this:
SDL_Surface *man[12];
Not only am I unsure how to initialize the entire vector to NULL, but I remember reading that arrays of pointers are "bad" somewhere...
I later set their values by using a
for
loop that gives them each a path to a file, like this:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
|
int x=0;
std::stringstream ss;
char path[30];
std::string partialPath="resources/sprites/man/";
for (x=0; x<12; x++) {
ss<<partialPath<<"man"<<(x+1)<<".png";
ss>>path;
man[x]=IMG_Load(path);
ss.clear();
}
for (x=0; x<12; x++) {
if (man[x]==NULL) {
return false;
}
}
|
This seemed the most space efficient method of doing it: feeding an
std::stringstream
the path in segments, then using that path to load the image.
Is there anything wrong with this?
If so, how do I rectify my error?
Thanks,
hnefatl