Jump to content
  • Advertisement
Sign in to follow this  
lephyrius

Boost key value flyweight?(multiple keys)

This topic is 3321 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 got this keyvalue flyweight for my textures:
boost::flyweight<boost::flyweights::key_value<String,Texture> >** textures;

The problem is that I now got this constructor:
Texture(const String& filename , bool toAlpha = false);

Where I got a bool that tells if a greyscale image should be mapped to alpha channel or Luminance. So how do I create that flyweight?

Share this post


Link to post
Share on other sites
Advertisement
Whatever the Texture constructor takes as parameters, you still have Texture instances to feed key_value<String,Texture>; if you use the same image data for both a luminance and an alpha texture (unlikely) you can just give the two separate textures different names.

If you are directly using file names for keys, the only possible cause of perplexity that I can imagine, stop now. The names used to refer to textures in your code and what files they are loaded from are two different things.

Share this post


Link to post
Share on other sites
Quote:
Original post by LorenzoGatti
Whatever the Texture constructor takes as parameters, you still have Texture instances to feed key_value<String,Texture>; if you use the same image data for both a luminance and an alpha texture (unlikely) you can just give the two separate textures different names.

If you are directly using file names for keys, the only possible cause of perplexity that I can imagine, stop now. The names used to refer to textures in your code and what files they are loaded from are two different things.


Oki, So you mean I should have a list of textures and their parameters associated with "Fancy Helmet guy texture" or "Cool zombie dragon texture". It sound cool to me. That is a flexible solution.

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!