using System;

using Icarus.Logic.GameEngine;
using Icarus.LUCIE;
using Icarus.Renderer;
using Icarus.Renderer.Animation;

namespace TuxHunter.GameStates
{
	/// <summary>
	/// This is a generic menu state. A menu state is basically this thing where nothing but LUCIE components is being rendered.
	/// </summary>
	public abstract class MenuState : GameStateAdapter
	{
		/// <summary>
		/// The root of the user interface.
		/// </summary>
		private RootComponent mUserInterface = null;

		/// <summary>
		/// Creates a new menu state.
		/// </summary>
		public MenuState()
		{
			mUserInterface = new RootComponent(Direct3DSettings.Instance.ParentWindow);
			mUserInterface.IsVisible = true;
		}

		public override void Enter()
		{
			this.UserInterface.IsListeningForEvents = true;
		}

		public override void Unpause()
		{
			this.UserInterface.IsListeningForEvents = true;
		}

		public override void Pause()
		{
			this.UserInterface.IsListeningForEvents = false;
		}

		public override void Exit()
		{
			this.UserInterface.IsListeningForEvents = false;
		}

		/// <summary>
		/// Returns the user interface of the state.
		/// </summary>
		public RootComponent UserInterface
		{
			get { return mUserInterface; }
		}

		/// <summary>
		/// Renders the user interface.
		/// </summary>
		/// <param name="parameters"></param>
		public override void RenderState(Icarus.Graphics.Animation.IRenderParameters parameters)
		{
			mUserInterface.Render(mUserInterface.Bounds, parameters);
		}
	}
}
