Class GameTime
Current timing used for variable-step (real time) or fixed-step (game time) games.
public class GameTime
- Inheritance
-
GameTime
Constructors
GameTime()
Initializes a new instance of the GameTime class.
public GameTime()
GameTime(TimeSpan, TimeSpan)
Initializes a new instance of the GameTime class.
public GameTime(TimeSpan totalTime, TimeSpan elapsedTime)
Parameters
totalTime
TimeSpanThe total game time since the start of the game.
elapsedTime
TimeSpanThe elapsed game time since the last update.
Properties
Elapsed
Gets the elapsed game time since the last update
public TimeSpan Elapsed { get; }
Property Value
- TimeSpan
The elapsed game time.
Factor
Gets or sets the time factor.
This value controls how much the warped time flows, this includes physics, animations and particles.
A value between 0 and 1 will slow time, a value above 1 will make it faster.
public double Factor { get; set; }
Property Value
- double
The multiply factor, a double value higher or equal to 0
FrameCount
Gets the current frame count since the start of the game.
public int FrameCount { get; }
Property Value
FramePerSecond
Gets the number of frame per second (FPS) for the current running game.
public float FramePerSecond { get; }
Property Value
- float
The frame per second.
FramePerSecondUpdated
Gets a value indicating whether the FramePerSecond and TimePerFrame were updated for this frame.
public bool FramePerSecondUpdated { get; }
Property Value
- bool
true
if the FramePerSecond and TimePerFrame were updated for this frame; otherwise,false
.
TimePerFrame
Gets the time per frame.
public TimeSpan TimePerFrame { get; }
Property Value
- TimeSpan
The time per frame.
Total
Gets the amount of game time since the start of the game.
public TimeSpan Total { get; }
Property Value
- TimeSpan
The total game time.
WarpElapsed
Gets the amount of time elapsed multiplied by the time factor.
public TimeSpan WarpElapsed { get; }
Property Value
- TimeSpan
The warped elapsed time
Methods
ResetTimeFactor()
public void ResetTimeFactor()