Switch screens with MonoGame.Extended - ScreenGameComponent

by Fedor Steeman   Last Updated November 25, 2018 12:13 PM - source

I'm trying to piece together a very simple game foundation based on MonoGame.Extended from the documentation and tutorials I can find on the internet.

For starters, I wanted to setup the different screens in the game. This is how far I got:

    public class SomeGame : Game
        private readonly GraphicsDeviceManager graphics;
        public static SpriteBatch SpriteBatch;
        public static WindowViewportAdapter ViewportAdapter;

        public EvoDevoGame()
            graphics = new GraphicsDeviceManager(this);
            Content.RootDirectory = "Content";
            IsMouseVisible = true;

            ScreenGameComponent screenGameComponent = new ScreenGameComponent(this);

            screenGameComponent.Register(new SplashScreen());
            screenGameComponent.Register(new MenuScreen());
            screenGameComponent.Register(new SinglePlayerMenuScreen());
            screenGameComponent.Register(new CreateWorldScreen());
            screenGameComponent.Register(new GameScreen());

I am trying to figure out the dynamics here. How does the game or screenmanager know what screen to show and how to switch screens? I'm a bit in the dark about that...

Related Questions

Using gametime.ElapsedGameTime to trigger an event

Updated November 26, 2017 17:13 PM