Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

alnite

the best way to handle resources

This topic is 5229 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 have these bitmaps and sound files I use in the game but until now I still can''t figure out the best way to handle them. The current problem I have is everytime I add a new resource file, I have to modify my code, telling it to load the file, and release the file when it''s done. It''s ok if I only have 2 or 3 files, but if I have like at least 10 of them, this becomes a major problem. So I am trying to figure it out a way of loading all resource files, regardless of how many of them, and somehow to be able to access them whenever I need it. I am thinking of using std::map and maybe using the filename as the key. But then I need some sort of array to store all the filenames so I would still end up of having to know the name of the resource files in order to use them.

Share this post


Link to post
Share on other sites
Advertisement
Well, you''ll need to know all the filenames anyways. Otherwise, you''d be able to just load "*.wav" from your sound folder, but you''d have no idea which file is which. A class (or the std::map) to handle loading/unloading/managing the files is a good idea, but I don''t think you''ll get around knowing what you''re loading.

Share this post


Link to post
Share on other sites

  • 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!