# AvatarChooser.AvatarChooser Class Reference

This is the main type for your game. More...

List of all members.

## 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 for your game.

Definition at line 27 of file AvatarChooser.cs.

## Member Function Documentation

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

This is called when the game should draw itself.

Parameters:

  | gameTime | Provides a snapshot of timing values.

Definition at line 204 of file AvatarChooser.cs.

    00205         {
    00206             GraphicsDevice.Clear(Color.CornflowerBlue);
    00207
    00208             this.spriteBatch.Begin();
    00209             for (int i = 0; i < numFractals; i++)
    00210             {
    00211                 Color currentColor = Color.White;
    00212                 this.spriteBatch.Draw(fractals[i].ImageTexture, new Vector2(gridsize * (i % gridstep), gridsize * (i / gridstep)), currentColor);
    00213             }
    00214             this.spriteBatch.End();
    00215
    00216             base.Draw(gameTime);
    00217         }

override void AvatarChooser.AvatarChooser.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 74 of file AvatarChooser.cs.

    00075         {
    00076             base.Initialize();
    00077             this.screenshot = new Screenshot();
    00078         }

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

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

Definition at line 84 of file AvatarChooser.cs.

    00085         {
    00086             // Create a new SpriteBatch, which can be used to draw textures.
    00087             this.spriteBatch = new SpriteBatch(GraphicsDevice);
    00088             invertEffect = Content.Load<Effect>(@"Effects\Invert");
    00089
    00090             for (int i = 0; i < numFractals; i++)
    00091             {
    00092                 fractals[i] = new GumowskiMiraFractal(GraphicsDevice, gridsize, gridsize,
    00093                     parameters[0 + 6 * i],
    00094                     parameters[1 + 6 * i],
    00095                     parameters[2 + 6 * i],
    00096                     parameters[3 + 6 * i]);
    00097                 fractals[i].Scale = (float)parameters[4 + 6 * i];
    00098             }
    00099         }

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

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

Definition at line 105 of file AvatarChooser.cs.

    00106         {
    00107             // TODO: Unload any non ContentManager content here
    00108         }

override void AvatarChooser.AvatarChooser.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 115 of file AvatarChooser.cs.

    00116         {
    00117             // Allows the game to exit
    00118             if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed)
    00119                 this.Exit();
    00120
    00121             // Handle mouse and keyboard
    00122             KeyboardState keyboardState = Keyboard.GetState();
    00123             MouseState mouseState = Mouse.GetState();
    00124             int mouseX = mouseState.X;
    00125             int mouseY = mouseState.Y;
    00126             double relX = (2.0 * (double)((mouseX % gridsize) - gridsize / 2)) / gridsize;
    00127             double relY = (2.0 * (double)((mouseY % gridsize) - gridsize / 2)) / gridsize;
    00128             int index = (mouseX / gridsize) + (mouseY / gridsize) * gridstep;
    00129             this.currentIndex = -1;
    00130             if ((index >= 0) && (index < numFractals))
    00131             {
    00132                 this.currentIndex = index;
    00133                 if (this.released)
    00134                 {
    00135                     if ((mouseState.LeftButton == ButtonState.Pressed) ||
    00136                         (mouseState.RightButton == ButtonState.Pressed))
    00137                     {
    00138                         if (mouseState.LeftButton == ButtonState.Pressed)
    00139                         {
    00140                             fractals[index].Mu = fractals[index].Mu + 0.001;
    00141                         }
    00142                         else
    00143                         {
    00144                             fractals[index].Mu = fractals[index].Mu - 0.001;
    00145                         }
    00146                         fractals[index].Reset(relX, relY);
    00147                         this.iterated = false;
    00148                         this.released = false;
    00149                     }
    00150
    00151                     // Scrollwheel to zoom
    00152                     if (this.mouseScroll != mouseState.ScrollWheelValue)
    00153                     {
    00154                         fractals[index].Scale = fractals[index].Scale + 0.00001f * (this.mouseScroll - mouseState.ScrollWheelValue);
    00155                         this.mouseScroll = mouseState.ScrollWheelValue;
    00156                         fractals[index].Reset(relX, relY);
    00157                         this.iterated = false;
    00158                         this.released = false;
    00159                     }
    00160
    00161                     // Keypress commands
    00162                     // Handle keyboard
    00163                     if (keyboardState.IsKeyDown(Keys.PrintScreen))
    00164                     {
    00165                         screenshot.TakeScreenshot(GraphicsDevice);
    00166                         this.released = false;
    00167                     }
    00168                 }
    00169                 else
    00170                 {
    00171                     if ((mouseState.LeftButton == ButtonState.Released) &&
    00172                         (mouseState.RightButton == ButtonState.Released) &&
    00173                         (keyboardState.GetPressedKeys().Length == 0))
    00174                     {
    00175                         this.released = true;
    00176                         this.mouseScroll = mouseState.ScrollWheelValue;
    00177                     }
    00178                 }
    00179             }
    00180
    00181
    00182             // Update fractals
    00183             if (!this.iterated)
    00184             {
    00185                 this.iterated = true;
    00186                 for (int i = 0; i < numFractals; i++)
    00187                 {
    00188                     int toIterate = (int)parameters[5 + 6 * i];
    00189                     if (fractals[i].Iterations < toIterate)
    00190                     {
    00191                         this.iterated = false;
    00192                         fractals[i].Iterate(10000);
    00193                     }
    00194                 }
    00195             }
    00196
    00197             base.Update(gameTime);
    00198         }

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

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