- Main Page
- Classes
- Files

- File List

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

    00001 #region File Description
    00002 //-----------------------------------------------------------------------------
    00003 // MontyHallBackgroundScreen.cs
    00004 // (C) A. Schiffler, 2009-2011
    00005 //-----------------------------------------------------------------------------
    00006 #endregion
    00007
    00008 namespace MontyHallGame
    00009 {
    00010     using System;
    00011     using Microsoft.Xna.Framework;
    00012     using Microsoft.Xna.Framework.Content;
    00013     using Microsoft.Xna.Framework.Graphics;
    00014     using NewGamePhysics.StateManager;
    00015
    00021     class MontyHallBackgroundScreen : GameScreen
    00022     {
    00023         #region Fields
    00024
    00025         ContentManager content;
    00026         Texture2D backgroundTexture;
    00027
    00028         #endregion
    00029
    00030         #region Initialization
    00031
    00032
    00036         public MontyHallBackgroundScreen()
    00037         {
    00038             TransitionOnTime = TimeSpan.FromSeconds(0.5);
    00039             TransitionOffTime = TimeSpan.FromSeconds(0.5);
    00040         }
    00041
    00042
    00050         public override void LoadContent()
    00051         {
    00052             if (content == null)
    00053             {
    00054                 content = new ContentManager(ScreenManager.Game.Services, "Content");
    00055             }
    00056
    00057             backgroundTexture = content.Load<Texture2D>(@"Sprites\background");
    00058         }
    00059
    00060
    00064         public override void UnloadContent()
    00065         {
    00066             content.Unload();
    00067         }
    00068
    00069
    00070         #endregion
    00071
    00072         #region Update and Draw
    00073
    00074
    00082         public override void Update(GameTime gameTime, bool otherScreenHasFocus,
    00083                                                        bool coveredByOtherScreen)
    00084         {
    00085             base.Update(gameTime, otherScreenHasFocus, false);
    00086         }
    00087
    00088
    00092         public override void Draw(GameTime gameTime)
    00093         {
    00094             SpriteBatch spriteBatch = ScreenManager.SpriteBatch;
    00095             Viewport viewport = ScreenManager.GraphicsDevice.Viewport;
    00096             Rectangle fullscreen = new Rectangle(0, 0, viewport.Width, viewport.Height);
    00097             byte fade = TransitionAlpha;
    00098
    00099             spriteBatch.Begin(SpriteBlendMode.None);
    00100
    00101             spriteBatch.Draw(backgroundTexture, fullscreen,
    00102                              new Color(fade, fade, fade));
    00103
    00104             spriteBatch.End();
    00105         }
    00106
    00107
    00108         #endregion
    00109     }
    00110 }