Original Post
In my SDL program, I delcare some surfaces at the beginning: SDL_Surface *background = NULL; SDL_Surface *foo = NULL; SDL_Surface *screen = NULL; Then later, I have a fuction that puts images on these surfaces:
bool load_files()
{
//Load the background image
background = load_image( "background.png" );
//If the background didn't load
if( background == NULL )
{
return false;
}
//Load the stick figure
foo = load_image( "foo.png" );
//If the stick figure didn't load
if( foo == NULL )
{
return false;
}
return true;
}
Right now, I'm in the processes of rewriting the above function so I don't have to do an if statment for each and every statement.
bool load_files2(std::string filename, "SDL_Surface as parameter here")
{
//Load the background image
"SDL_Surface here" = load_image( filename );
//If the background didn't load
if( background == NULL )
{
return false;
}
return true;
}
My problem is this, how can I declare that the second parameter will be an SDL_Surface?