Archived

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

alnite

the best way to handle resources

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