# PendulumGame.PendulumLoadingScreen Class Reference

The loading screen coordinates transitions between the menu system and the game itself. The loading screen will be the only thing displayed while this load is taking place. More...

Inheritance diagram for PendulumGame.PendulumLoadingScreen:

List of all members.

## Public Member Functions
override void | LoadContent ()
| Load graphics content for the game.
override void | UnloadContent ()
| Unload graphics content used by the screen.
override void | Update (GameTime gameTime, bool otherScreenHasFocus, bool coveredByOtherScreen)
| Updates the loading screen.
override void | Draw (GameTime gameTime)
| Draws the loading screen.
## Static Public Member Functions
static void | Load (ScreenManager screenManager, bool loadingIsSlow, PlayerIndex?controllingPlayer, params GameScreen[] screensToLoad)
| Activates the loading screen.

## Detailed Description

The loading screen coordinates transitions between the menu system and the game itself. The loading screen will be the only thing displayed while this load is taking place.

Definition at line 23 of file PendulumLoadingScreen.cs.

## Member Function Documentation

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

Draws the loading screen.

Reimplemented from NewGamePhysics.StateManager.GameScreen.

Definition at line 125 of file PendulumLoadingScreen.cs.

    00126         {
    00127             // If we are the only active screen, that means all the previous screens
    00128             // must have finished transitioning off. We check for this in the Draw
    00129             // method, rather than in Update, because it isn't enough just for the
    00130             // screens to be gone: in order for the transition to look good we must
    00131             // have actually drawn a frame without them before we perform the load.
    00132             if ((ScreenState == ScreenState.Active) &&
    00133                 (ScreenManager.GetScreens().Length == 1))
    00134             {
    00135                 otherScreensAreGone = true;
    00136             }
    00137
    00138             // The gameplay screen takes a while to load, so we display a loading
    00139             // message while that is going on, but the menus load very quickly, and
    00140             // it would look silly if we flashed this up for just a fraction of a
    00141             // second while returning from the game to the menus. This parameter
    00142             // tells us how long the loading is going to take, so we know whether
    00143             // to bother drawing the message.
    00144             if (loadingIsSlow)
    00145             {
    00146                 SpriteBatch spriteBatch = ScreenManager.SpriteBatch;
    00147                 SpriteFont font = ScreenManager.Fonts["game"];
    00148
    00149                 const string message = "Loading...";
    00150
    00151                 // Center the text in the viewport.
    00152                 Viewport viewport = ScreenManager.GraphicsDevice.Viewport;
    00153                 Vector2 viewportSize = new Vector2(viewport.Width, viewport.Height);
    00154                 Vector2 textSize = font.MeasureString(message);
    00155                 Vector2 textPosition = (viewportSize - textSize) / 2;
    00156
    00157                 Color color = new Color(255, 255, 255, TransitionAlpha);
    00158
    00159                 // Draw the text.
    00160                 spriteBatch.Begin();
    00161                 spriteBatch.DrawString(font, message, textPosition, color);
    00162                 spriteBatch.End();
    00163             }
    00164         }

static void PendulumGame.PendulumLoadingScreen.Load | ( | ScreenManager | screenManager,
|  | bool | loadingIsSlow,
|  | PlayerIndex? | controllingPlayer,
|  | params GameScreen[] | screensToLoad |
| ) |  |  | `[static]`

Activates the loading screen.

Definition at line 70 of file PendulumLoadingScreen.cs.

    00074         {
    00075             // Tell all the current screens to transition off.
    00076             foreach (GameScreen screen in screenManager.GetScreens())
    00077             {
    00078                 screen.ExitScreen();
    00079             }
    00080
    00081             // Create and activate the loading screen.
    00082             PendulumLoadingScreen loadingScreen = new PendulumLoadingScreen(screenManager,
    00083                                                             loadingIsSlow,
    00084                                                             screensToLoad);
    00085
    00086             screenManager.AddScreen(loadingScreen, controllingPlayer);
    00087         }

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

Load graphics content for the game.

Reimplemented from NewGamePhysics.StateManager.GameScreen.

Definition at line 54 of file PendulumLoadingScreen.cs.

    00055         {
    00056             // Reset game time
    00057             ScreenManager.Game.ResetElapsedTime();
    00058         }

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

Unload graphics content used by the screen.

Reimplemented from NewGamePhysics.StateManager.GameScreen.

Definition at line 63 of file PendulumLoadingScreen.cs.

    00064         {
    00065         }

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

Updates the loading screen.

Reimplemented from NewGamePhysics.StateManager.GameScreen.

Definition at line 96 of file PendulumLoadingScreen.cs.

    00098         {
    00099             base.Update(gameTime, otherScreenHasFocus, coveredByOtherScreen);
    00100
    00101             // If all the previous screens have finished transitioning
    00102             // off, it is time to actually perform the load.
    00103             if (otherScreensAreGone)
    00104             {
    00105                 ScreenManager.RemoveScreen(this);
    00106
    00107                 foreach (GameScreen screen in screensToLoad)
    00108                 {
    00109                     if (screen != null)
    00110                     {
    00111                         ScreenManager.AddScreen(screen, null);
    00112                     }
    00113                 }
    00114
    00115                 // Once the load has finished, we use ResetElapsedTime to tell
    00116                 // the  game timing mechanism that we have just finished a very
    00117                 // long frame, and that it should not try to catch up.
    00118                 ScreenManager.Game.ResetElapsedTime();
    00119             }
    00120         }

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

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