I have a resource manager, handling the usual resource loading, unloading etc. With resources such an images and meshes, there is no problem. However, what do I do when I have a resource containing other resources? For example, spriteFont contains reference to a sprite and a letter description.

Should that sprite be added to resource manager, or should my spriteFont be the only owner of that resource?

  • \$\begingroup\$ What can be the problem if you add SpriteFont too? "my spriteFont must be the only owner of that resource" what do you mean by owner? \$\endgroup\$ – Shashwat Sep 20 '12 at 6:30
  • \$\begingroup\$ Owner means nobody references to that sprite even resource manager, nobody knows about it's existence. It' helps reduce reference between classes, SpriteFont does not require resource manager \$\endgroup\$ – Yevhen Sep 20 '12 at 8:42

My fonts own the images that represent their fonts. I see no reason to add the image to the general pool of resources. The resource manager doesn't even need to know about it. I use the same routines for loading the image, but it's loaded into the font object. Nothing other than the fonts will use that image.

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.