Quantcast
Channel: Community | MonoGame - Latest topics
Viewing all articles
Browse latest Browse all 6821

There is no argument given that corresponds to the required formal parameter 'game' of 'GameManager.GameManager(Game)

$
0
0

@Shadowblitz16 wrote:

can someone explain to me why monogame won't compile and is spitting out this error?

There is no argument given that corresponds to the required formal parameter 'game' of 'GameManager.GameManager(Game)

I am trying to make a wrapper for monogame so that its easier to use.

using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Input;
using MonoGame.Extended;
using Quester.Classes;
using System;

namespace Quester
{

    public class GameManager : Microsoft.Xna.Framework.Game
    {
        Game Game;
        
        public GameManager(Game game) : base()
        {
            Game = game;
            Graphics.Init(this);
        }

        protected override void Initialize()
        {
            // TODO: Add your initialization logic here

            base.Initialize();
            Game.Init();
        }
        protected override void LoadContent()
        {

        }
        protected override void UnloadContent()
        {
        }
        protected override void Update(GameTime gameTime)
        {
            if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape))

            Game.Tick();
            base.Update(gameTime);
        }
        protected override void Draw(GameTime gameTime)
        {
            Graphics.SpriteBatch.Begin(SpriteSortMode.BackToFront); //internal function
            Game.Draw();
            base.Draw(gameTime);
            Graphics.SpriteBatch.End(); //internal function
        }
        protected void Quit()
        {
            Game.Quit();
        }

    }
    public class Game : IDisposable
    {
        private GameManager GameManager;
        public  Game()
        {
            GameManager = new GameManager(this);
        }
        public void Run()
        {
            GameManager.Run();
        }

        public virtual void Init()
        {

        }
        public virtual void Tick()
        {

        }
        public virtual void Draw()
        {

        }
        public virtual void Exit()
        {

        }

        public void Quit()
        {
            GameManager.Exit();
        }
        public void Dispose()
        {
            GameManager.Dispose();
        }
    }
}

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 6821

Trending Articles