- Main Page
- Classes
- Files

- File List

# C:/Users/Andreas Schiffler/Desktop/SVN/NewGamePhysics/PendulumGame/Screens/PendulumPauseMenuScreen.cs

    00001 #region File Description
    00002 //-----------------------------------------------------------------------------
    00003 // PendulumPauseMenuScreen.cs
    00004 //-----------------------------------------------------------------------------
    00005 #endregion
    00006
    00007 namespace PendulumGame
    00008 {
    00009     using Microsoft.Xna.Framework;
    00010     using NewGamePhysics.StateManager;
    00011
    00016     class PendulumPauseMenuScreen : MenuScreen
    00017     {
    00018         #region Initialization
    00019
    00020
    00024         public PendulumPauseMenuScreen()
    00025             : base("Paused")
    00026         {
    00027             // Flag that there is no need for the game to transition
    00028             // off when the pause menu is on top of it.
    00029             IsPopup = true;
    00030
    00031             // Create our menu entries.
    00032             MenuEntry resumeGameMenuEntry = new MenuEntry("Resume Game");
    00033             MenuEntry quitGameMenuEntry = new MenuEntry("Quit Game");
    00034
    00035             // Hook up menu event handlers.
    00036             resumeGameMenuEntry.Selected += OnCancel;
    00037             quitGameMenuEntry.Selected += QuitGameMenuEntrySelected;
    00038
    00039             // Add entries to the menu.
    00040             MenuEntries.Add(resumeGameMenuEntry);
    00041             MenuEntries.Add(quitGameMenuEntry);
    00042         }
    00043
    00044
    00045         #endregion
    00046
    00047         #region Handle Input
    00048
    00049
    00053         void QuitGameMenuEntrySelected(object sender, PlayerIndexEventArgs e)
    00054         {
    00055             const string message = "Are you sure you want to quit this game?";
    00056
    00057             PendulumMessageBoxScreen confirmQuitMessageBox = new PendulumMessageBoxScreen(message);
    00058
    00059             confirmQuitMessageBox.Accepted += ConfirmQuitMessageBoxAccepted;
    00060
    00061             ScreenManager.AddScreen(confirmQuitMessageBox, e.PlayerIndex);
    00062         }
    00063
    00069         void ConfirmQuitMessageBoxAccepted(object sender, PlayerIndexEventArgs e)
    00070         {
    00071             PendulumLoadingScreen.Load(ScreenManager, false, null, new PendulumBackgroundScreen(),
    00072                                                            new PendulumMainMenuScreen());
    00073         }
    00074
    00075
    00076         #endregion
    00077
    00078         #region Draw
    00079
    00080
    00085         public override void Draw(GameTime gameTime)
    00086         {
    00087             ScreenManager.FadeBackBufferToBlack(TransitionAlpha * 2 / 3);
    00088
    00089             base.Draw(gameTime);
    00090         }
    00091
    00092
    00093         #endregion
    00094     }
    00095 }