- Main Page
- Classes
- Files

- File List

# C:/Users/Andreas Schiffler/Desktop/SVN/NewGamePhysics/GravityChooser/Screens/GravityChooserPauseMenuScreen.cs

    00001 //-----------------------------------------------------------------------------
    00002 // GravityChooserPauseMenuScreen.cs
    00003 // (A. Schiffler, 2009-2011)
    00004 //-----------------------------------------------------------------------------
    00005
    00006 namespace GravityChooser
    00007 {
    00008     using Microsoft.Xna.Framework;
    00009     using NewGamePhysics.StateManager;
    00010
    00015     class GravityChooserPauseMenuScreen : MenuScreen
    00016     {
    00017         #region Initialization
    00018
    00022         public GravityChooserPauseMenuScreen()
    00023             : base("Paused")
    00024         {
    00025             // Flag that there is no need for the game to transition
    00026             // off when the pause menu is on top of it.
    00027             IsPopup = true;
    00028
    00029             // Create our menu entries.
    00030             MenuEntry resumeGameMenuEntry = new MenuEntry("Resume Game");
    00031             MenuEntry quitGameMenuEntry = new MenuEntry("Quit Game");
    00032
    00033             // Hook up menu event handlers.
    00034             resumeGameMenuEntry.Selected += OnCancel;
    00035             quitGameMenuEntry.Selected += QuitGameMenuEntrySelected;
    00036
    00037             // Add entries to the menu.
    00038             MenuEntries.Add(resumeGameMenuEntry);
    00039             MenuEntries.Add(quitGameMenuEntry);
    00040         }
    00041
    00042         #endregion
    00043
    00044         #region Handle Input
    00045
    00049         void QuitGameMenuEntrySelected(object sender, PlayerIndexEventArgs e)
    00050         {
    00051             const string message = "Are you sure you want to quit this game?";
    00052
    00053             GravityChooserMessageBoxScreen confirmQuitMessageBox = new GravityChooserMessageBoxScreen(message);
    00054
    00055             confirmQuitMessageBox.Accepted += ConfirmQuitMessageBoxAccepted;
    00056
    00057             ScreenManager.AddScreen(confirmQuitMessageBox, ControllingPlayer);
    00058         }
    00059
    00065         void ConfirmQuitMessageBoxAccepted(object sender, PlayerIndexEventArgs e)
    00066         {
    00067             GravityChooserLoadingScreen.Load(ScreenManager, false, null, new GravityChooserBackgroundScreen(),
    00068                                                            new GravityChooserMainMenuScreen());
    00069         }
    00070
    00071         #endregion
    00072
    00073         #region Draw
    00074
    00079         public override void Draw(GameTime gameTime)
    00080         {
    00081             ScreenManager.FadeBackBufferToBlack(TransitionAlpha * 2 / 3);
    00082
    00083             base.Draw(gameTime);
    00084         }
    00085
    00086         #endregion
    00087     }
    00088 }