Skip to content

Commit

Permalink
Making FPS counter less glitchy.
Browse files Browse the repository at this point in the history
  • Loading branch information
MainMemory committed May 25, 2015
1 parent 5615934 commit ee6f8a8
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions SonicBGScrollSaver/MainForm.cs
Expand Up @@ -145,7 +145,10 @@ void DrawBackground()
{
DateTime now = DateTime.Now;
if (frametimes.Count > 0)
{
fpsLabel.Text = "FPS: " + (frametimes.Count / (now - frametimes.Peek()).TotalSeconds).ToString("0.###");
Application.DoEvents();
}
if (frametimes.Count == settings.FramesPerSecond * 5)
frametimes.Dequeue();
frametimes.Enqueue(now);
Expand Down

0 comments on commit ee6f8a8

Please sign in to comment.