I followed these two tutorials: http://content.gpwik..._Resource_Files and http://content.gpwik...sing_SDL_RWops.
Bitmaps work, but I can't get PNGs on the screen.
This is the code I thought would work for loading an image from a resource file:
SDL_Surface* CSurface::load_image(char *resource, char *File )
{
int filesize = 0;
char *buffer = GetBufferFromResource(resource, File, &filesize);
SDL_RWops *rw = SDL_RWFromMem(buffer, filesize);
SDL_Surface *loadedImage = IMG_LoadPNG_RW(rw);
//The optimized image that will be used
SDL_Surface* optimizedImage = NULL;
free(buffer);
//If the image loaded
if( loadedImage != NULL )
{
//Create an optimized image
optimizedImage = SDL_DisplayFormat( loadedImage );
//Free the old image
SDL_FreeSurface( loadedImage );
}
//Return the optimized image
return optimizedImage;
}
... but it doesn't work.
I didn't touch the code from the tutorial where it creates a resource file, so that might be the problem.