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

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

		public TitleScreen(Game game) : base(game)
		{
			_spriteBatch = new SpriteBatch(game.GraphicsDevice);
#if WINDOWS_PHONE_APP
			_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(640, 640), Color.White);
#elif WINDOWS_PHONE_APP
			_spriteBatch.DrawString(_font, "Tap to Play", new Vector2(280, 750), Color.White);
#endif
			_spriteBatch.End();
		}
	}
}
