Sign in to follow this  

resource manager, what to use as a Key?

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

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