/* * PauseScreen.cs * Authors: Adam Nabinger * Copyright (c) 2007-2008 Cornell University This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Util; namespace MaritimeDefender { /// /// Defines how the pause menu screen for Maritime Defender functions /// internal class PauseScreen : MenuScreen { #region Creation /// /// Constructor /// /// Reference to the Maritime Defender game screen public PauseScreen(MaritimeDefender game) : base(game) { } #endregion #region Management /// /// Loads in any necessary information for all content dependent objects /// protected override void LoadContent() { mBackground = Content.Load(@"General\DialogBackground"); mMousePointer = Content.Load(@"General\StandardCursor"); int screenWidth = GraphicsDevice.Viewport.Width; int screenHeight = GraphicsDevice.Viewport.Height; mBackgroundLocation = new Rectangle((int)(screenWidth * 0.25f), (int)(screenHeight * 0.125f), (int)(screenWidth * 0.5f), (int)(screenHeight * 0.75f)); mMouseLocation = new Rectangle(0, 0, mMousePointer.Width, mMousePointer.Height); int buttonWidth = (int)(screenWidth * 0.22f); int buttonHeight = (int)(screenHeight * 0.09f); int buttonX = (int)(screenWidth * .5f) - (buttonWidth >> 1); mButtons = new MenuButton[4]; mButtons[0] = new MenuButton(@"General\PauseResume", new Rectangle(buttonX, (int)(screenHeight * 0.25f), buttonWidth, buttonHeight), delegate { Done(); }); mButtons[1] = new MenuButton(@"General\PauseRestart", new Rectangle(buttonX, (int)(screenHeight * 0.375f), buttonWidth, buttonHeight), delegate(GameScreen game) { Done(); (game as MaritimeDefender).RestartGame(); }); mButtons[2] = new MenuButton(@"General\PauseMainMenu", new Rectangle(buttonX, (int)(screenHeight * 0.5f), buttonWidth, buttonHeight), delegate(GameScreen game) { Done(); (game as MaritimeDefender).ReturnToTitleScreen(); }); mButtons[3] = new MenuButton(@"General\PauseQuit", new Rectangle(buttonX, (int)(screenHeight * 0.625f), buttonWidth, buttonHeight), delegate(GameScreen game) { Done(); (game as MaritimeDefender).Quit(); }); base.LoadContent(); } #endregion } }