Hi,
I keep having problems with using sfml together with this.
So I can make an image manager. So I have the class ImageManager which inherits from ResourceManager.
Then I make a sf::Sprite sp, and suppose I have a boost::shared_ptr<sf::Image> im and I want to assign that image to the sprite. So I go sp.SetImage(*im). But then I get always the white rectangle, because the use count doesn't increase and the resource manager thinks it has the unique pointer to it, so it deletes it.
What can I do?
I had the same problem,
Either you have to lock every other thread while you load your picture (see the tutorial), or do what I did:
I have a ResourceManager-class with a Resourceloading-thread. It saves different kinds of resources, which all have a Load() and a Get() method.
The Load Method loads the image, despite the fact that it is useless
The first call of Get() runs ths code:
MyImage.reset(new sf::Image(*MyImage.get()));
This works out fine
If you want to download the whole Framework, click
here(It is in german, but I hope that works out somehow)
EDIT: Oh, I just saw, does using boost::shared_ptr solve the problem?
bye, CBenni::O