# Followed the XNA GameStateManagement sln, but my doesn't work. What am I doing wrong?

If someone has the time I wanted to know if you would be willing to check out my solution file here: http://elvis.rowan.edu/~majeko02/AwesomeShip.zip

I followed the XNA GameStateManagement on AppHub, but nothing comes up from me. and I haven't the clue why.

I believe I done everything correctly and verified it as well.

I wanted to know if someone has the time could they check it out?

I am racking my brain trying to figure out why it doesn't work.

Any help, is greatly appreciated.

• Can you be more specific about what's not working? Does it compile? If so, what's not happening that should be happening? – michael.bartnett Mar 21 '11 at 0:23
• @bearcdp The window frame doesn't come up, but when I comment Components.Add(screenManager); line in the Game1.cs. It works but its the default with none of my screens. – Bombcode Mar 21 '11 at 0:46
• You are going to do so much better posting the code here than a download link. – The Communist Duck Mar 21 '11 at 18:34

You're getting stuck in an infinite loop in your ScreenManager.Update() function.

while(screensToUpdate.Count > 0)
{
GameScreen screen = screensToUpdate[screensToUpdate.Count - 1];
if(screen.ScreenState == ScreenState.TransitionOn || screen.ScreenState == ScreenState.Active)
{
if(!otherScreenHasFocus)
{
//screen.HandleInput(input);
otherScreenHasFocus = true;
}

if(!screen.IsPopUpMessage)
{
coveredByOtherScreen = true;
}
}
}


You're not reducing the screensToUpdate.Count and therefore it's always greater than 0.

EDIT:
I forgot to mention, if you had just stepped through the code you would have quickly found the issue. Use the debugger often and set lots of breakpoints :)

EDIT 2:
Just noticed the line

GameScreen screen = screensToUpdate[screensToUpdate.Count - 1];


This will cause you issues as well as it's only ever going to update the last screen in your screensToUpdate collection.

• 10 minutes ago I just stepped through the code, yes I noticed my infinite loop . Thanks for taking a look at it, and I just updated and got it up and running. No screens show up, but I will debug through it. – Bombcode Mar 21 '11 at 1:25