nCine::FrameTimer class

Frame interval and average FPS calculator.

Public static variables

static float FramesPerSecond constexpr
static float SecondsPerFrame constexpr

Constructors, destructors, conversion operators

FrameTimer(float logInterval, float avgInterval)
Constructor.

Public functions

void AddFrame()
Adds a frame to the counter and calculates the interval since the previous one.
void Suspend()
Starts counting the suspension time.
auto Resume() -> TimeStamp
Drifts timers by the duration of last suspension.
auto GetTotalNumberFrames() const -> std::uint32_t
Returns the total number of frames counted.
auto GetLastFrameDuration() const -> float
Returns the last frame duration in seconds between the last two subsequent calls to addFrame()
auto GetFrameDuration() const -> float
Returns current frame duration in seconds since the last call to addFrame()
auto GetFrameDurationAsTicks() const -> std::uint64_t
Returns current frame duration in ticks since the last call to addFrame()
auto GetAverageFps() const -> float
Returns the average FPS during the update interval.
auto GetTimeMult() const -> float
Returns a factor that represents how long the last frame took relative to the desired frame time.

Function documentation

TimeStamp nCine::FrameTimer::Resume()

Drifts timers by the duration of last suspension.

Returns A timestamp with last suspension duration