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.Input.Touch;
using Microsoft.Xna.Framework.Media;

namespace SpaceWinnie
{
	public class Main : Microsoft.Xna.Framework.Game
	{
		GraphicsDeviceManager graphics;
		SpriteBatch spriteBatch;
		Camera camera;

		public Camera Camera { get { return camera; } }

		public Main ()
		{
			graphics = new GraphicsDeviceManager ( this );
			graphics.PreferredBackBufferWidth = 800;
			graphics.PreferredBackBufferHeight = 480;
			Content.RootDirectory = "Content";

			TargetElapsedTime = TimeSpan.FromTicks ( 333333 );
		}

		protected override void Initialize ()
		{

			base.Initialize ();
		}

		protected override void LoadContent ()
		{
			spriteBatch = new SpriteBatch ( GraphicsDevice );

			camera = new Camera ( this, CameraType.AirCraft );
			camera.Position = new Vector3 ( 0, 3, 4 );
			camera.Pitch ( 345.0f / 180 * ( float ) Math.PI );

			Components.Add ( new GameState ( this ) );
		}

		protected override void UnloadContent ()
		{

		}

		protected override void Update ( GameTime gameTime )
		{
			if ( GamePad.GetState ( PlayerIndex.One ).Buttons.Back == ButtonState.Pressed )
				this.Exit ();

			base.Update ( gameTime );
		}

		protected override void Draw ( GameTime gameTime )
		{
			GraphicsDevice.Clear ( Color.CornflowerBlue );

			base.Draw ( gameTime );
		}
	}
}
