- Main Page
- Classes
- Files

- File List

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

    00001 #region File Description
    00002 //-----------------------------------------------------------------------------
    00003 // GravityChooserBackgroundScreen.cs
    00004 // (A. Schiffler, 2009-2011)
    00005 //-----------------------------------------------------------------------------
    00006 #endregion
    00007
    00008 namespace GravityChooser
    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
    00019     class GravityChooserBackgroundScreen : GameScreen
    00020     {
    00021         #region Fields
    00022
    00026         ContentManager contentManager;
    00027
    00031         Texture2D backgroundTexture;
    00032
    00033         #endregion
    00034
    00035         #region Initialization
    00036
    00040         public GravityChooserBackgroundScreen()
    00041         {
    00042             TransitionOnTime = TimeSpan.FromSeconds(0.5);
    00043             TransitionOffTime = TimeSpan.FromSeconds(0.5);
    00044         }
    00045
    00049         public override void LoadContent()
    00050         {
    00051             if (contentManager == null)
    00052             {
    00053                 contentManager = new ContentManager(ScreenManager.Game.Services, "Content");
    00054             }
    00055
    00056             backgroundTexture = contentManager.Load<Texture2D>(@"Sprites\background");
    00057         }
    00058
    00062         public override void UnloadContent()
    00063         {
    00064             contentManager.Unload();
    00065         }
    00066
    00067         #endregion
    00068
    00069         #region Update and Draw
    00070
    00074         public override void Update(GameTime gameTime, bool otherScreenHasFocus,
    00075                                                        bool coveredByOtherScreen)
    00076         {
    00077             base.Update(gameTime, otherScreenHasFocus, false);
    00078         }
    00079
    00083         public override void Draw(GameTime gameTime)
    00084         {
    00085             SpriteBatch spriteBatch = ScreenManager.SpriteBatch;
    00086             Viewport viewport = ScreenManager.GraphicsDevice.Viewport;
    00087             Rectangle fullscreen = new Rectangle(0, 0, viewport.Width, viewport.Height);
    00088             byte fade = TransitionAlpha;
    00089
    00090             spriteBatch.Begin(SpriteBlendMode.None);
    00091
    00092             spriteBatch.Draw(backgroundTexture, fullscreen,
    00093                              new Color(fade, fade, fade));
    00094
    00095             spriteBatch.End();
    00096         }
    00097
    00098         #endregion
    00099     }
    00100 }