So I wrote a simple FPS counter class which literally counts how many times it is updated per second. Seems to work fine, however when using the RenderWindow.SetFramerateLimit() method the counter gives a different count to what I'm limiting to.
RenderWindow.SetFramerateLimit(16) returns a count of 17.
RenderWindow.SetFramerateLimit(30) returns a count of 32.
RenderWindow.SetFramerateLimit(60) returns a count of 64.
RenderWindow.SetFramerateLimit(120) returns a count of 144.
Is this expected behaviour or is my counter just horribly written?
public class FpsCounter
{
private uint _timer;
private int _frameCount;
private int _fps;
public int Fps
{
get
{
return _fps;
}
}
public void Update()
{
if (_timer < Time.TickCount)
{
_fps = _frameCount;
_frameCount = 0;
_timer = Time.TickCount + 1000;
}
_frameCount++;
}
}