Search code examples
c#c#-4.0xna-4.0

Is it okay to load sprites in a separate class to reuse later?


Alright, so I have quite a few classes that use all of the same sprites (it's a GUI). I figured that rather than loading the same sprites multiple times, it would make sense to make a small, separate class for this.

Would this be a better way to do this, or unnecessary?


Solution

  • ContentManager caches images for you, so if you only want that, is Ok only using the content manager.

    If you want implement now or in next future a skin funcionality maybe convenient to make a Style class or Skin class where the sprites were related to its use. (Left Corner, Right Corner, Top Border, Scroll Bar Up, ...)