Sign in to follow this  

Image Management

This topic is 3041 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've got a small project that I've been working on recently and I've been wondering, how do you go about managing image files - ie, making sure the program doesn't load multiple copies of the same image. I'm currently thinking of having a class that stores a vector that contains a pointer to an image surface (SDL btw) and a string to identify it with (File Location??). Whenever its asked to load an image, it checks all its images to see if there string identifier is the same, if it is it returns that ones Surface Pointer, otherwise it loads up a new image and makes it an entry in its vector. Is this a good way to go about doing this? are there any other methods?

Share this post


Link to post
Share on other sites
Most people will do something similar to what you've got there, calling it a 'resource manager' or the like. It's just a basic cache that maps resource names (which are often filenames) to the data within them, loading them when needed.

Share this post


Link to post
Share on other sites

This topic is 3041 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.

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