Ecrofirt

Hi all,

I'm fairly certain that I saw a link or post here within the past month where someone described a way to set up multiple game screens (menu screen, actual gameplay screen, pause screen, etc) via a stack of some sort.

I've been searching the forum trying to find the elusive topic, but I'm having no luck. I'm trying to decide how exactly I should go about setting up my game so that it can easily have multiple windows without a big jumbled mess of code.

As such, I was thinking about that tutorial I skimmed, and I was thinknig of doing something like this:
> Have some sort of generic Screen class that references Game1's graphics device. Use this as a parent class
> Using polymorphism, create the other screens. Each screen would be drawable, and each would handle user input uniquely.

>Create a ScreenManager that has some sort of list/stack of screens. As screens are added, others become disabled (so they don't draw to the screen). As screens are removed, the new last/top screen becomes re-enabled.

Something like this seems like it might work, but I'm pretty unsure as to whether or not I'm going about this the correct way.

Seeing that tutorial again would help me a ton. So would someone who might be able to help describe the basic idea behind what I should be doing so I know I'm not going to code myself into a corner somehow.

Thanks for your help guys and gals!


Re: XNA Game Studio Express Looking for help/advice with multiple game 'screens'

Jim Perry

Clicky




Re: XNA Game Studio Express Looking for help/advice with multiple game 'screens'

Ecrofirt



Jim, you get a box of pizza for that link! Exactly the tutorial I was referring to!


Thanks a billion!




Re: XNA Game Studio Express Looking for help/advice with multiple game 'screens'

AlfonsAberg

I asked this forum the same question some time ago, here is the thread. And I also found this great post on the subject.

http://forums.microsoft.com/MSDN/ShowPost.aspx PostID=1039195&SiteID=1
http://gameylittlehacker.blogspot.com/2007/01/xna-game-structure-thoughts.html


Cheers!
Alfons