I’m a little troubled now. I don’t have any ideas on how to change from one screen to another.
Lets say, I have a title screen, and a “main game” screen. I know how to create a new window with the main game, but the title screen window is there too. Is there a way to change from one screen/scene to another but without creating a new window?
You can make use of a gamestate that you define and check for in your Draw function to decide which screen to draw.
There is a monogame sample on Github which includes a ScreenManager. A ScreenManager is probably the thing that you want.
Check out a guy on youtube called CodingMadeEasy
In particular I like his two tutorials “XNA Platformer” and “MonoGame RPG”.
I learnt enough from them videos to roll my own screen manager.
I wrote a simple screenmanager for doing transitions earlier, I’ll see if I can put it on github tonight or tomorrow. It doesn’t handle screens on top of screens though (the screenmanager from the samples does IIRC, but it can only handle fading transitions and hardcoded the parameters which I didn’t like).
My plan is to have a screenmanager that has a list of screens, screens have a list of entities and entities have a list of sub entities. in my game class update and draw:
and inside screenmanager
foreach (screen in screens)
if (screen.updating) screen.update(gameTime)
// same again for draw
Then inside each screen class it does a foreach for each entity to update and draw itself etc. trickles down like that.
I will look on all these things now. When I finish I will post the resuts. Thanks to all.