Multiple pages in game

I’m looking at adding splash, options and about pages to a game I was messing about with ages ago.

A long while back I stumbled on a C# template with a multi class setup for handling multiple pages, fades between and some other cool stuff. Of course I’ve lost the link to it! I don’t have a problem writing the code to do all these things, but I’m wondering about the best practice solution.

My understanding of Monogame falls down when it comes to the lower levels. Where to the main routines get called from? How can I divert the call to Update and Draw? Of course I can run some logic in the main routines to call different classes or modules but is this the most efficient?

Because all my code so far is based around the game page all my declarations are private, are there any issues in making everything public, SpriteBatch etc?

If these issues have been addressed or documented somewhere could someone please pop me a link?

Thanks.

Are you looking for a way to manage independent systems like splash, intro, menu, game, etc, without having an ever-branching if-tree of game-states??

I have made each such ‘feature’ its own sub-class of a class “Main_Feature”…
(MainMenu : Main_Feature) (Intro : Main_Feature) (Game :Main_Feature) and so on…

In my Main (game1 or whatever), I have a list of Main_Features called “active features”.

In the update and draw cycle, I use a foreach loop to iterate through and draw/update each active feature on this list…

So, you boot the game with an instance of the splash class in “active features”…
This class recieves input as an overload in the Update() method., and if it gets a “return key” it adds an instance of the “MainMenu” class to the “active features” list, and activates the method to remove ITSELF from the “active features” list…

This way, you can work with specific features without a lot of if-checking, and load any part of the game, or disables somthing, at any point with ease.

You’ll want to use a ScreenManager of some sort. Here’s an example from the MonoGame-Samples repo