# PendulumGame.PendulumBackgroundScreen Class Reference

The background screen sits behind all the other menu screens. It draws a background image that remains fixed in place regardless of whatever transitions the screens on top of it may be doing. More...

Inheritance diagram for PendulumGame.PendulumBackgroundScreen:

List of all members.

## Public Member Functions
| PendulumBackgroundScreen ()
| Constructor.
override void | LoadContent ()
| Loads graphics content for this screen. The background texture is quite big, so we use our own local ContentManager to load it. This allows us to unload before going from the menus into the game itself, wheras if we used the shared ContentManager provided by the Game class, the content would remain loaded forever.
override void | UnloadContent ()
| Unloads graphics content for this screen.
override void | Update (GameTime gameTime, bool otherScreenHasFocus, bool coveredByOtherScreen)
| Updates the background screen. Unlike most screens, this should not transition off even if it has been covered by another screen: it is supposed to be covered, after all! This overload forces the coveredByOtherScreen parameter to false in order to stop the base Update method wanting to transition off.
override void | Draw (GameTime gameTime)
| Draws the background screen.

## Detailed Description

The background screen sits behind all the other menu screens. It draws a background image that remains fixed in place regardless of whatever transitions the screens on top of it may be doing.

Definition at line 24 of file PendulumBackgroundScreen.cs.

## Constructor & Destructor Documentation

PendulumGame.PendulumBackgroundScreen.PendulumBackgroundScreen | ( |  | ) |

Constructor.

Definition at line 66 of file PendulumBackgroundScreen.cs.

    00067         {
    00068             TransitionOnTime = TimeSpan.FromSeconds(0.5);
    00069             TransitionOffTime = TimeSpan.FromSeconds(0.5);
    00070         }

## Member Function Documentation

override void PendulumGame.PendulumBackgroundScreen.Draw | ( | GameTime | gameTime | ) | `[virtual]`

Draws the background screen.

Reimplemented from NewGamePhysics.StateManager.GameScreen.

Definition at line 139 of file PendulumBackgroundScreen.cs.

    00140         {
    00141             SpriteBatch spriteBatch = ScreenManager.SpriteBatch;
    00142             Viewport viewport = ScreenManager.GraphicsDevice.Viewport;
    00143             Rectangle fullscreen = new Rectangle(0, 0, viewport.Width, viewport.Height);
    00144             byte transparency = TransitionAlpha;
    00145             byte intensity = 192;
    00146
    00147             spriteBatch.Begin(SpriteBlendMode.None);
    00148             spriteBatch.Draw(
    00149                 backgroundTexture,
    00150                 fullscreen,
    00151                 Color.White);
    00152             spriteBatch.End();
    00153
    00154             spriteBatch.Begin(SpriteBlendMode.AlphaBlend);
    00155             if (videoTexture != null)
    00156             {
    00157                 spriteBatch.Draw(
    00158                     videoTexture,
    00159                     fullscreen,
    00160                     new Color(intensity, intensity, intensity, transparency));
    00161             }
    00162
    00163             spriteBatch.Draw(
    00164                 frameTexture,
    00165                 fullscreen,
    00166                 Color.White);
    00167             spriteBatch.End();
    00168
    00169             // If the game is transitioning on or off, fade it out to black.
    00170             if (TransitionPosition > 0)
    00171             {
    00172                 ScreenManager.FadeBackBufferToBlack(255 - TransitionAlpha);
    00173             }
    00174         }

override void PendulumGame.PendulumBackgroundScreen.LoadContent | ( |  | ) | `[virtual]`

Loads graphics content for this screen. The background texture is quite big, so we use our own local ContentManager to load it. This allows us to unload before going from the menus into the game itself, wheras if we used the shared ContentManager provided by the Game class, the content would remain loaded forever.

Reimplemented from NewGamePhysics.StateManager.GameScreen.

Definition at line 80 of file PendulumBackgroundScreen.cs.

    00081         {
    00082             if (content == null)
    00083             {
    00084                 content = new ContentManager(ScreenManager.Game.Services, "Content");
    00085             }
    00086
    00087             backgroundTexture = content.Load<Texture2D>(@"Sprites\background");
    00088             frameTexture = content.Load<Texture2D>(@"Sprites\frame");
    00089             videoFile = content.Load<Video>(@"Videos\DoublePendulumTitle-CBR");
    00090         }

override void PendulumGame.PendulumBackgroundScreen.UnloadContent | ( |  | ) | `[virtual]`

Unloads graphics content for this screen.

Reimplemented from NewGamePhysics.StateManager.GameScreen.

Definition at line 95 of file PendulumBackgroundScreen.cs.

    00096         {
    00097             ScreenManager.VideoPlayer.Stop();
    00098             content.Unload();
    00099         }

override void PendulumGame.PendulumBackgroundScreen.Update | ( | GameTime | gameTime,
|  | bool | otherScreenHasFocus,
|  | bool | coveredByOtherScreen |
| ) |  |  | `[virtual]`

Updates the background screen. Unlike most screens, this should not transition off even if it has been covered by another screen: it is supposed to be covered, after all! This overload forces the coveredByOtherScreen parameter to false in order to stop the base Update method wanting to transition off.

Reimplemented from NewGamePhysics.StateManager.GameScreen.

Definition at line 114 of file PendulumBackgroundScreen.cs.

    00116         {
    00117             base.Update(gameTime, otherScreenHasFocus, false);
    00118             if (!videoStarted)
    00119             {
    00120                 ScreenManager.VideoPlayer.Play(videoFile);
    00121                 videoStarted = true;
    00122             }
    00123             else
    00124             {
    00125                 if (ScreenManager.VideoPlayer.State == MediaState.Playing)
    00126                 {
    00127                     videoTexture = ScreenManager.VideoPlayer.GetTexture();
    00128                 }
    00129                 else if (ScreenManager.VideoPlayer.State == MediaState.Stopped)
    00130                 {
    00131                     videoStarted = false;
    00132                 }
    00133             }
    00134         }

The documentation for this class was generated from the following file:

- C:/Users/Andreas Schiffler/Desktop/SVN/NewGamePhysics/PendulumGame/Screens/PendulumBackgroundScreen.cs