SpriteBatch System.IO.FileLoadException

Я только начал учить MonoGame, и учу его по этому уроку

Проблема возникает вот в этом коде:

using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

using System;
using System.Collections.Generic;
using System.Text;

namespace rpg
{
 class MainGame : Game
 {
     private GraphicsDeviceManager manager;
     private Map map = new Map(32, 32, 10, 10);
     private SpriteBatch spriteBatch;

     public MainGame()
     {
         manager = new GraphicsDeviceManager(this);
         
         IsMouseVisible = true;
     }

     protected override void Draw(GameTime gameTime)
     {
         GraphicsDevice.Clear(Color.CornflowerBlue);

         map.draw(spriteBatch); // <-- Exception here

         base.Draw(gameTime);
     }

     protected override void Initialize()
     {
         spriteBatch = new SpriteBatch(GraphicsDevice);
     }
 }}

Иключение

А это метод map.draw, куда я пытаюсь передать spriteBatch:

public void draw(SpriteBatch spriteBatch)
    {
        Vector2 tilePosition = Vector2.Zero;

        spriteBatch.Begin();

        for(int x = 0; x < width; x++)
        {
            for(int y = 0; y < height; y++)
            {
                spriteBatch.FillRectangle(tilePosition, new Size2(tileWidth, tileHeight), Color.Black);
            }
        }

        spriteBatch.End();
    }

Что делать в данной ситуации?


Ответы (0 шт):