Is their a way to release an sf::image without deleting it. Also without modifying the sfml source..
I'm trying to put together a resource manager that can cache certain resources depending on the game state and quickly load and release them. but I have my image resource inherit from sf::image and dont really see a public function that would allow that.
the only thing I can think of would be to have a sf::image member in my resource class like so...
class myImageResource{
private:
sf::image * mySFImage;
std::string myFileName;
public:
myImageResource(std::string theFileName):
myFileName(theFileName)
mySFImage(new sf::image) //<--- not really sure if thats legal but you get the idea...
void Load(){
mySFImage->LoadFromFile(mFileName
}
void Release(){
delete mySFImage;
}
};
this is just an example but it already feels hacky and unsafe. I dont want to have to create and delete the sf::image every time ya know? I really want the resource to inherit from sf::image to make things streamlined.
any thoughts, comments?