Jump to content
  • Advertisement
Sign in to follow this  
littlekid

resource manager, what to use as a Key?

This topic is 3771 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

What should I use as a key for a resource manager? Currently, I am using the filename as the map key. However how do resource manager handles resource like textures? The problem I have is a same texture(Texture-A), can be loaded with different parameters. e.g Step 1. ResMgr load Texture-A with mipmap. Step 2. ResMgr load Texture-A with colorkey. If I am to just use the filename as a Key for the resource manager, when I choose to load Texture-A the second time, it will signal that it was already loaded and return the texture. However the return texture is the wrongly created texture. How should I solve this? Should I make all possible parameters as a key instead?

Share this post


Link to post
Share on other sites
Advertisement
When you load it with different parameters are you going to reload the file? Why not use an int. the resource manager could keep a static int and just one up it every time it needs a new key.

Share this post


Link to post
Share on other sites
I currently use a simple string key for the resource label. It might get changed to an int or enum later if the checking proves too ponderous, but at the moment it's readable, flexible and simple.

The string maps to a definition which determines loading mechanism and acts as the storage key.

Share this post


Link to post
Share on other sites
I chose the pragmatic approach:
I converted the relevant parameters to string and added them onto the filename.

Since this only happens on loadup time there's not any noticable slowdown.

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!