Sign in to follow this  
aleisterbukowski

[SOLVED] opt_img != NULL

Recommended Posts

I'm not sure why it gives you this error with the 2nd code listing, but try changing it to this:


SDL_Surface *Graphics::load_image(const std::string &filename)
{
SDL_Surface *loadedImage = IMG_Load(filename.c_str());

if(loadedImage != NULL)
{
SDL_Surface *optimizedImage = SDL_DisplayFormat( loadedImage );
SDL_FreeSurface( loadedImage );
return optimizedImage;
}

return NULL;
}




EDIT: Too slow...

Share this post


Link to post
Share on other sites
You know, the point of a forum is not (as you seem to selfishly believe) to have a lot of people solve your problems, but to have a lot of people see the solution to your problem whenever they encounter something similar.

If you find yourself solving your problem shortly after posting it, don't be unhelpful: instead of deleting your question, edit the original post to include the solution you've found.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this