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...

  • \$\begingroup\$ In any case, it looks like the first screen added is the one that is active. But not sure how to switch... \$\endgroup\$ – Fedor Steeman Nov 25 '18 at 13:29
  • \$\begingroup\$ Hey, I figured it out! Will post answer soon... \$\endgroup\$ – Fedor Steeman Nov 25 '18 at 20:28

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.