# GravityChooser.GravityChooserLoadingScreen Class Reference

The loading screen to coordinates transitions. More...

Inheritance diagram for GravityChooser.GravityChooserLoadingScreen:

List of all members.

## Public Member Functions
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 to coordinates transitions.

Definition at line 16 of file GravityChooserLoadingScreen.cs.

## Member Function Documentation

override void GravityChooser.GravityChooserLoadingScreen.Draw | ( | GameTime | gameTime | ) | `[virtual]`

Draws the loading screen.

Reimplemented from NewGamePhysics.StateManager.GameScreen.

Definition at line 107 of file GravityChooserLoadingScreen.cs.

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

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

Activates the loading screen.

Definition at line 55 of file GravityChooserLoadingScreen.cs.

    00058         {
    00059             // Tell all the current screens to transition off.
    00060             foreach (GameScreen screen in screenManager.GetScreens())
    00061                 screen.ExitScreen();
    00062
    00063             // Create and activate the loading screen.
    00064             GravityChooserLoadingScreen loadingScreen = new GravityChooserLoadingScreen(screenManager,
    00065                                                             loadingIsSlow,
    00066                                                             screensToLoad);
    00067
    00068             screenManager.AddScreen(loadingScreen, null);
    00069         }

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

Updates the loading screen.

Reimplemented from NewGamePhysics.StateManager.GameScreen.

Definition at line 78 of file GravityChooserLoadingScreen.cs.

    00080         {
    00081             base.Update(gameTime, otherScreenHasFocus, coveredByOtherScreen);
    00082
    00083             // If all the previous screens have finished transitioning
    00084             // off, it is time to actually perform the load.
    00085             if (otherScreensAreGone)
    00086             {
    00087                 ScreenManager.RemoveScreen(this);
    00088
    00089                 foreach (GameScreen screen in screensToLoad)
    00090                 {
    00091                     if (screen != null)
    00092                     {
    00093                         ScreenManager.AddScreen(screen, null);
    00094                     }
    00095                 }
    00096
    00097                 // Once the load has finished, we use ResetElapsedTime to tell
    00098                 // the  game timing mechanism that we have just finished a very
    00099                 // long frame, and that it should not try to catch up.
    00100                 ScreenManager.Game.ResetElapsedTime();
    00101             }
    00102         }

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

- C:/Users/Andreas Schiffler/Desktop/SVN/NewGamePhysics/GravityChooser/Screens/GravityChooserLoadingScreen.cs