GlobalTime Fps Property Delta Engine Documentation

Namespace: DeltaEngine.Core
Assembly: DeltaEngine (in DeltaEngine.dll) Version: 1.1.1.0 (1.1.1)
Syntax

public int Fps { get; }

Property Value

Type: Int32
Remarks

Tests: DeltaEngine.Tests.Core.GlobalTimeTests
Examples

3 unit tests call DeltaEngine.Core.GlobalTime.Fps
[Test]
public void CalculateFps()
{
    do
        time.Update();
    while (time.Milliseconds <= 1000);
    Assert.IsTrue(Math.Abs(time.Fps - 20) <= 1, "Fps=" + time.Fps);
}
[Test]
public void FpsShouldBeSixty()
{
    Assert.AreEqual(60, GlobalTime.Current.Fps);
}
[Test, Ignore]
public void CalculateFpsWithStopwatch()
{
    time = new StopwatchTime();
    const int TargetFps = 30;
    do
    {
        Thread.Sleep(1000 / TargetFps);
        time.Update();
    } while (time.Milliseconds < 1000);
    Assert.IsTrue(Math.Abs(time.Fps - TargetFps) <= 5, "Fps=" + time.Fps);
}
See Also