using System;
using GDI=System.Drawing;

using D3D=Microsoft.DirectX.Direct3D;

using Icarus.Graphics.Animation;
using Icarus.Renderer;

namespace Icarus.Renderer.Animation
{
	/// <summary>
	/// Text implementation for directx.
	/// </summary>
	public class D3DText : AbstractText
	{
		/// <summary>
		/// The directx font corresponding to the system font we are using.
		/// </summary>
		private D3D.Font mFont;

		public D3DText(string text, GDI.Color c, GDI.Font f) : base(text, c, f) { }

		public override void UpdateText()
		{
			mFont = new D3D.Font(Direct3DSettings.Instance.RenderingDevice, this.GetFont());
		}

		public override void Render(GDI.Rectangle destination, IRenderParameters parameters)
		{
			D3DRenderParameters p = (D3DRenderParameters) parameters;

			mFont.DrawText(p.TargetSprite, this.GetText(), destination.Location, this.GetColor());
		}
	}
}
