- Main Page
- Classes
- Files

- File List

# C:/Users/Andreas Schiffler/Desktop/SVN/NewGamePhysics/MontyHallGame/Screens/MontyHallOptionsMenuScreen.cs

    00001 //-----------------------------------------------------------------------------
    00002 // MontyHallOptionsMenuScreen.cs
    00003 // (C) A. Schiffler, 2009-2011
    00004 //-----------------------------------------------------------------------------
    00005
    00006 namespace MontyHallGame
    00007 {
    00008     using System;
    00009     using Microsoft.Xna.Framework;
    00010     using Microsoft.Xna.Framework.Graphics;
    00011
    00012     using NewGamePhysics.StateManager;
    00013     using NewGamePhysics.Utilities;
    00014     using NewGamePhysics.Physics;
    00015     using NewGamePhysics.GraphicalElements;
    00016
    00020     class MontyHallOptionsMenuScreen : MenuScreen
    00021     {
    00025         private ScrollingText scrollingInfoText;
    00026
    00027         #region constructor
    00028
    00032         public MontyHallOptionsMenuScreen()
    00033             : base("Monty Hall Game Options")
    00034         {
    00035             MenuEntry backMenuEntry = new MenuEntry("Back to Main Menu");
    00036             backMenuEntry.Selected += OnCancel;
    00037             MenuEntries.Add(backMenuEntry);
    00038         }
    00039
    00040         #endregion
    00041
    00042         public override void LoadContent()
    00043         {
    00044             base.LoadContent();
    00045
    00046             // Create scroller
    00047             SpriteFont font = ScreenManager.Fonts["menu"];
    00048             int width = ScreenManager.GraphicsDevice.Viewport.Width;
    00049             scrollingInfoText = new ScrollingText("-", font, width, 400); // text will be set later
    00050             scrollingInfoText.ScrollerSpeed = 200.0f;
    00051         }
    00052
    00063         public override void Update(GameTime gameTime, bool otherScreenHasFocus, bool coveredByOtherScreen)
    00064         {
    00065             if (WaitForUncover)
    00066             {
    00067                 if ((!coveredByOtherScreen) || (!otherScreenHasFocus))
    00068                 {
    00069                     // Update the texts
    00070                     UpdateAllTexts();
    00071
    00072                     // Update menu text
    00073                     WaitForUncover = false;
    00074                 }
    00075             }
    00076
    00077             // Update scrollers
    00078             scrollingInfoText.Update(gameTime);
    00079
    00080             base.Update(gameTime, otherScreenHasFocus, coveredByOtherScreen);
    00081         }
    00082
    00087         public override void Draw(GameTime gameTime)
    00088         {
    00089             base.Draw(gameTime);
    00090
    00091             // Draw scroller
    00092             SpriteBatch spriteBatch = ScreenManager.SpriteBatch;
    00093             scrollingInfoText.Draw(gameTime, spriteBatch);
    00094         }
    00095
    00096         #region private_methods
    00097
    00101         private void UpdateAllTexts()
    00102         {
    00103             // Scroller text
    00104             if (null != scrollingInfoText)
    00105             {
    00106                 scrollingInfoText.Text = "No options yet.";
    00107             }
    00108         }
    00109
    00110         #endregion
    00111
    00112         #region event_handlers
    00113
    00114         // None yet.
    00115
    00116         #endregion
    00117     }
    00118 }