# GravityChooser.GravityChooserMainMenuScreen Class Reference

The main menu screen is the first thing displayed when the game starts up. More...

Inheritance diagram for GravityChooser.GravityChooserMainMenuScreen:

List of all members.

## Public Member Functions
| GravityChooserMainMenuScreen ()
| Constructor fills in the menu contents.
override void | LoadContent ()
| Load graphics content for the screen.
override void | Update (GameTime gameTime, bool otherScreenHasFocus, bool coveredByOtherScreen)
| Update the main menu screen.
override void | Draw (GameTime gameTime)
| Draw the main menu screen.
## Protected Member Functions
override void | OnCancel (PlayerIndex playerIndex)
| When the user quits the main menu, returns code that sets gravity ENV variable.

## Detailed Description

The main menu screen is the first thing displayed when the game starts up.

Definition at line 20 of file GravityChooserMainMenuScreen.cs.

## Constructor & Destructor Documentation

GravityChooser.GravityChooserMainMenuScreen.GravityChooserMainMenuScreen | ( |  | ) |

Constructor fills in the menu contents.

Definition at line 35 of file GravityChooserMainMenuScreen.cs.

    00036             : base("Gravity Chooser")
    00037         {
    00038             // Create our menu entries.
    00039             this.chooseValueMenuEntry = new MenuEntry("*"); // text will be set later
    00040             MenuEntry optionsMenuEntry = new MenuEntry("Change Celestial Body");
    00041             MenuEntry helpMenuEntry = new MenuEntry("Module Controls Help");
    00042             MenuEntry infoMenuEntry = new MenuEntry("Module Information");
    00043             MenuEntry doneMenuEntry = new MenuEntry("Done");
    00044
    00045             // Hook up menu event handlers.
    00046             chooseValueMenuEntry.Selected += ChooseValueMenuEntrySelected;
    00047             optionsMenuEntry.Selected += OptionsMenuEntrySelected;
    00048             infoMenuEntry.Selected += InfoMenuEntrySelected;
    00049             helpMenuEntry.Selected += HelpMenuEntrySelected;
    00050             doneMenuEntry.Selected += OnCancel;
    00051
    00052             // Add entries to the menu.
    00053             MenuEntries.Add(chooseValueMenuEntry);
    00054             MenuEntries.Add(optionsMenuEntry);
    00055             MenuEntries.Add(infoMenuEntry);
    00056             MenuEntries.Add(helpMenuEntry);
    00057             MenuEntries.Add(doneMenuEntry);
    00058         }

## Member Function Documentation

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

Draw the main menu screen.

Parameters:

  | gameTime | The current game time.

Reimplemented from NewGamePhysics.StateManager.MenuScreen.

Definition at line 106 of file GravityChooserMainMenuScreen.cs.

    00107         {
    00108             base.Draw(gameTime);
    00109
    00110             // Draw scroller
    00111             SpriteBatch spriteBatch = ScreenManager.SpriteBatch;
    00112             scrollingInfoText.Draw(gameTime, spriteBatch);
    00113         }

override void GravityChooser.GravityChooserMainMenuScreen.LoadContent | ( |  | ) | `[virtual]`

Load graphics content for the screen.

Reimplemented from NewGamePhysics.StateManager.GameScreen.

Definition at line 60 of file GravityChooserMainMenuScreen.cs.

    00061         {
    00062             // Create scrollers
    00063             SpriteFont font = ScreenManager.Fonts["menu"];
    00064             GravityChooser game = (GravityChooser)ScreenManager.Game;
    00065             int width = game.GraphicsDevice.Viewport.Width;
    00066             scrollingInfoText = new ScrollingText("-", font, width, 400); // text will be set later
    00067
    00068             base.LoadContent();
    00069         }

override void GravityChooser.GravityChooserMainMenuScreen.OnCancel | ( | PlayerIndex | playerIndex | ) | `[protected, virtual]`

When the user quits the main menu, returns code that sets gravity ENV variable.

Parameters:

  | sender | The event sender
  | e | The event args.

Reimplemented from NewGamePhysics.StateManager.MenuScreen.

Definition at line 152 of file GravityChooserMainMenuScreen.cs.

    00153         {
    00154             // Set environment batch code
    00155             string batchCode = "set GRAVITY=" + GravityChooser.state.CurrentGravity.ToString();
    00156             File.WriteAllText("gravity.bat", batchCode);
    00157
    00158             ScreenManager.Game.Exit();
    00159         }

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

Update the main menu screen.

Parameters:

  | gameTime | The current game time.
  | otherScreenHasFocus | Flag indicating of another screen has the focus.
  | coveredByOtherScreen | Flag indicating of the screen is covered by another screen.

Reimplemented from NewGamePhysics.StateManager.MenuScreen.

Definition at line 82 of file GravityChooserMainMenuScreen.cs.

    00083         {
    00084             if (WaitForUncover)
    00085             {
    00086                 if ((!coveredByOtherScreen) || (!otherScreenHasFocus))
    00087                 {
    00088                     // Update the texts
    00089                     UpdateAllTexts();
    00090
    00091                     // Update menu text
    00092                     WaitForUncover = false;
    00093                 }
    00094             }
    00095
    00096             // Update scrollers
    00097             scrollingInfoText.Update(gameTime);
    00098
    00099             base.Update(gameTime, otherScreenHasFocus, coveredByOtherScreen);
    00100         }

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

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