# GravityChooser.GravityChooser Class Reference

This is the main type of the game. More...

List of all members.

## Public Member Functions
| GravityChooser (bool fullscreen)
| Constructor of game.
## Static Public Attributes
static GravityChooserState | state = new GravityChooserState()
| The current game state.
## Protected Member Functions
override void | Initialize ()
| Allows the game to perform any initialization it needs to before starting to run. This is where it can query for any required services and load any non-graphic related content. Calling base.Initialize will enumerate through any components and initialize them as well.
override void | LoadContent ()
| LoadContent will be called once per game and is the place to load all of your content.
override void | UnloadContent ()
| UnloadContent will be called once per game and is the place to unload all content.
override void | Update (GameTime gameTime)
| Allows the game to run logic such as updating the world, checking for collisions, gathering input, and playing audio.
override void | Draw (GameTime gameTime)
| This is called when the game should draw itself.

## Detailed Description

This is the main type of the game.

Definition at line 17 of file GravityChooser.cs.

## Constructor & Destructor Documentation

GravityChooser.GravityChooser.GravityChooser | ( | bool | fullscreen | ) |

Constructor of game.

Parameters:

  | fullscreen | Enable fullscreen mode if flag is set.

Definition at line 37 of file GravityChooser.cs.

    00038         {
    00039             // New input object
    00040             gamepads = new Gamepads();
    00041
    00042             // Content root
    00043             Content.RootDirectory = "Content";
    00044
    00045             // Prefer a resolution suitable for both Windows and XBox 360
    00046             graphics = new GraphicsDeviceManager(this);
    00047             graphics.PreferredBackBufferWidth = 853;
    00048             graphics.PreferredBackBufferHeight = 480;
    00049
    00050             // Maybe set to fullscreen
    00051             graphics.IsFullScreen = fullscreen;
    00052
    00053             // Enable antialiasing
    00054             graphics.PreferMultiSampling = true;
    00055
    00056             // Create the screen manager component.
    00057             screenManager = new ScreenManager(this);
    00058             Components.Add(screenManager);
    00059         }

## Member Function Documentation

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

This is called when the game should draw itself.

Parameters:

  | gameTime | Provides a snapshot of timing values.

Definition at line 141 of file GravityChooser.cs.

    00142         {
    00143             // Clear to black
    00144             graphics.GraphicsDevice.Clear(Color.Black);
    00145
    00146             // Redraw
    00147             base.Draw(gameTime);
    00148         }

override void GravityChooser.GravityChooser.Initialize | ( |  | ) | `[protected]`

Allows the game to perform any initialization it needs to before starting to run. This is where it can query for any required services and load any non-graphic related content. Calling base.Initialize will enumerate through any components and initialize them as well.

Definition at line 67 of file GravityChooser.cs.

    00068         {
    00069             // Current viewport
    00070             viewport = graphics.GraphicsDevice.Viewport;
    00071
    00072             // Enable mouse
    00073             this.IsMouseVisible = true;
    00074
    00075             // Aspect ratio
    00076             float aspectRatio = graphics.GraphicsDevice.Viewport.Width /
    00077                 (float)graphics.GraphicsDevice.Viewport.Height;
    00078
    00079             // Create the projection matrix.
    00080             projectionMatrix = Matrix.CreatePerspectiveFieldOfView(
    00081                 MathHelper.ToRadians(45.0f), aspectRatio, 1f, 10000);
    00082
    00083             base.Initialize();
    00084         }

override void GravityChooser.GravityChooser.LoadContent | ( |  | ) | `[protected]`

LoadContent will be called once per game and is the place to load all of your content.

Definition at line 90 of file GravityChooser.cs.

    00091         {
    00092             // Load textures
    00093
    00094             // Load fonts
    00095             screenManager.AddFont("retro", "Fonts/retroMedium");
    00096             screenManager.AddFont("courier", "Fonts/courier");
    00097
    00098             // Activate the first screens.
    00099             screenManager.AddScreen(new GravityChooserBackgroundScreen(), null);
    00100             screenManager.AddScreen(new GravityChooserMainMenuScreen(), null);
    00101         }

override void GravityChooser.GravityChooser.UnloadContent | ( |  | ) | `[protected]`

UnloadContent will be called once per game and is the place to unload all content.

Definition at line 107 of file GravityChooser.cs.

    00108         {
    00109             // Unload any non ContentManager content here
    00110         }

override void GravityChooser.GravityChooser.Update | ( | GameTime | gameTime | ) | `[protected]`

Allows the game to run logic such as updating the world, checking for collisions, gathering input, and playing audio.

Parameters:

  | gameTime | Provides a snapshot of timing values.

Definition at line 117 of file GravityChooser.cs.

    00118         {
    00119             // Keyboard state
    00120             KeyboardState keyState = Keyboard.GetState();
    00121             Keys[] keys = keyState.GetPressedKeys();
    00122
    00123             // Allows the game to exit
    00124             if (keyState.IsKeyDown(Keys.Delete))
    00125             {
    00126                 this.Exit();
    00127             }
    00128
    00129             // Check gamepad
    00130             if ((gamepads != null) && (gamepads.Items.Count > 0))
    00131             {
    00132             }
    00133
    00134             base.Update(gameTime);
    00135         }

## Member Data Documentation

GravityChooserState GravityChooser.GravityChooser.state = new GravityChooserState()`[static]`

The current game state.

Definition at line 22 of file GravityChooser.cs.

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

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