using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using System.Diagnostics;

namespace ShootingHero
{
	public class FrameCalculator : GameComponent
	{
		int elapsed, count;

		public FrameCalculator ( Game game )
			: base ( game )
		{
#if DEBUG
			Enabled = true;
#else
			Enabled = false;
#endif
		}

		public override void Update ( GameTime gameTime )
		{
			elapsed += gameTime.ElapsedGameTime.Milliseconds;
			count++;

			if ( elapsed >= 1000 )
			{
				Debug.WriteLine ( "FPS:{0}", count * ( elapsed / 1000.0f ) );
				count = 0;
				elapsed -= 1000;
			}

			base.Update ( gameTime );
		}
	}
}
