using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

namespace AlienAttack
{
	public class TitleScreen : DrawableGameComponent
	{
		private Texture2D _titleScreen;
		private SpriteFont _font;
		private SpriteBatch _spriteBatch;

		public TitleScreen(Game game) : base(game)
		{
			_spriteBatch = new SpriteBatch(game.GraphicsDevice);
#if WINDOWS_PHONE
			_titleScreen = game.Content.Load<Texture2D>("gfx\\titleScreenWP7");
#else
			_titleScreen = game.Content.Load<Texture2D>("gfx\\titleScreen");
#endif
			_font = game.Content.Load<SpriteFont>("Font");
		}

		public override void Update(GameTime gameTime)
		{
			if(InputManager.ControlState.Start)
				AlienAttackGame.Instance.SetState(GameState.GameScreen);
		}

		public override void Draw(GameTime gameTime)
		{
			_spriteBatch.Begin();
			_spriteBatch.Draw(_titleScreen, Vector2.Zero, Color.White);
#if WINDOWS
			_spriteBatch.DrawString(_font, "Press Enter or Start to Play", new Vector2(600, 680), Color.White);
#elif XBOX
			_spriteBatch.DrawString(_font, "Press Start to Play", new Vector2(600, 680), Color.White);
#elif WINDOWS_PHONE
			_spriteBatch.DrawString(_font, "Tap to Play", new Vector2(280, 750), Color.White);
#endif
			_spriteBatch.End();
		}
	}
}
