Sign in to follow this  

[SOLVED] opt_img != NULL

This topic is 3544 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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
Sign in to follow this