1
\$\begingroup\$

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?

Download link here: http://elvis.rowan.edu/~majeko02/AwesomeShip.zip

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

Any help, is greatly appreciated.

\$\endgroup\$
3
  • \$\begingroup\$ Can you be more specific about what's not working? Does it compile? If so, what's not happening that should be happening? \$\endgroup\$ Mar 21, 2011 at 0:23
  • \$\begingroup\$ @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. \$\endgroup\$
    – Bombcode
    Mar 21, 2011 at 0:46
  • \$\begingroup\$ You are going to do so much better posting the code here than a download link. \$\endgroup\$ Mar 21, 2011 at 18:34

1 Answer 1

2
\$\begingroup\$

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.

\$\endgroup\$
1
  • \$\begingroup\$ 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. \$\endgroup\$
    – Bombcode
    Mar 21, 2011 at 1:25

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .