Commits

Michael Gough committed 20bfa6e

Integrated the foundation of a GUI/windowing system. After exploring and
experimenting with quite a few different approaches, the XNA game now runs
"hosted" within a WPF control within a WPF window. This gives the result I was
looking for of being able to build most of the game UI using WPF. This
subsequently allows me to learn WPF the fun way!

Comments (0)

Files changed (49)

GameProgram/GameProgram/Game/ClassDiagram1.cd

+<?xml version="1.0" encoding="utf-8"?>
+<ClassDiagram MajorVersion="1" MinorVersion="1">
+  <Class Name="GameProgram.Game1" Collapsed="true">
+    <Position X="0.5" Y="0.5" Width="1.5" />
+    <TypeIdentifier>
+      <HashCode>AAQAFEgAAAAAAwAAAAAAAEAAAAAAAAgAAAAAACAAAAQ=</HashCode>
+      <FileName>Game\Game1.cs</FileName>
+    </TypeIdentifier>
+  </Class>
+  <Class Name="GameProgram.Program" Collapsed="true">
+    <Position X="2.25" Y="0.5" Width="1.5" />
+    <TypeIdentifier>
+      <HashCode>AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAA=</HashCode>
+      <FileName>Game\Program.cs</FileName>
+    </TypeIdentifier>
+  </Class>
+  <Class Name="GameProgram.World" Collapsed="true">
+    <Position X="3.5" Y="2" Width="2.5" />
+    <AssociationLine Name="Party" Type="GameProgram.Party" FixedFromPoint="true" FixedToPoint="true">
+      <Path>
+        <Point X="3.75" Y="2.691" />
+        <Point X="3.75" Y="3.365" />
+        <Point X="3" Y="3.365" />
+      </Path>
+    </AssociationLine>
+    <TypeIdentifier>
+      <HashCode>AEAAAAAAAAAAEAAAAQAAAAAAAAEAAQAAAAEABAgkAAA=</HashCode>
+      <FileName>Game\World.cs</FileName>
+    </TypeIdentifier>
+    <ShowAsAssociation>
+      <Property Name="StarSystem" />
+      <Property Name="Party" />
+    </ShowAsAssociation>
+  </Class>
+  <Class Name="GameProgram.Party" Collapsed="true">
+    <Position X="1.5" Y="3" Width="1.5" />
+    <AssociationLine Name="Entity" Type="GameProgram.PartyGameEntity" FixedFromPoint="true">
+      <Path>
+        <Point X="1.938" Y="3.691" />
+        <Point X="1.938" Y="4.75" />
+      </Path>
+    </AssociationLine>
+    <TypeIdentifier>
+      <HashCode>EAAAAAAAAAIAAAACAQAgAAAAAQAQEACAEAAAgAAEAAE=</HashCode>
+      <FileName>Game\Party.cs</FileName>
+    </TypeIdentifier>
+    <ShowAsAssociation>
+      <Property Name="Entity" />
+    </ShowAsAssociation>
+  </Class>
+  <Class Name="GameProgram.StarSystem" Collapsed="true">
+    <Position X="4.5" Y="4" Width="1.5" />
+    <TypeIdentifier>
+      <HashCode>QAAAAAAAAACAAAAAAQMAAAAAAACAAAAAgAAABAAEAAA=</HashCode>
+      <FileName>Game\StarSystem.cs</FileName>
+    </TypeIdentifier>
+    <ShowAsAssociation>
+      <Property Name="Star" />
+      <Property Name="PlanetarySystem" />
+    </ShowAsAssociation>
+  </Class>
+  <Class Name="GameProgram.PartyGameEntity">
+    <Position X="1.5" Y="4.75" Width="1.5" />
+    <TypeIdentifier>
+      <HashCode>AAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAA=</HashCode>
+      <FileName>Game\Entity.cs</FileName>
+    </TypeIdentifier>
+  </Class>
+  <Class Name="GameProgram.Star">
+    <Position X="4.5" Y="5.5" Width="1.5" />
+    <TypeIdentifier>
+      <HashCode>AAAAAAAAAAAAAgAAEQAAAAAAAAAAAAAAAAEAAAAEAEA=</HashCode>
+      <FileName>Game\Star.cs</FileName>
+    </TypeIdentifier>
+  </Class>
+  <Class Name="GameProgram.PlanetarySystem" Collapsed="true">
+    <Position X="6.5" Y="5" Width="1.5" />
+    <TypeIdentifier>
+      <HashCode>AAAAQAACAAEAAAAAEQAAAAAAACAAAggAAAMABCAEAEA=</HashCode>
+      <FileName>Game\PlanetarySystem.cs</FileName>
+    </TypeIdentifier>
+    <ShowAsAssociation>
+      <Property Name="Planet" />
+      <Property Name="Moon" />
+    </ShowAsAssociation>
+    <Lollipop Orientation="Right" Position="0.343" />
+  </Class>
+  <Class Name="GameProgram.Unit" Collapsed="true">
+    <Position X="0.5" Y="6.75" Width="1.5" />
+    <TypeIdentifier>
+      <HashCode>IAAAAAAAAAAAAAAAgQAgAIACAAAgAAAAAAQAAAAEAEA=</HashCode>
+      <FileName>Game\Unit.cs</FileName>
+    </TypeIdentifier>
+  </Class>
+  <Class Name="GameProgram.StationaryEntity">
+    <Position X="2.75" Y="6.75" Width="1.5" />
+    <TypeIdentifier>
+      <HashCode>AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=</HashCode>
+      <FileName>Game\StationaryEntity.cs</FileName>
+    </TypeIdentifier>
+  </Class>
+  <Class Name="GameProgram.Planet" Collapsed="true">
+    <Position X="6.5" Y="6.75" Width="1.5" />
+    <TypeIdentifier>
+      <HashCode>AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=</HashCode>
+      <FileName>Game\Planet.cs</FileName>
+    </TypeIdentifier>
+  </Class>
+  <Class Name="GameProgram.Moon" Collapsed="true">
+    <Position X="8.75" Y="6.5" Width="1.5" />
+    <TypeIdentifier>
+      <HashCode>AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=</HashCode>
+      <FileName>Game\Moon.cs</FileName>
+    </TypeIdentifier>
+  </Class>
+  <Class Name="GameProgram.Geoid" Collapsed="true">
+    <Position X="8.25" Y="8.25" Width="2.75" />
+    <TypeIdentifier>
+      <HashCode>AFAAQAAiCAAAAAAQhQAAEAAAAAAAAAAEAAAAAAAEAEA=</HashCode>
+      <FileName>Game\Geoid.cs</FileName>
+    </TypeIdentifier>
+  </Class>
+  <Class Name="GameProgram.Structure">
+    <Position X="1.75" Y="8.75" Width="1.5" />
+    <TypeIdentifier>
+      <HashCode>AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=</HashCode>
+      <FileName>Game\Structure.cs</FileName>
+    </TypeIdentifier>
+  </Class>
+  <Class Name="GameProgram.Region" Collapsed="true">
+    <Position X="3.75" Y="8.5" Width="1.5" />
+    <TypeIdentifier>
+      <HashCode>IEAAAAAAAAIAAAACBAAAAAAIAAAAAAEAAAAAACBEAAA=</HashCode>
+      <FileName>Game\Region.cs</FileName>
+    </TypeIdentifier>
+    <ShowAsAssociation>
+      <Property Name="ResourceReserve" />
+      <Property Name="GeoidalSector" />
+      <Property Name="GroundStructure" />
+    </ShowAsAssociation>
+  </Class>
+  <Class Name="GameProgram.GeoidalSector" Collapsed="true">
+    <Position X="6.25" Y="8.5" Width="1.5" />
+    <TypeIdentifier>
+      <HashCode>AgCAAAAAgAAAAAAAAQAAAAAAAAAAAAAAAAAAAAIEAEA=</HashCode>
+      <FileName>Game\GeoidalSector.cs</FileName>
+    </TypeIdentifier>
+    <ShowAsAssociation>
+      <Property Name="Geoid" />
+    </ShowAsAssociation>
+  </Class>
+  <Class Name="GameProgram.ResourceReserve">
+    <Position X="5" Y="9.75" Width="1.5" />
+    <TypeIdentifier>
+      <HashCode>AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=</HashCode>
+      <FileName>Game\ResourceReserve.cs</FileName>
+    </TypeIdentifier>
+  </Class>
+  <Class Name="GameProgram.SpaceStructure" Collapsed="true">
+    <Position X="0.5" Y="10.5" Width="1.5" />
+    <TypeIdentifier>
+      <HashCode>AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAA=</HashCode>
+      <FileName>Game\SpaceStructure.cs</FileName>
+    </TypeIdentifier>
+  </Class>
+  <Class Name="GameProgram.GroundStructure" Collapsed="true">
+    <Position X="2.25" Y="10.5" Width="1.5" />
+    <TypeIdentifier>
+      <HashCode>AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAA=</HashCode>
+      <FileName>Game\GroundStructure.cs</FileName>
+    </TypeIdentifier>
+  </Class>
+  <Class Name="GameProgram.MoonFactory" Collapsed="true">
+    <Position X="7" Y="0.75" Width="1.5" />
+    <TypeIdentifier>
+      <HashCode>AAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAA=</HashCode>
+      <FileName>Game\MoonFactory.cs</FileName>
+    </TypeIdentifier>
+  </Class>
+  <Class Name="GameProgram.PartyFactory" Collapsed="true">
+    <Position X="8.75" Y="0.75" Width="1.5" />
+    <TypeIdentifier>
+      <HashCode>AAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=</HashCode>
+      <FileName>Game\PartyFactory.cs</FileName>
+    </TypeIdentifier>
+  </Class>
+  <Class Name="GameProgram.PlanetarySystemFactory" Collapsed="true">
+    <Position X="10.5" Y="0.75" Width="1.5" />
+    <TypeIdentifier>
+      <HashCode>AAAAAAAAAAAAAAAEAAAIAAAAAAAAAAAAAAAAAAAAABA=</HashCode>
+      <FileName>Game\PlanetarySystemFactory.cs</FileName>
+    </TypeIdentifier>
+  </Class>
+  <Class Name="GameProgram.PlanetFactory" Collapsed="true">
+    <Position X="7" Y="1.5" Width="1.5" />
+    <TypeIdentifier>
+      <HashCode>AAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAAAAAAAAAAAA=</HashCode>
+      <FileName>Game\PlanetFactory.cs</FileName>
+    </TypeIdentifier>
+  </Class>
+  <Class Name="GameProgram.RegionFactory" Collapsed="true">
+    <Position X="8.75" Y="1.5" Width="1.5" />
+    <TypeIdentifier>
+      <HashCode>AAAAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=</HashCode>
+      <FileName>Game\RegionFactory.cs</FileName>
+    </TypeIdentifier>
+  </Class>
+  <Class Name="GameProgram.GeoidalSectorFactory" Collapsed="true">
+    <Position X="10.5" Y="1.5" Width="1.5" />
+    <TypeIdentifier>
+      <HashCode>AAAAAAAACAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=</HashCode>
+      <FileName>Game\SectorFactory.cs</FileName>
+    </TypeIdentifier>
+  </Class>
+  <Class Name="GameProgram.StarSystemFactory" Collapsed="true">
+    <Position X="7" Y="2.25" Width="1.5" />
+    <TypeIdentifier>
+      <HashCode>AAAAAAAAAAAAAAAAAEEAAAACAAAAAAAAAAAAAAAAAAA=</HashCode>
+      <FileName>Game\StarSystemFactory.cs</FileName>
+    </TypeIdentifier>
+  </Class>
+  <Class Name="GameProgram.WorldFactory" Collapsed="true">
+    <Position X="8.75" Y="2.25" Width="1.5" />
+    <TypeIdentifier>
+      <HashCode>AAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAQAAAAAAAIAAA=</HashCode>
+      <FileName>Game\WorldFactory.cs</FileName>
+    </TypeIdentifier>
+  </Class>
+  <Class Name="GameProgram.GraphicsItem" Collapsed="true">
+    <Position X="12.25" Y="4.75" Width="1.5" />
+    <AssociationLine Name="VisableGameEntity" Type="GameProgram.VisibleGameEntity" FixedFromPoint="true" FixedToPoint="true">
+      <Path>
+        <Point X="12.625" Y="5.312" />
+        <Point X="12.625" Y="5.626" />
+        <Point X="11.5" Y="5.626" />
+      </Path>
+    </AssociationLine>
+    <TypeIdentifier>
+      <HashCode>QBAABAAAAAAgAAAhAAIAICAgAAggAgABAAIEAAAwBAI=</HashCode>
+      <FileName>Game\GraphicsItem.cs</FileName>
+    </TypeIdentifier>
+    <ShowAsAssociation>
+      <Property Name="VisableGameEntity" />
+    </ShowAsAssociation>
+    <Lollipop Orientation="Right" Position="0.103" />
+  </Class>
+  <Class Name="GameProgram.GameEntity" Collapsed="true">
+    <Position X="7" Y="3.25" Width="2" />
+    <TypeIdentifier>
+      <HashCode>AAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAEAAA=</HashCode>
+      <FileName>Game\GameEntity.cs</FileName>
+    </TypeIdentifier>
+    <Lollipop Position="0.2" />
+  </Class>
+  <Class Name="GameProgram.GraphicsScene" Collapsed="true">
+    <Position X="12.25" Y="3.25" Width="1.5" />
+    <AssociationLine Name="GraphicsItem" Type="GameProgram.GraphicsItem">
+      <MemberNameLabel ManuallyPlaced="true">
+        <Position X="0.213" Y="0.12" />
+      </MemberNameLabel>
+    </AssociationLine>
+    <TypeIdentifier>
+      <HashCode>AgKABEAAAAAAAAAAAQIAIDAABAAgAAAAAAAAAAQAIBA=</HashCode>
+      <FileName>Game\GraphicsScene.cs</FileName>
+    </TypeIdentifier>
+    <ShowAsAssociation>
+      <Property Name="GraphicsItem" />
+    </ShowAsAssociation>
+    <Lollipop Position="0.2" />
+  </Class>
+  <Class Name="GameProgram.VisibleGameEntity" Collapsed="true">
+    <Position X="9.25" Y="5.25" Width="2.25" />
+    <TypeIdentifier>
+      <HashCode>AAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAABEI=</HashCode>
+      <FileName>Game\VisibleGameEntity.cs</FileName>
+    </TypeIdentifier>
+    <Lollipop Position="0.2" />
+  </Class>
+  <Class Name="GameProgram.GraphicsSceneFactory">
+    <Position X="12.25" Y="0.75" Width="1.5" />
+    <TypeIdentifier>
+      <HashCode>AIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAA=</HashCode>
+      <FileName>Game\GraphicsSceneFactory.cs</FileName>
+    </TypeIdentifier>
+  </Class>
+  <Class Name="GameProgram.GraphicsItemFactory">
+    <Position X="14" Y="0.75" Width="2.25" />
+    <TypeIdentifier>
+      <HashCode>AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgEAAAAAAA=</HashCode>
+      <FileName>Game\GraphicsItemFactory.cs</FileName>
+    </TypeIdentifier>
+  </Class>
+  <Class Name="GameProgram.HUD">
+    <Position X="16.25" Y="3.75" Width="1.5" />
+    <TypeIdentifier>
+      <HashCode>AoAAFgAAAAAABIAAAAIAABAACAAAAAQAAAAEAAAEAAg=</HashCode>
+      <FileName>Game\HUD.cs</FileName>
+    </TypeIdentifier>
+    <Lollipop Position="0.2" />
+  </Class>
+  <Class Name="GameProgram.UnitGraphicsItem">
+    <Position X="12.25" Y="6.25" Width="1.5" />
+    <TypeIdentifier>
+      <HashCode>AAAABAAAAAAgAAAAIAIAAAAAAAAAAAAAAAAAAAAAAAA=</HashCode>
+      <FileName>Game\UnitGraphicsItem.cs</FileName>
+    </TypeIdentifier>
+  </Class>
+  <Class Name="GameProgram.UnitFactory" Collapsed="true">
+    <Position X="10.5" Y="2.25" Width="1.5" />
+    <TypeIdentifier>
+      <HashCode>AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAI=</HashCode>
+      <FileName>Game\UnitFactory.cs</FileName>
+    </TypeIdentifier>
+  </Class>
+  <Class Name="Pie2DSample_4._0.Pie2D" Collapsed="true">
+    <Position X="14.25" Y="2.5" Width="1.5" />
+    <TypeIdentifier>
+      <HashCode>AAAIBAAACCQAAoAgEACAIgAAAAAQAAQIiEAAAgBAAAQ=</HashCode>
+      <FileName>Game\Pie2D.cs</FileName>
+    </TypeIdentifier>
+  </Class>
+  <Class Name="GameProgram.GraphicalSector">
+    <Position X="14.25" Y="3.5" Width="1.5" />
+    <TypeIdentifier>
+      <HashCode>QAAAAAAAAAAAAgABAAAAACAAAAAgAAABAAAEACAABAI=</HashCode>
+      <FileName>Game\GraphicalSector.cs</FileName>
+    </TypeIdentifier>
+  </Class>
+  <Interface Name="GameProgram.Location">
+    <Position X="9.75" Y="3.25" Width="2" />
+    <TypeIdentifier>
+      <HashCode>AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEA=</HashCode>
+      <FileName>Game\Visible.cs</FileName>
+    </TypeIdentifier>
+  </Interface>
+  <Interface Name="GameProgram.Loading">
+    <Position X="16.5" Y="1" Width="1.5" />
+    <TypeIdentifier>
+      <HashCode>AAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=</HashCode>
+      <FileName>Game\Loading.cs</FileName>
+    </TypeIdentifier>
+  </Interface>
+  <Interface Name="GameProgram.Update">
+    <Position X="5.25" Y="0.5" Width="1.5" />
+    <TypeIdentifier>
+      <HashCode>AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAA=</HashCode>
+      <FileName>Game\Update.cs</FileName>
+    </TypeIdentifier>
+  </Interface>
+  <Interface Name="GameProgram.Draw">
+    <Position X="14.5" Y="5.75" Width="1.5" />
+    <TypeIdentifier>
+      <HashCode>AAAAAAAAAAAAAAAAAAIAAAAAAAAAAAAAAAAAAAAAAAA=</HashCode>
+      <FileName>Game\Draw.cs</FileName>
+    </TypeIdentifier>
+  </Interface>
+  <Font Name="Segoe UI" Size="9" />
+</ClassDiagram>

GameProgram/GameProgram/Game/Draw.cs

+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using Microsoft.Xna.Framework.Graphics;
+
+namespace GameProgram
+{
+  public interface Draw
+  {
+    void draw( SpriteBatch spriteBatch );
+  }
+}

GameProgram/GameProgram/Game/Entity.cs

+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace GameProgram
+{
+  public abstract class PartyGameEntity : GameEntity
+  {
+    public override List<VisibleGameEntity> getChildVisableGameEntities()
+    {
+      return new List<VisibleGameEntity>();
+    }
+  }
+}

GameProgram/GameProgram/Game/Game.ico

Added
New image

GameProgram/GameProgram/Game/Game1.cs

+using System;
+using System.Collections.Generic;
+using System.Linq;
+using Microsoft.Xna.Framework;
+using Microsoft.Xna.Framework.Audio;
+using Microsoft.Xna.Framework.Content;
+using Microsoft.Xna.Framework.GamerServices;
+using Microsoft.Xna.Framework.Graphics;
+using Microsoft.Xna.Framework.Input;
+using Microsoft.Xna.Framework.Media;
+using Innovation;
+//using XNAControl;
+//using Xnaml;
+
+namespace GameProgram
+{
+  
+  /// <summary>
+  /// This is the main type for your game
+  /// </summary>
+  public class Game1 : Game//XNAControl.XNAControlGame
+  {
+    GraphicsDeviceManager graphics;
+    MouseDevice mouse;
+    MouseState mouseStateWhenLeftButtonLastPressed;
+    SpriteBatch spriteBatch;
+    HUD hud;
+
+    public static readonly Random randomNumber = new Random();
+    
+    private World world;
+    private GraphicsScene graphicsScene;
+    //private GraphicsDevice graphicsDevice; // For using WpfHostedXna
+
+    //// This is a texture we can render.
+    //Texture2D myTexture;
+
+    //// Set the coordinates to draw the sprite at.
+    //Vector2 spritePosition = Vector2.Zero;
+
+    //// Store some information about the sprite's motion.
+    //Vector2 spriteSpeed = new Vector2( 50.0f, 50.0f );
+
+    public Game1() //:
+      //base( handle, "Content" )
+    {
+    //  if (!DesignTime)
+    //  {
+      //this.graphicsDevice = graphicsDevice; // For using WpfHostedXna
+      graphics = new GraphicsDeviceManager( this );//base.GraphicsDeviceManager //for normal XNA
+        Content.RootDirectory = "Content";
+
+        //graphics.PreferredBackBufferWidth = 1024;
+        //graphics.PreferredBackBufferWidth = 800;
+        //graphics.ApplyChanges();
+        //graphics.IsFullScreen = true;
+
+        this.Window.AllowUserResizing = true;
+        this.IsMouseVisible = true;
+
+        mouse = new MouseDevice( graphics.GraphicsDevice );
+      //}
+    }
+
+    /// <summary>
+    /// 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.
+    /// </summary>
+    protected override void Initialize()
+    {
+      // TODO: Add your initialization logic here
+
+      WorldFactory worldFactory = new WorldFactory();
+      GraphicsSceneFactory graphicsSceneFactory = new GraphicsSceneFactory();
+    
+      world         = worldFactory.createWorld();
+      graphicsScene = graphicsSceneFactory.createGraphicsScene( spriteBatch, 
+                                                                world.getVisableGameEntities(),
+                                                                world.getUnits() );
+      hud = new HUD( world, graphicsScene, GraphicsDevice);
+      
+      base.Initialize();
+    }
+
+    /// <summary>
+    /// LoadContent will be called once per game and is the place to load
+    /// all of your content.
+    /// </summary>
+    protected override void LoadContent()
+    {
+      // Create a new SpriteBatch, which can be used to draw textures.
+      spriteBatch = new SpriteBatch( GraphicsDevice );
+      
+      // TODO: use this.Content to load your game content here
+      graphicsScene.loadContent( Content );
+      hud.loadContent( Content );
+      //myTexture = Content.Load<Texture2D>( "WhiteCircle" );
+    }
+
+    /// <summary>
+    /// UnloadContent will be called once per game and is the place to unload
+    /// all content.
+    /// </summary>
+    protected override void UnloadContent()
+    {
+      // TODO: Unload any non ContentManager content here
+    }
+
+    /// <summary>
+    /// Allows the game to run logic such as updating the world,
+    /// checking for collisions, gathering input, and playing audio.
+    /// </summary>
+    /// <param name="gameTime">Provides a snapshot of timing values.</param>
+    protected override void Update( GameTime gameTime )
+    {
+      // Allows the game to exit
+      if (GamePad.GetState( PlayerIndex.One ).Buttons.Back == ButtonState.Pressed)
+        this.Exit();
+
+      //UpdateResolution();
+
+      world.update( gameTime );
+
+      mouse.Update();
+
+      graphicsScene.setZoomFactor( ( mouse.ScrollPosition / 10000.0F ) + 0.5F );
+
+
+      if( mouse.WasButtonHeld( MouseButtons.Left ))
+      {
+        graphicsScene.setCameraOffset( mouse.Delta );
+
+      }
+
+      if (mouse.WasButtonPressed( MouseButtons.Left ) )
+      {
+        mouseStateWhenLeftButtonLastPressed = mouse.State;
+      }
+
+      if ( mouse.WasButtonReleased( MouseButtons.Left) && 
+           mouse.State.X == mouseStateWhenLeftButtonLastPressed.X &&
+           mouse.State.Y == mouseStateWhenLeftButtonLastPressed.Y)
+      {
+          graphicsScene.markItemAtPositionAsSelected( new Vector2( mouse.State.X, mouse.State.Y ) );          
+      }
+
+      if (mouse.WasButtonReleased( MouseButtons.Right ) )
+      {
+        List<UnitGraphicsItem> selectedUnitItems = graphicsScene.getSelectedUnitItems();
+
+        foreach( UnitGraphicsItem unitGraphicsItem in selectedUnitItems )
+        {
+          Vector2 newPositionCoordinates = new Vector2( mouse.State.X, mouse.State.Y);
+
+          newPositionCoordinates = ( ( newPositionCoordinates + unitGraphicsItem.CameraOffset) /  unitGraphicsItem.ZoomFactor) - unitGraphicsItem.SpriteOffset;
+
+          unitGraphicsItem.Unit.DestinationCoordinates = newPositionCoordinates;
+        }
+      }
+
+
+
+      graphicsScene.setZoomFactor( ( Mouse.GetState().ScrollWheelValue / 10000.0F ) + 0.5F );
+
+      //// TODO: Add your update logic here
+      //// Move the sprite by speed, scaled by elapsed time.
+      //spritePosition +=
+      //    spriteSpeed * (float)gameTime.ElapsedGameTime.TotalSeconds;
+
+      //int MaxX =
+      //    graphics.GraphicsDevice.Viewport.Width - myTexture.Width;
+      //int MinX = 0;
+      //int MaxY =
+      //    graphics.GraphicsDevice.Viewport.Height - myTexture.Height;
+      //int MinY = 0;
+
+      //// Check for bounce.
+      //if (spritePosition.X > MaxX)
+      //{
+      //  spriteSpeed.X *= -1;
+      //  spritePosition.X = MaxX;
+      //}
+
+      //else if (spritePosition.X < MinX)
+      //{
+      //  spriteSpeed.X *= -1;
+      //  spritePosition.X = MinX;
+      //}
+
+      //if (spritePosition.Y > MaxY)
+      //{
+      //  spriteSpeed.Y *= -1;
+      //  spritePosition.Y = MaxY;
+      //}
+
+      //else if (spritePosition.Y < MinY)
+      //{
+      //  spriteSpeed.Y *= -1;
+      //  spritePosition.Y = MinY;
+      //}
+
+      base.Update( gameTime );
+    }
+
+    /// <summary>
+    /// This is called when the game should draw itself.
+    /// </summary>
+    /// <param name="gameTime">Provides a snapshot of timing values.</param>
+    protected override void Draw( GameTime gameTime )
+    {
+      GraphicsDevice.Clear( Color.Black );
+      
+
+      // TODO: Add your drawing code here
+      spriteBatch.Begin( SpriteSortMode.BackToFront, BlendState.NonPremultiplied );
+      graphicsScene.draw( spriteBatch );
+      hud.draw( spriteBatch );
+      spriteBatch.End();
+      //spriteBatch.Draw( myTexture, spritePosition, Color.White );
+      
+      base.Draw( gameTime );
+    }
+
+  }
+}

GameProgram/GameProgram/Game/GameEntity.cs

+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using Microsoft.Xna.Framework;
+
+namespace GameProgram
+{
+  public abstract class GameEntity : Update
+  {
+    public abstract List<VisibleGameEntity> getChildVisableGameEntities();
+    //{
+    //  List<VisableGameEntity> currentVisableGameEntityList = new List<VisableGameEntity>();
+
+    //  return getChildVisableGameEntities( currentVisableGameEntityList );
+    //}
+
+    //public abstract List<VisableGameEntity> getChildVisableGameEntities();
+
+    //public abstract List<VisableGameEntity> getChildVisableGameEntities( List<VisableGameEntity> currentVisableGameEntityList );
+    //{
+    //  return currentVisableGameEntityList;
+    //}
+
+    public abstract void update( GameTime gameTime);
+
+
+
+  }
+}

GameProgram/GameProgram/Game/GameThumbnail.png

Added
New image

GameProgram/GameProgram/Game/Geoid.cs

+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using Microsoft.Xna.Framework;
+
+namespace GameProgram
+{
+  public abstract class Geoid : VisibleGameEntity
+  {
+    private List<GeoidalSector> sectors = new List<GeoidalSector>();
+
+    public List<GeoidalSector> Sectors
+    {
+      get { return sectors; }
+      set { sectors = value; }
+    }
+    private GeoidalSectorFactory sectorFactory = new GeoidalSectorFactory();
+    private PlanetarySystem planetarySystem;
+    protected Vector2 coordinatesWrtPlanetarySystemOrigin = Vector2.Zero;
+    protected Vector2 velocityWrtPlanetarySystemOrigin = Vector2.Zero;
+    private float parentOrbitRadius = 0.0F;
+    private float longitude = 0.0F;
+    protected float orbitAngularSpeed = ( ( 2F* 2F * (float)Math.PI ) / 60.0F );
+
+    public Geoid( PlanetarySystem planetarySystem, float parentOrbitRadius, float initialLongitude )      
+    {      
+      this.planetarySystem = planetarySystem;
+      this.parentOrbitRadius = parentOrbitRadius;
+      this.longitude = initialLongitude;
+
+      coordinatesWrtPlanetarySystemOrigin.X = parentOrbitRadius * (float)Math.Cos( longitude );
+      coordinatesWrtPlanetarySystemOrigin.Y = parentOrbitRadius * (float)Math.Sin( longitude );  
+    }
+
+    internal void addSector( Region newRegion )
+    {
+      GeoidalSector newSector = sectorFactory.createSector( newRegion, this );
+
+      newRegion.GeoidalSector = newSector;
+
+      sectors.Add( newSector );
+    }
+
+    protected static void createSector()
+    {
+      throw new NotImplementedException();
+    }
+
+    public override Vector2 getAbsolutePosition()
+    {
+      return planetarySystem.getAbsolutePosition() + coordinatesWrtPlanetarySystemOrigin;
+    }
+
+    public override List<VisibleGameEntity> getChildVisableGameEntities()
+    {
+      return new List<VisibleGameEntity>(); 
+    }
+
+    public override void update( GameTime gameTime )
+    {
+      //float distanceTravelled = angularSpeed 
+      //                          * (float)gameTime.ElapsedGameTime.TotalSeconds
+      //                          * parentOrbitRadius;
+
+      longitude += orbitAngularSpeed * (float)gameTime.ElapsedGameTime.TotalSeconds;
+
+      //coordinatesWrtStarSystemOrigin += velocityWrtStarSystemOrigin * (float)gameTime.ElapsedGameTime.TotalSeconds;
+
+      coordinatesWrtPlanetarySystemOrigin.X = parentOrbitRadius * (float)Math.Cos( longitude );
+      coordinatesWrtPlanetarySystemOrigin.Y = parentOrbitRadius * (float)Math.Sin( longitude );  
+    }
+
+  }
+}

GameProgram/GameProgram/Game/GeoidalSector.cs

+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using Microsoft.Xna.Framework;
+
+namespace GameProgram
+{
+  public class GeoidalSector : VisibleGameEntity
+  {
+    private Region region;
+
+    public Region Region
+    {
+      get { return region; }
+      set {  }
+    }
+    private Geoid geoid;
+
+    //public GeoidalSector( Region newRegion )
+    //{
+    //  // TODO: Complete member initialization
+    //  this.newRegion = newRegion;
+    //}
+
+    public GeoidalSector( Region newRegion, GameProgram.Geoid geoid )
+    {
+      // TODO: Complete member initialization
+      this.region = newRegion;
+      this.geoid = geoid;
+    }
+
+    public Geoid Geoid
+    {
+      get
+      {
+        return geoid;
+      }
+      set
+      {
+        geoid = value;
+      }
+    }
+
+    public override List<VisibleGameEntity> getChildVisableGameEntities()
+    {
+      return new List<VisibleGameEntity>();
+    }
+
+    public override Vector2 getAbsolutePosition()
+    {
+      return geoid.getAbsolutePosition();
+    }
+
+    public override void update( GameTime gameTime )
+    {
+    }
+  }
+}

GameProgram/GameProgram/Game/GraphicsItem.cs

+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using Microsoft.Xna.Framework.Graphics;
+using Microsoft.Xna.Framework.Content;
+using Microsoft.Xna.Framework;
+
+namespace GameProgram
+{
+  public class GraphicsItem : Loading, Draw
+  {
+    protected Texture2D texture;
+
+    public Texture2D Texture
+    {
+      get { return texture; }      
+    }
+
+    VisibleGameEntity visableGameEntity;
+    protected Vector2 cameraOffset = new Vector2( -400.0F, -240.0F );
+    protected Vector2 position = Vector2.Zero;
+
+    public Vector2 Position
+    {
+      get { return position; }
+      set {  }
+    }
+
+    public Vector2 CameraOffset
+    {
+      get { return cameraOffset; }
+      set { cameraOffset -= value; }
+    }
+    protected Vector2 spriteOffset = Vector2.Zero;
+
+    public Vector2 SpriteOffset
+    {
+      get { return spriteOffset; }
+      //set { spriteOffset = value; }
+    }
+    protected float worldScaleFactor = 0.5F;
+    protected float scaleFactor = 0.5F;
+
+    public float ScaleFactor
+    {
+      get { return scaleFactor; }
+      set { scaleFactor = value; }
+    }
+    protected float zoomFactor = 6000.0F;
+
+    public float ZoomFactor
+    {
+      get { return zoomFactor; }
+      set { zoomFactor = value; }
+    }
+
+    public bool Selected
+    {
+      get
+      {
+        return visableGameEntity.Selected;
+      }
+      set
+      {
+        visableGameEntity.Selected = value;
+      }
+    }
+
+    public VisibleGameEntity VisableGameEntity
+    {
+      get
+      {
+        throw new System.NotImplementedException();
+      }
+      set
+      {
+      }
+    }
+
+    virtual public void draw( SpriteBatch spriteBatch )
+    {
+      position = ( ( visableGameEntity.getAbsolutePosition() + spriteOffset ) * zoomFactor ) - cameraOffset;
+      scaleFactor = visableGameEntity.RelativeRadius * worldScaleFactor * zoomFactor;
+
+      if (scaleFactor < 0.02)
+      {
+        scaleFactor = 0.02F;
+        spriteOffset.X = -( texture.Width / 2 ) * visableGameEntity.RelativeRadius * worldScaleFactor;
+        spriteOffset.Y = -( texture.Height / 2 ) * visableGameEntity.RelativeRadius * worldScaleFactor;
+      }
+
+      spriteBatch.Draw( texture,
+                        position, 
+                        null, 
+                        Color.Beige, 
+                        0f, 
+                        Vector2.Zero,
+                        scaleFactor, 
+                        SpriteEffects.None, 
+                        0f );
+    }
+
+    virtual public void loadContent( ContentManager contentManager )
+    {
+      texture = contentManager.Load<Texture2D>( "WhiteCircle" );
+      spriteOffset.X = -(texture.Width/2) * visableGameEntity.RelativeRadius * worldScaleFactor;
+      spriteOffset.Y = -(texture.Height/2) * visableGameEntity.RelativeRadius * worldScaleFactor;
+    }
+
+    public GraphicsItem( VisibleGameEntity visableGameEntity )
+    {
+      // TODO: Complete member initialization
+      this.visableGameEntity = visableGameEntity;
+    }
+
+    public bool contains( Vector2 mouseButtonReleasePosition )
+    {
+      bool doesContain = false;
+
+      float width  = texture.Bounds.Width * scaleFactor;
+      float height = texture.Bounds.Height * scaleFactor;
+
+      Rectangle itemRectangle = new Rectangle( Convert.ToInt32( this.position.X ),
+                                             Convert.ToInt32( this.position.Y ),
+                                             Convert.ToInt32( width ) ,
+                                             Convert.ToInt32( height ) );
+
+      doesContain = itemRectangle.Contains( new Point( Convert.ToInt32( mouseButtonReleasePosition.X - spriteOffset.X ),
+                                                Convert.ToInt32( mouseButtonReleasePosition.Y - spriteOffset.Y ) ) );
+
+      return doesContain;
+    }
+
+    internal void setAsSelected( bool selectionStatus)
+    {
+      
+    }
+  }
+
+}

GameProgram/GameProgram/Game/GraphicsItemFactory.cs

+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using Microsoft.Xna.Framework.Graphics;
+using Microsoft.Xna.Framework;
+
+namespace GameProgram
+{
+  public class GraphicsItemFactory
+  {
+    //public void createGraphicsItem()
+    //{
+    //  throw new System.NotImplementedException();
+    //}
+
+    internal GraphicsItem createGraphicsItem( SpriteBatch spriteBatch, VisibleGameEntity visableGameEntity )
+    {
+      GraphicsItem newGraphicsItem = new GraphicsItem( visableGameEntity );
+
+      return newGraphicsItem;
+    }
+
+    internal UnitGraphicsItem createUnitGraphicsItem( SpriteBatch spriteBatch, Unit unit)
+    {
+      UnitGraphicsItem newUnitGraphicsItem = new UnitGraphicsItem( unit );
+
+      return newUnitGraphicsItem;
+    }
+
+  }
+}

GameProgram/GameProgram/Game/GraphicsScene.cs

+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using Microsoft.Xna.Framework.Graphics;
+using Microsoft.Xna.Framework;
+using Microsoft.Xna.Framework.Content;
+
+namespace GameProgram
+{
+  public class GraphicsScene : Loading, Draw
+  {
+    private List<GraphicsItem> graphicsItems = new List<GraphicsItem>();
+    private List<UnitGraphicsItem> unitGraphicsItems = new List<UnitGraphicsItem>();
+    private SpriteBatch spriteBatch;
+    private Texture2D background;
+    private float zoomFactor = 0.0F;
+
+    public float ZoomFactor
+    {
+      get { return zoomFactor; }
+      //set { zoomFactor = value; }
+    }
+
+    public GraphicsScene( SpriteBatch spriteBatch )
+    {
+      // TODO: Complete member initialization
+      this.spriteBatch = spriteBatch;
+    }
+
+    public GraphicsItem GraphicsItem
+    {
+      get
+      {
+        throw new System.NotImplementedException();
+      }
+      set
+      {
+      }
+    }
+
+    public void draw( SpriteBatch spriteBatch)
+    {
+      spriteBatch.Draw( background,
+                        Vector2.Zero,
+                        Color.White);
+
+      spriteBatch.Draw( background,
+                  new Vector2(1600.0F, 0.0F),
+                  Color.White );
+
+      foreach( GraphicsItem graphicsItem in graphicsItems )      
+      {
+        graphicsItem.draw( spriteBatch );
+      }
+
+      foreach (UnitGraphicsItem unitGraphicsItem in unitGraphicsItems)
+      {
+        unitGraphicsItem.draw( spriteBatch );
+      }
+
+    }
+
+    public void loadContent( ContentManager contentManager )
+    {
+      background = contentManager.Load<Texture2D>( "PIA15801(darkened)" );
+
+      foreach( GraphicsItem graphicsItem in graphicsItems ) 
+      {
+        graphicsItem.loadContent( contentManager );
+      }
+
+      foreach (UnitGraphicsItem unitGraphicsItem in unitGraphicsItems)
+      {
+        unitGraphicsItem.loadContent( contentManager );
+      }
+    }
+
+    internal void Add( GraphicsItem newGraphicsItem )
+    {
+      graphicsItems.Add( newGraphicsItem );
+    }
+
+    internal void Add( UnitGraphicsItem newUnitGraphicsItem )
+    {
+      unitGraphicsItems.Add( newUnitGraphicsItem );
+    }
+
+    public void setZoomFactor( float newZoomFactor )
+    {
+
+
+      zoomFactor = newZoomFactor;
+
+      foreach (GraphicsItem graphicsItem in graphicsItems)
+      {
+        graphicsItem.ZoomFactor = newZoomFactor;
+      }
+
+      foreach (UnitGraphicsItem unitGraphicsItem in unitGraphicsItems)
+      {
+        unitGraphicsItem.ZoomFactor = newZoomFactor;
+      }
+
+    }
+
+    public void setCameraOffset( Vector2 cameraOffset )
+    {
+      foreach (GraphicsItem graphicsItem in graphicsItems)
+      {
+        graphicsItem.CameraOffset = cameraOffset;
+      }
+
+      foreach (UnitGraphicsItem unitGraphicsItem in unitGraphicsItems)
+      {
+        unitGraphicsItem.CameraOffset = cameraOffset;
+      }
+
+    }
+
+    // This should really be 'getItemsAtPosition()'.  The client 
+    // code can then call whatver metohds it wants then.
+    internal void markItemAtPositionAsSelected( Vector2 position )
+    {
+      bool selectionComplete = false;
+
+      foreach (GraphicsItem graphicsItem in graphicsItems)
+      {
+        if( (graphicsItem.contains( position )) && 
+            (selectionComplete == false) )
+        {
+          graphicsItem.Selected = true;       
+          selectionComplete = true;
+        }
+        else
+        {
+          graphicsItem.Selected = false;       
+        }
+
+      }
+
+      selectionComplete = false;
+
+      foreach (UnitGraphicsItem unitgraphicsItem in unitGraphicsItems)
+      {
+        if (( unitgraphicsItem.contains( position ) ) &&
+            ( selectionComplete == false ))
+        {
+          unitgraphicsItem.Selected = true;
+          selectionComplete = true;
+        }
+        else
+        {
+          unitgraphicsItem.Selected = false;
+        }
+
+      }
+    }
+
+    public List<GraphicsItem > getSelectedEntityItems()
+    {
+      List<GraphicsItem> selectedItems = new List<GraphicsItem>();
+
+      foreach( GraphicsItem graphicsItem in graphicsItems )
+      {
+        if( graphicsItem.Selected == true )
+        {
+          selectedItems.Add( graphicsItem );          
+        }
+
+      }
+
+      return selectedItems;
+
+    }
+
+    public List<UnitGraphicsItem> getSelectedUnitItems()
+    {
+      List<UnitGraphicsItem> selectedItems = new List<UnitGraphicsItem>();
+
+      foreach( UnitGraphicsItem unitGraphicsItem in unitGraphicsItems)
+      {
+        if( unitGraphicsItem.Selected == true )
+        {
+          selectedItems.Add( unitGraphicsItem );
+        }
+
+      }
+
+      return selectedItems;
+    }
+
+  }
+}

GameProgram/GameProgram/Game/GraphicsSceneFactory.cs

+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using Microsoft.Xna.Framework.Graphics;
+
+namespace GameProgram
+{
+  public class GraphicsSceneFactory
+  {
+    private GraphicsItemFactory graphicsItemFactory = new GraphicsItemFactory();
+
+    //public GraphicsItemFactory GraphicsItemFactory
+    //{
+    //  get
+    //  {
+    //    throw new System.NotImplementedException();
+    //  }
+    //  set
+    //  {
+    //  }
+    //}
+
+    //public void createGraphicsScene()
+    //{
+    //  throw new System.NotImplementedException();
+    //}
+
+    internal GraphicsScene createGraphicsScene( SpriteBatch spriteBatch, List<VisibleGameEntity> visibleGameEntities, List<Unit> units )
+    {
+      GraphicsScene newGraphicsScene = new GraphicsScene( spriteBatch );
+      GraphicsItem newGraphicsItem;
+      UnitGraphicsItem newUnitGraphicsItem;
+
+      foreach( VisibleGameEntity visableGameEntity in visibleGameEntities )
+      {
+        newGraphicsItem = graphicsItemFactory.createGraphicsItem( spriteBatch, visableGameEntity );
+
+        newGraphicsScene.Add( newGraphicsItem );
+        
+      }
+
+      foreach (Unit unit in units)
+      {
+        newUnitGraphicsItem = graphicsItemFactory.createUnitGraphicsItem( spriteBatch, unit );
+
+        newGraphicsScene.Add( newUnitGraphicsItem );
+
+      }
+
+      return newGraphicsScene;
+    }
+  }
+}

GameProgram/GameProgram/Game/GroundStructure.cs

+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using Microsoft.Xna.Framework;
+
+namespace GameProgram
+{
+  public class GroundStructure : Structure
+  {
+    public override void update( GameTime gameTime )
+    {
+    }
+  }
+}

GameProgram/GameProgram/Game/HUD.cs

+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using Microsoft.Xna.Framework.Graphics;
+using Microsoft.Xna.Framework;
+using Microsoft.Xna.Framework.Content;
+
+namespace GameProgram
+{
+  public class HUD : Draw, Loading, Update
+  {
+    private World world;
+    private Party currentParty;
+    private GraphicsScene graphicsScene;
+    private SpriteFont normalHudFont;
+    private Texture2D selectedVisibleEntityOverlay;
+    private Vector2 selectedVisibleEntityOverlayOffset;
+    private GraphicsDevice graphicsDevice;
+    List<GraphicalSector> graphicalSectors = new List<GraphicalSector>();
+    float scaleFactor;
+
+    public HUD( World world, GraphicsScene graphicsScene, GraphicsDevice graphicsDevice )
+    {
+      this.world = world;
+      this.currentParty = world.Party;
+      this.graphicsScene = graphicsScene;
+      this.graphicsDevice = graphicsDevice;
+    }
+
+    public void drawSectors()
+    {
+      foreach (GraphicalSector graphicalSector in graphicalSectors)
+      {
+
+        graphicalSector.Draw();
+      }
+    }
+
+    public void draw( SpriteBatch spriteBatch )
+    {
+      spriteBatch.DrawString( normalHudFont, "Energy  : " + currentParty.EnergyReserve, Vector2.Zero, Color.CornflowerBlue, 0, Vector2.Zero, 0.9F, SpriteEffects.None, 0 );
+      spriteBatch.DrawString( normalHudFont, "Material: " + currentParty.EnergyReserve, new Vector2( 0.0F, 20.0F ), Color.Coral, 0, Vector2.Zero, 0.9F, SpriteEffects.None, 0 );
+      spriteBatch.DrawString( normalHudFont, "Food    : " + currentParty.EnergyReserve, new Vector2( 0.0F, 40.0F ), Color.LightGreen, 0, Vector2.Zero, 0.9F, SpriteEffects.None, 0 );
+
+      // TODO: Move this
+      List<GraphicsItem> selectedGraphicsItems = graphicsScene.getSelectedEntityItems();
+
+      selectedGraphicsItems.AddRange( graphicsScene.getSelectedUnitItems() );
+
+      foreach (GraphicsItem selectedGraphicsItem in selectedGraphicsItems)
+      {
+
+        if (selectedGraphicsItem.Texture.Bounds.Height > selectedGraphicsItem.Texture.Bounds.Width)
+        {
+          scaleFactor = ( selectedGraphicsItem.ScaleFactor * selectedGraphicsItem.Texture.Bounds.Height / selectedVisibleEntityOverlay.Bounds.Height ) * 1.2F;
+        }
+        else
+        {
+          scaleFactor = ( selectedGraphicsItem.ScaleFactor * selectedGraphicsItem.Texture.Bounds.Width / selectedVisibleEntityOverlay.Bounds.Width) * 1.2F;
+        }        
+
+        if (scaleFactor < 1)
+        {
+          scaleFactor = 1;
+          selectedVisibleEntityOverlayOffset.X = -( selectedVisibleEntityOverlay.Width / 2 ) *selectedGraphicsItem.ScaleFactor;
+          selectedVisibleEntityOverlayOffset.Y = -( selectedVisibleEntityOverlay.Height / 2 ) * selectedGraphicsItem.ScaleFactor;
+        }
+
+        spriteBatch.Draw( selectedVisibleEntityOverlay,
+                          selectedGraphicsItem.Position + selectedVisibleEntityOverlayOffset,
+                          null,
+                          Color.White,
+                          0f,
+                          Vector2.Zero,
+                          scaleFactor,
+                          SpriteEffects.None,
+                          0.0f );
+      }
+      
+
+    }
+
+    public void loadContent( ContentManager contentManager )
+    {
+      normalHudFont = contentManager.Load<SpriteFont>("SpriteFont1");
+      selectedVisibleEntityOverlay = contentManager.Load<Texture2D>( "selectedVisibleEntityOverlay" );
+
+      selectedVisibleEntityOverlayOffset.X = -( selectedVisibleEntityOverlay.Width / 2 ) * scaleFactor;
+      selectedVisibleEntityOverlayOffset.Y = -( selectedVisibleEntityOverlay.Height / 2 ) * scaleFactor;
+
+      List<GeoidalSector>geoidalSectors = world.getGeoidalSectors();
+
+      GraphicalSector graphicalSector;
+      
+      foreach (GeoidalSector geoidalSector in geoidalSectors)
+      {
+        graphicalSector = new GraphicalSector( geoidalSector, graphicsDevice, 1, 1, 13, true );
+
+        graphicalSectors.Add(graphicalSector);
+        
+        graphicalSector.LoadContent();
+      }
+    }
+
+    public void update( Microsoft.Xna.Framework.GameTime gameTime )
+    {
+      throw new NotImplementedException();
+    }
+
+    internal void setZoomFactor( float newZoomFactor )
+    {
+
+      foreach (GraphicalSector graphicalSector in graphicalSectors)
+      {
+
+        graphicalSector.ZoomFactor = newZoomFactor;
+      }
+
+    }
+
+    public void setCameraOffset( Vector2 cameraOffset )
+    {
+      foreach (GraphicalSector graphicalSector in graphicalSectors)
+      {
+
+        graphicalSector.CameraOffset = cameraOffset;
+      }
+
+    }
+  }
+}

GameProgram/GameProgram/Game/InputDevice.cs

+using System;
+
+/// <summary> http://www.innovativegames.net/blog/blog/2008/11/16/engine-tutorial-6/
+/// </summary>
+namespace Innovation
+{
+    // The base input device class. Other input device types will
+    // inherit from it. The <T> generic allows us to specify what
+    // type of input device state it manages. (MouseState, etc.)
+    public abstract class InputDevice<T> //: Component
+    {
+        // The State object of type T specified above
+        public abstract T State { get; }
+    }
+
+    // An input device event argument class that can handle events
+    // for several types of input device. "O" specified what type
+    // of object the event was triggered by (Key, Button,
+    // MouseButton, etc). "S" specifies the type of state the
+    // event provides (MouseState, KeyboardState, etc.)
+    public class InputDeviceEventArgs<O, S> : EventArgs
+    {
+        // The object of type O that triggered the event
+        public O Object;
+
+        // The input device that manages the state of type S that
+        // owns the triggered object
+        public InputDevice<S> Device;
+
+        // The state of the input device of type S that was triggered
+        public S State;
+
+        // Constructor takes the triggered object and input device
+        public InputDeviceEventArgs(O Object, InputDevice<S> Device)
+        {
+            this.Object = Object;
+            this.Device = Device;
+            this.State = ((InputDevice<S>)Device).State;
+        }
+    }
+
+    // An input device event handler delegate. This defines what type
+    // of method may handle an event. In this case, it is a void that
+    // accepts the specified input device arguments
+    public delegate void InputEventHandler<O, S>(object sender,
+        InputDeviceEventArgs<O, S> e);
+}

GameProgram/GameProgram/Game/Loading.cs

+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using Microsoft.Xna.Framework.Content;
+
+namespace GameProgram
+{
+  public interface Loading
+  {
+    void loadContent( ContentManager contentManager );
+  }
+}

GameProgram/GameProgram/Game/Moon.cs

+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace GameProgram
+{
+  public class Moon : Geoid
+  {
+    public Moon( PlanetarySystem planetarySystem, float parentOrbitRadius, float initialLongitude ) :
+      base( planetarySystem, parentOrbitRadius, initialLongitude )
+    {     
+
+      RelativeRadius = 0.05F;
+      float random = Game1WPFAdapter.randomNumber.Next( -100, 100 ) % 10;
+      orbitAngularSpeed = random * ( 2F * (float)Math.PI ) / 60.0F /(parentOrbitRadius*parentOrbitRadius/200000) /20;
+     
+    }
+
+  }
+}

GameProgram/GameProgram/Game/MoonFactory.cs

+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace GameProgram
+{
+  class MoonFactory
+  {
+    internal Moon createMoon( PlanetarySystem planetarySystem, float parentOrbitRadius, float initialLongitude )
+    {
+      Moon newMoon = new Moon( planetarySystem, parentOrbitRadius, initialLongitude);
+
+      return newMoon;
+    }
+  }
+}

GameProgram/GameProgram/Game/MouseDevice.cs

+using Microsoft.Xna.Framework.Input;
+using System;
+using System.Collections.Generic;
+using System.Reflection;
+using Microsoft.Xna.Framework;
+using Microsoft.Xna.Framework.Graphics;
+
+
+
+namespace Innovation
+{
+    // An enum of buttons on the mouse, since XNA doesn't provide one
+    public enum MouseButtons { Left, Right, Middle, X1, X2 };
+
+    // An input device that keeps track of the Mouse and MouseState
+    public class MouseDevice : InputDevice<MouseState>
+    {
+        // The last and current MouseStates
+        MouseState last;
+        MouseState current;
+
+        // The MouseButtons that are currently down
+        MouseButtons[] currentButtons;
+
+        GraphicsDevice graphicsDevice;
+
+        // Public properties for the above members
+        public override MouseState State { get { return current; } }
+        public MouseButtons[] PressedButtons { get { return currentButtons; } }
+
+        // The position in (X,Y) coordinates of the mouse. Setting the mouse
+        // position will tell XNA to move the mouse
+        Vector2 position;
+        public Vector2 Position
+        {
+            get { return position; }
+            set 
+            { 
+                position = value; 
+                Mouse.SetPosition((int)value.X, (int)value.Y); 
+            }
+        }
+
+        // The change in position of the mouse between the last two frames
+        public Vector2 Delta = Vector2.Zero;
+
+        // Whether to reset the mouse to the middle of the screen on each
+        // update to simulate a screen with no borders
+        public bool ResetMouseAfterUpdate = false;
+
+        // The current position of the scroll wheel
+        public float ScrollPosition { get { return current.ScrollWheelValue; } }
+
+        // The change in position of the scroll wheel between the last two
+        // frames
+        public float ScrollDelta = 0;
+
+        // Events for when a button is pressed, released, or held
+        public event InputEventHandler<MouseButtons, MouseState> ButtonPressed;
+        public event InputEventHandler<MouseButtons, MouseState> ButtonReleased;
+        public event InputEventHandler<MouseButtons, MouseState> ButtonHeld;
+
+        // Constructor gets the initial MouseState, moves the mouse to the
+        // center of the screen, and does the first update
+        public MouseDevice( GraphicsDevice graphicsDevice )
+        {
+          this.graphicsDevice = graphicsDevice;
+
+            if (ResetMouseAfterUpdate)
+                Position = new Vector2(
+                    graphicsDevice.Viewport.Width / 2,
+                    graphicsDevice.Viewport.Height / 2 );
+
+            current = Mouse.GetState();
+            Update();
+        }
+
+        // List of pressed buttons used to setup currentButtons
+        List<MouseButtons> pressed = new List<MouseButtons>();
+
+        // public override void Update()
+        public void Update()
+        {
+            // Update the last state
+            last = current;
+
+            // Extract the scroll wheel position from the last state
+            float lastScrollWheel = last.ScrollWheelValue;
+
+            // Update the current state and clear the list of pressed
+            // buttons
+            current = Mouse.GetState();
+            pressed.Clear();
+
+            // Calculcate the scroll delta with the current position
+            // and the copy of the last position we made earlier
+            ScrollDelta = ScrollPosition - lastScrollWheel;
+
+            // If we are supposed to reset the mouse after each update...
+            if (ResetMouseAfterUpdate)
+            {
+                // Find the center of the screen
+                Vector2 center = new Vector2(
+                    graphicsDevice.Viewport.Width / 2,
+                    graphicsDevice.Viewport.Height / 2);
+
+                // Find the mouse's distance from the center of the screen to
+                // find the change in position
+                Delta = new Vector2(current.X - center.X, current.Y - center.Y);
+
+                // Move the mouse back to the center so we never run out of
+                // screen space
+                Position = center;
+            }
+            else
+                // Otherwise just find the difference in position between the
+                // last two frames
+                Delta = new Vector2(current.X - last.X, current.Y - last.Y);
+
+            // For each mouse button...
+            foreach (MouseButtons button in Util.GetEnumValues<MouseButtons>())
+            {
+                // If it is down, add it to the list
+                if (IsButtonDown(button))
+                    pressed.Add(button);
+
+                // If it was just pressed, fire the event
+                if (WasButtonPressed(button))
+                    if (ButtonPressed != null)
+                        ButtonPressed(this, new InputDeviceEventArgs
+                            <MouseButtons, MouseState>(button, this));
+
+                // If it was just released, fire the event
+                if (WasButtonReleased(button))
+                    if (ButtonReleased != null)
+                        ButtonReleased(this, new InputDeviceEventArgs
+                            <MouseButtons, MouseState>(button, this));
+
+                // If it was held, fire the event
+                if (WasButtonHeld(button))
+                    if (ButtonHeld != null)
+                        ButtonHeld(this, new InputDeviceEventArgs
+                            <MouseButtons, MouseState>(button, this));
+            }
+
+            // Update the currentButtons array from the list of buttons
+            // that are down
+            currentButtons = pressed.ToArray();
+        }
+
+        // Whether the specified button is currently down
+        public bool IsButtonDown(MouseButtons Button)
+        {
+            return IsButtonDown(Button, current);
+        }
+
+        // An internal version of IsButtonDown that also allows us
+        // to specify which state the check against
+        bool IsButtonDown(MouseButtons Button, MouseState State)
+        {
+            return GetButtonState(Button, State) == 
+                ButtonState.Pressed ? true : false;
+        }
+
+        // Whether the specified button is currently up
+        public bool IsButtonUp(MouseButtons Button)
+        {
+            return IsButtonUp(Button, current);
+        }
+
+        // An internal version of IsButtonUp that also allows us
+        // to specify which state the check against
+        bool IsButtonUp(MouseButtons Button, MouseState State)
+        {
+            return GetButtonState(Button, State) == 
+                ButtonState.Released ? true : false;
+        }
+
+        // Whether the specified button is down for the time this frame
+        public bool WasButtonPressed(MouseButtons Button)
+        {
+            if (IsButtonUp(Button, last) && IsButtonDown(Button, current))
+                return true;
+
+            return false;
+        }
+
+        // Whether the specified button is up for the first this frame
+        public bool WasButtonReleased(MouseButtons Button)
+        {
+            if (IsButtonDown(Button, last) && IsButtonUp(Button, current))
+                return true;
+
+            return false;
+        }
+
+        // Whether the specified button has been down for more than one frame
+        public bool WasButtonHeld(MouseButtons Button)
+        {
+            if (IsButtonDown(Button, last) && IsButtonDown(Button, current))
+                return true;
+
+            return false;
+        }
+
+        // Retrieves the ButtonState of the specified button from the 
+        // specified state.
+        ButtonState GetButtonState(MouseButtons Button, MouseState State)
+        {
+            if (Button == MouseButtons.Left)
+                return State.LeftButton;
+            else if (Button == MouseButtons.Middle)
+                return State.MiddleButton;
+            else if (Button == MouseButtons.Right)
+                return State.RightButton;
+            else if (Button == MouseButtons.X1)
+                return State.XButton1;
+            else if (Button == MouseButtons.X2)
+                return State.XButton2;
+
+            return ButtonState.Released;
+        }
+    }
+
+  public static class Util
+  {
+    public static List<T> GetEnumValues<T>()
+    {
+      Type currentEnum = typeof( T );
+      List<T> resultSet = new List<T>();
+
+      if (currentEnum.IsEnum)
+      {
+        FieldInfo[] fields = currentEnum.GetFields( BindingFlags.Static | BindingFlags.Public );
+        foreach (FieldInfo field in fields)
+          resultSet.Add( (T)field.GetValue( null ) );
+      }
+      else
+        throw new ArgumentException( "The argument must of type Enum or of a type derived from Enum", "T" );
+
+      return resultSet;
+    }
+  }
+}

GameProgram/GameProgram/Game/Party.cs

+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using Microsoft.Xna.Framework;
+
+namespace GameProgram
+{
+  public class Party : GameEntity
+  {
+    private List<Region> regions = new List<Region>();
+    private List<Unit> units = new List<Unit>();
+    private Color color;
+
+    public Color Color
+    {
+      get { return color; }
+      set { color = value; }
+    }
+
+    public List<Unit> Units
+    {
+      get { return units; }
+      set { units = value; }
+    }
+    private float energyReserve = 0;
+    private TimeSpan lastUpdate = TimeSpan.Zero;
+
+    public float EnergyReserve
+    {
+      get { return energyReserve; }
+      set { energyReserve = value; }
+    }
+
+    //public Party( Planet startingPLanet)
+    //{
+
+    //}
+
+    public Party( Color color)
+    {
+      this.color = color;
+      // TODO: Complete member initialization
+    }
+
+    public PartyGameEntity Entity
+    {
+      get
+      {
+        throw new System.NotImplementedException();
+      }
+      set
+      {
+      }
+    }
+
+    internal void settlePlanet( Planet startingPlanet )
+    {
+      RegionFactory regionFactory = new RegionFactory();
+
+      Region startingRegion = regionFactory.createRegion( this, startingPlanet);
+
+      regions.Add( startingRegion );
+    }
+
+    public override List<VisibleGameEntity> getChildVisableGameEntities()
+    {
+      return new List<VisibleGameEntity>();
+    }
+
+    public override void update( GameTime gameTime )
+    {
+
+      if ( gameTime.TotalGameTime.Subtract(lastUpdate).Seconds >= 1)
+      {
+
+        energyReserve = 0;
+        foreach (Region region in regions)
+        {
+          region.update( gameTime );
+          energyReserve += region.EnergyReserve;
+        }
+
+
+
+        lastUpdate = gameTime.TotalGameTime;
+      }
+
+      foreach (Unit unit in units)
+      {
+        unit.update( gameTime );
+      }
+      
+    }
+
+    public void AddUnit( Unit newUnit )
+    {
+      units.Add( newUnit );
+    }
+  }
+}

GameProgram/GameProgram/Game/PartyFactory.cs

+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using Microsoft.Xna.Framework;
+
+namespace GameProgram
+{
+  class PartyFactory
+  {
+    internal Party createParty( Color color)
+    {
+      Party newParty = new Party( color );
+
+      Unit newUnit = UnitFactory.createUnit( newParty, new Vector2( Game1.randomNumber.Next(-400,400), 
+                                                                    Game1.randomNumber.Next(-240,240)));
+
+      newParty.AddUnit( newUnit );
+
+      newUnit = UnitFactory.createUnit( newParty, new Vector2( Game1.randomNumber.Next( -400, 400 ),
+                                                              Game1.randomNumber.Next( -240, 240 ) ) );
+
+      newParty.AddUnit( newUnit );
+
+      newUnit = UnitFactory.createUnit( newParty, new Vector2( Game1.randomNumber.Next( -400, 400 ),
+                                                              Game1.randomNumber.Next( -240, 240 ) ) );
+
+      newParty.AddUnit( newUnit );
+
+      newUnit = UnitFactory.createUnit( newParty, new Vector2( Game1.randomNumber.Next( -400, 400 ),
+                                                              Game1.randomNumber.Next( -240, 240 ) ) );
+
+      newParty.AddUnit( newUnit );
+      
+      return newParty;
+    }
+  }
+}

GameProgram/GameProgram/Game/Planet.cs

+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace GameProgram
+{
+  public class Planet : Geoid
+  {  
+    public Planet( PlanetarySystem planetarySystem, float parentOrbitRadius, float initialLongitude ) :
+      base( planetarySystem, parentOrbitRadius, initialLongitude )
+    {
+      RelativeRadius = 0.25F;
+     
+    }
+
+  }
+}

GameProgram/GameProgram/Game/PlanetFactory.cs

+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace GameProgram
+{
+  class PlanetFactory
+  {
+    internal Planet createPlanet( PlanetarySystem planetarySystem, float parentOrbitRadius, float initialLongitude )
+    {
+      Planet newPlanet = new Planet(  planetarySystem, parentOrbitRadius, initialLongitude);
+
+      return newPlanet;
+      
+    }
+
+  }
+}

GameProgram/GameProgram/Game/PlanetarySystem.cs

+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using Microsoft.Xna.Framework;
+
+namespace GameProgram
+{
+  public class PlanetarySystem : GameEntity, Location
+  {
+    private StarSystem starSystem;
+    private Planet planet;
+    private List<Moon> moons = new List<Moon>();
+    private Vector2 coordinatesWrtStarSystemOrigin = Vector2.Zero;
+    //private Vector2 velocityWrtStarSystemOrigin = Vector2.Zero;
+    //private Vector2 accelerationWrtStarSystemOrigin = Vector2.Zero;
+    private float parentOrbitRadius = 0.0F;
+    private float longitude = 0.0F;
+    private float angularSpeed = ( ( 2F * (float)Math.PI ) / 60.0F );
+
+    public PlanetarySystem( StarSystem starSystem, float parentOrbitRadius, float initialLongitude )
+    {
+      this.starSystem = starSystem;
+      this.parentOrbitRadius = parentOrbitRadius;
+      this.longitude = initialLongitude;
+