Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9007071
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T01:35:11+00:00 2026-06-16T01:35:11+00:00

Pretty new to monogame (mono for android to be precise) but with some youtube

  • 0

Pretty new to monogame (mono for android to be precise) but with some youtube tutorials the process was fairly pain free.
I’m trying to override some functions (from an “XNA library project” dll) I can override all the functions just fine. But when I try to override anything that passes in a SpriteBatch as an argument I get the follow error:

Error 5 ‘Parkour.Screens.EditorScreen.Draw(Microsoft.Xna.Framework.Graphics.SpriteBatch)’:
no suitable method found to override D:\Data\programming and
such\comps\TIGsport\XNA\Parkour\Parkour\Parkour\Screens\EditorScreen.cs 117 30 ParkourAndroid

I’m absolutely sure the method is there, because the XNA project works just fine.
The Draw function also pops up in autocorrect in the mono for android project. But strange enough it seems to have dissapeared from autocorrect after I received the error.

Here is the entire class which holds the to be override function, just so you guys can be sure nothing is wrong.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework.Graphics;

namespace SimpleTilebasedLibrary.Utils
{
    public class LoopContainer<T> where T : ILoopable
    {
        protected List<T> _items = new List<T>();
        private List<T> _addList = new List<T>();
        private List<T> _removeList = new List<T>();

        public List<T> items
        {
            get{return _items;}
        }

        public virtual void add(T item)
        {
            //if (_addList.Contains(item)) return;
            //_addList.Add(item);
            _items.Add(item);
        }

        public virtual void remove(T item)
        {
            if (_removeList.Contains(item)) return;
            _removeList.Add(item);
        }

        public T get(int index)
        {
            return _items[index];
        }

        public T get(string name)
        {
            foreach (T item in items)
            {
                if (item.getName() == name)
                {
                    return item;
                }
            }

            return default(T);
        }

        public virtual void Update()
        {
            items.AddRange(_addList);
            _addList.Clear();

            foreach (T item in items)
            {
                if (item.status == Status.DEAD)
                {
                    _removeList.Add(item);
                    //break; //root of all evil
                    continue;
                }

                item.Update();
            }

            //remove
            foreach (T i in _removeList)
            {
                items.Remove(i);
            }
            _removeList.Clear();

        }

        public virtual void postUpdate()
        {
            foreach (T item in items)
            {
                item.postUpdate();
            }
        }

        public virtual void Draw(SpriteBatch spritebatch)
        {
            foreach (T item in items)
            {
                item.Draw(spritebatch);
            }
        }
    }
}

And the class that is trying to override it

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SimpleTilebasedLibrary;
using SimpleTilebasedLibrary.Entities;
using SimpleTilebasedLibrary.Tilesystem;
using SimpleTilebasedLibrary.Services;
using Microsoft.Xna.Framework.Input;
using SimpleTilebasedLibrary.Components;
using SimpleTilebasedLibrary.Utils;
using SimpleTilebasedLibrary.UI;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

namespace Parkour.Screens
{
    public class EditorScreen : GameScreen //need to couple gamescreens with inputcontexts?
    {
        public ParkourWorld world;
        int currentTile = 0;
        GameObject tile;

        Checkbox editorEnabled;
        Checkbox solidCB;
        Checkbox autotileCB;

        public EditorScreen(ParkourWorld world)
            : base("editorscreen")
        {
            this.world = world;
            tile = new GameObject("tileset", 16, 16); //never actually tested this, doesn't work!
            tile.GetC<GraphicsC>().setScale(2, 2);
            //add(tile); //something fucks up the coordinates when you add it...

            editorEnabled = new Checkbox(Color.White, 10);
            editorEnabled.GetC<TransformC>().Y = 10;
            editorEnabled.GetC<TransformC>().X = 100;

            solidCB = new Checkbox(Color.Red, 10);
            solidCB.GetC<TransformC>().Y = 10;//30;
            solidCB.GetC<TransformC>().X = 120;
            //add(solidCB);

            autotileCB = new Checkbox(Color.Blue, 10);
            autotileCB.GetC<TransformC>().Y = 10;//50;
            autotileCB.GetC<TransformC>().X = 140;
            //add(autotileCB);

            editorEnabled.value = false;
        }


        public override void Update()
        {
            base.Update();

            if (GameServices.get<InputManager>().hasScrolledDown() && currentTile > 0)
            {
                currentTile--;
            }

            if (GameServices.get<InputManager>().hasScrolledUp() && currentTile < tile.GetC<GraphicsC>().totalFrames - 1) 
            {
                currentTile++;
                Console.WriteLine(currentTile);
            }

            tile.GetC<GraphicsC>().gotoAndStop(currentTile);

            //


            if (Mouse.GetState().LeftButton == ButtonState.Pressed && editorEnabled.value)
            {
                GameCamera camera = GameServices.get<CameraManager>().getActiveCamera();

                int x = TileMath.PixelToTile((Mouse.GetState().X + (camera.GetC<CameraC>().leftX * camera.GetC<CameraC>().zoom)) / camera.GetC<CameraC>().zoom, world.tilegrid.tileWidth);
                int y = TileMath.PixelToTile((Mouse.GetState().Y + (camera.GetC<CameraC>().UpY * camera.GetC<CameraC>().zoom)) / camera.GetC<CameraC>().zoom, world.tilegrid.tileHeight);

                if (Keyboard.GetState().IsKeyDown(Keys.Z))
                {
                    world.tilegrid.setTile(x, y, 0, null);
                    //world.tilegrid.getTile(x, y, 0).id = 1;
                    //world.tilegrid.getTile(x, y, 0).solid = false;
                }
                else
                {
                    Tile t = world.tilegrid.setTile(x, y, 0, currentTile);
                    if (t != null) t.solid = solidCB.value;

                    if(autotileCB.value)world.tilegrid.AutoTile(t, 0, x, y, true);
                    //world.tilegrid.setTile(x, y, 0, null);
                }
            }

            // enable and disable cb's //
            if (GameServices.get<InputManager>().wasKeyPressed(Keys.LeftShift))
            {
                solidCB.value = !solidCB.value;
            }

            if (GameServices.get<InputManager>().wasKeyPressed(Keys.Q))
            {
                autotileCB.value = !autotileCB.value;
            }

            if (GameServices.get<InputManager>().wasKeyPressed(Keys.E))
            {
                editorEnabled.value = !editorEnabled.value;
            }

            solidCB.Update();
            autotileCB.Update();
        }

        public override void Draw(SpriteBatch spritebatch)
        {
            base.Draw(spritebatch);
            tile.Draw(spritebatch);
            editorEnabled.Draw(spritebatch);
            solidCB.Draw(spritebatch);
            autotileCB.Draw(spritebatch);

            CameraC camera = GameServices.get<CameraManager>().getActiveCameraC();

            int width = TileMath.PixelToTile(camera.viewrect.Left + camera.viewrect.Width + (world.tilegrid.tileWidth * 2), world.tilegrid.tileWidth);
            int height = TileMath.PixelToTile(camera.viewrect.Top + camera.viewrect.Height + (world.tilegrid.tileHeight * 2), world.tilegrid.tileHeight);

            if (editorEnabled.value)
            {
                spritebatch.End();
                spritebatch.Begin(SpriteSortMode.Deferred, null, SamplerState.PointClamp, null, null, null, GameServices.get<CameraManager>().getActiveCameraC().getTransformation());

                //getTile(width - 1, 0).GetComponent<GraphicsC>().sprite.gotoAndStop(4);

                Rectangle rect = new Rectangle();
                Color trans = new Color(255, 0, 0, 10);
                for (int x = TileMath.PixelToTile(camera.viewrect.Left, world.tilegrid.tileWidth); x < width; x++)
                {
                    for (int y = TileMath.PixelToTile(camera.viewrect.Top, world.tilegrid.tileHeight); y < height; y++)
                    {
                        if (world.tilegrid.getTile(x, y, 0) != null)
                        {
                            if (!world.tilegrid.getTile(x, y, 0).solid) continue;
                            rect.X = x * world.tilegrid.tileWidth;
                            rect.Y = y * world.tilegrid.tileHeight;
                            rect.Width = world.tilegrid.tileWidth;
                            rect.Height = world.tilegrid.tileHeight;
                            spritebatch.Draw(GameServices.get<AssetManager>().CreateColoredTexture(trans), rect, Color.White);
                        }
                    }
                }

                spritebatch.End();
                spritebatch.Begin();
            }
        }


    }


}

There is alot of useless stuff in there for you guys, but I wanted to include it just for the sake of completeness.

I have the exact same problem with another class that has a Draw(SpriteBatch) function that needs to be overriden.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T01:35:12+00:00Added an answer on June 16, 2026 at 1:35 am

    Turned out that I was passing in a MonoGame spritebatch where the library was requiring an XNA spritebatch. I recompiled the library in a seperate project with MonoGame and all problems are sovled.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am pretty new to MySQL and databases but I'm trying to learn :)
Pretty new to C# but not new in programming in generally. I'm still trying
I'm pretty new to Android, I do know some Java though. I want to
Pretty new to Mono for Android (C#), and I'm seeming to have trouble during
Im pretty new to Java Web Services, but I cant find a good explanation
I'm pretty new to PHP, but I decided to try and make a simple
I am pretty new to buddypress. I am trying to do something pretty simple
Im pretty new to REST but as far as i have gathered i understand
I'm pretty new to Silex and Symfony and I'm trying to create a form
Pretty new to dependency injection and I'm trying to figure out if this is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.