private void UpdateFramerate()
{
// Increase the frames
Frames++;
// Check the timer
if (Timer.ElapsedMilliseconds >= 1000)
{
// Set the framerate
Framerate = (float) Math.Round(Frames*1000/Timer.ElapsedMilliseconds);
// Reset the timer again so we can count the framerate again
Timer.Reset();
Timer.Start();
Frames = 0;
}
}