using System;
using PlanetExpress.Tools;
using System.Drawing;

using OpenTK;
using OpenTK.Graphics;
using OpenTK.Graphics.OpenGL;

namespace PlanetExpress.items.effects	
{
	public class HeardEffect : CustomEffect {
		public static void Show(float x, float y) {
			CustomEffect eff = new HeardEffect();
			eff.X = x;
			eff.Y = y;
			MissionScreenClass.Area.AddObject(eff);
		}
		
		TexClass Heard;
		float tick = 1f;
		public HeardEffect () : base() {
			Heard = TexMan.LoadTexture(GameApp.GameFileName("data", "items", "heard.png"));			
		}
		
		
		public override bool Action (double time) {
			base.Action (time);
			tick -= 1f * (float)time;
			return tick > 0;
		}
		
		public override void Draw () {		
			GL.PushMatrix(); {
				float off = (float)(1f-tick) * 48f;
				GL.Translate(X - Heard.Width/2 + off, Y-Heard.Height/2 - off, 0);
				GL.Color4(new float[]{1f, 1f, 1f, tick/2f});
				GL.Scale(2f-tick, 2f-tick, 1f);
				Heard.Render(0f, 0f);
			} GL.PopMatrix();
		}
	}
}

