Nebula
Loading...
Searching...
No Matches
Game::TimeSource Struct Reference

#include <timesource.h>

Detailed Description

An object that keeps track of running time and frame time (delta time).

Each time source tracks its own time independently from the other time sources, they can also be paused and unpaused independentlty from each other, and they may also run faster or slower then realtime.

A time source created with a fixed frame time does not follow realtime. It accumulates real time and turns it into whole steps of fixedFrameTime, and frameTime is then always that step. The steps are consumed by Game::Time::ConsumeFixedStep, which is what a fixed frame event in the frame pipeline runs on.

Note
You should never create TimeSources by using new. Instead, use Game::Time::CreateTimeSource.
Todo
These are currently not thread safe.
See also
Game::Time::CreateTimeSource
Game::Time::GetTimeSource
Game::Time::ConsumeFixedStep

Public Attributes

Timing::Time const frameTime
 delta time between this frame and last frame. Always fixedFrameTime for a fixed time source
Timing::Time const time
 total time this timesource has run for
Timing::Tick const ticks
 number of ticks that this time source has run for
Timing::Time const fixedFrameTime
 the fixed step this source advances by, 0 when the source follows real frame time
Timing::Time const accumulator
 real time which has not been turned into a fixed step yet
IndexT const availableSteps
 fixed steps available to run this frame
IndexT const maxStepsPerFrame
 max fixed steps available per frame
int pauseCounter
 increment this to pause time, decrement to continue running
float timeFactor
 time factor for this time source

Member Data Documentation

◆ accumulator

Timing::Time const Game::TimeSource::accumulator

real time which has not been turned into a fixed step yet

◆ availableSteps

IndexT const Game::TimeSource::availableSteps

fixed steps available to run this frame

◆ fixedFrameTime

Timing::Time const Game::TimeSource::fixedFrameTime

the fixed step this source advances by, 0 when the source follows real frame time

◆ frameTime

Timing::Time const Game::TimeSource::frameTime

delta time between this frame and last frame. Always fixedFrameTime for a fixed time source

◆ maxStepsPerFrame

IndexT const Game::TimeSource::maxStepsPerFrame

max fixed steps available per frame

◆ pauseCounter

int Game::TimeSource::pauseCounter

increment this to pause time, decrement to continue running

◆ ticks

Timing::Tick const Game::TimeSource::ticks

number of ticks that this time source has run for

◆ time

Timing::Time const Game::TimeSource::time

total time this timesource has run for

◆ timeFactor

float Game::TimeSource::timeFactor

time factor for this time source


The documentation for this struct was generated from the following file: