3
\$\begingroup\$

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?

\$\endgroup\$
2
  • \$\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, 2012 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, 2012 at 8:42

1 Answer 1

2
\$\begingroup\$

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.

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .