Making a function like this part of a class
I've attempted doing this many way but no matter what i get errors. I'd like to do it with a .h file and a corresponding .cpp file for functions.. Any help is appreciated.
Thanks.
Also I felt like this was more of a general programing question which is why I posted it on the c++ board.
Code:
SDL_Surface *getImage(std::string filename, int imageType)
{
SDL_Surface* image;
switch(imageType)
{
case BMP_IMAGE:
image = SDL_LoadBMP(filename.c_str());
break;
case JPEG_IMAGE:
break;
}
if(image == NULL)
{
return NULL;
}
image = SDL_DisplayFormat(image);
return image;
}