fix: Sprite Batch Exception at Runtime

This commit is contained in:
Syntriax 2023-11-30 10:48:57 +03:00
parent 8ec918ca04
commit bbc15cba92
1 changed files with 2 additions and 1 deletions

View File

@ -23,7 +23,6 @@ public class Game1 : Game
PreferredBackBufferWidth = 1024, PreferredBackBufferWidth = 1024,
PreferredBackBufferHeight = 576 PreferredBackBufferHeight = 576
}; };
_spriteBatch = new SpriteBatch(GraphicsDevice);
Content.RootDirectory = "Content"; Content.RootDirectory = "Content";
IsMouseVisible = true; IsMouseVisible = true;
@ -41,6 +40,8 @@ public class Game1 : Game
protected override void LoadContent() protected override void LoadContent()
{ {
_spriteBatch = new SpriteBatch(GraphicsDevice);
Sprite spriteBox = new Sprite() { Texture2D = Content.Load<Texture2D>("Sprites/Pixel") }; Sprite spriteBox = new Sprite() { Texture2D = Content.Load<Texture2D>("Sprites/Pixel") };
Sprite spriteBall = new Sprite() { Texture2D = Content.Load<Texture2D>("Sprites/Circle") }; Sprite spriteBall = new Sprite() { Texture2D = Content.Load<Texture2D>("Sprites/Circle") };