So I have a simple XNA project going on. Basically the question I have is how to handle texture loading and making sure there is proper access to those textures from other classes?
For example, every tutorial I've seen, as well as what I can tell from the actual logic of XNA, you're supposed to load textures in the LoadContent()
method. But let's say I have another class, Level
, that needs its own unique set of textures, and within that I create an instance of my Player
object, which also needs its own texture, and of course enemies and everything else.
One way I could do it is just to load the textures needed for a particular class in its constructor, but for that I'd need to set up a new content manager or pass the content manager to each constructor, which seems both unwieldy and outside of what was intended.
So when it comes to full-blown projects that aren't little tutorials that use 2 textures, what's the best way to implement loading them?