using System;
using System.Drawing;

using Icarus.Graphics.Animation;
using Icarus.LUCIE;

namespace TuxHunter.UI
{
	/// <summary>
	/// This is a HUD for in-game stuff. 
	/// </summary>
	public class InGameHud : AbstractComponent
	{
		private StatusBar mHealthBar;

		public InGameHud()
		{
			// Make the background:
			Bitmap bmpBackground = FramesetManager.getInstance().loadImageFromId("ui/GameDisplay/StatusBar.gif");
			ImageComponent hudBackground = new ImageComponent(bmpBackground);
			hudBackground.Location = new Point(0, 0);
			hudBackground.IsVisible = true;

			// Make the health bar:
			Bitmap bmpLeft = FramesetManager.getInstance().loadImageFromId("ui/GameDisplay/HealthBar/Left.png");
			Bitmap bmpRight = FramesetManager.getInstance().loadImageFromId("ui/GameDisplay/HealthBar/Right.png");
			Bitmap bmpFiller = FramesetManager.getInstance().loadImageFromId("ui/GameDisplay/HealthBar/Filler.png");
			mHealthBar = new StatusBar(bmpLeft, bmpFiller, bmpRight);
			mHealthBar.Location = new Point(72, 19);
			mHealthBar.Size = new Size(225, mHealthBar.Size.Height);
			mHealthBar.IsVisible = true;
			mHealthBar.MaximumValue = 100;
			mHealthBar.CurrentValue = 100;

			// Make whip image:
			Bitmap bmpWhip = FramesetManager.getInstance().loadImageFromId("ui/GameDisplay/Weapons/Whip.png");
			ImageComponent imgWhip = new ImageComponent(bmpWhip);
			imgWhip.Location = new Point(7, 7);
			imgWhip.IsVisible = true;

			// Add children to background:
			hudBackground.AddChild(mHealthBar);
			hudBackground.AddChild(imgWhip);

			// Add background to me:
			this.AddChild(hudBackground);
		}

		/// <summary>
		/// Gets or sets the displayer health of the player.
		/// </summary>
		public int PlayerHealth
		{
			get { return mHealthBar.CurrentValue; }
			set { mHealthBar.CurrentValue = value; }
		}

		protected override void RenderSelf(Rectangle coordinates, IRenderParameters parameters)
		{
			// Nothing special to do...
		}
	}
}
