2
votes

I have created a separate class (let's call it class2.cs for example) and want to use it as a level, in that when I call it, it will draw everything in one level for me. I'm having trouble getting contentmanager to work in class2. In the given Game1.cs, you can easily just go texture2d= Content.Load<Texture2D>("photo"); but I can't in class2.

I realize I have to create a new Content Manager, but it's constructor requires a game service, in which I'm not sure what I'm suppose to plug in. I currently have: ContentManager content = new ContentManager(); but I need an overload for ContentManager.

1

1 Answers

4
votes

Pass Content to the constructor of your second class from the game, or you can create a Globals.cs class with static variables for your ContentManager or spriteBatch or any common resources.