Jump to content
  • Advertisement
Sign in to follow this  
Tomas Cokis

Image Management

This topic is 3254 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
Advertisement
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
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!