GameTime Class
Namespace: Stride.GamesAssembly: Stride.Games.dll
Current timing used for variable-step (real time) or fixed-step (game time) games.
public class GameTime
| Name | Description | |
|---|---|---|
| Constructors | ||
| GameTime() | Initializes a new instance of the GameTime class. |
|
| GameTime(TimeSpan, TimeSpan) | Initializes a new instance of the GameTime class. |
|
| Properties | ||
| Elapsed | Gets the elapsed game time since the last update |
|
| Factor | Gets or sets the time factor. |
|
| FrameCount | Gets the current frame count since the start of the game. |
|
| FramePerSecond | Gets the number of frame per second (FPS) for the current running game. |
|
| FramePerSecondUpdated | Gets a value indicating whether the FramePerSecond and TimePerFrame were updated for this frame. |
|
| TimePerFrame | Gets the time per frame. |
|
| Total | Gets the amount of game time since the start of the game. |
|
| WarpElapsed | Gets the amount of time elapsed multiplied by the time factor. |
|
| Methods | ||
| ResetTimeFactor() | ||
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
| Type | Name | Description |
|---|---|---|
| System.TimeSpan | totalTime | The total game time since the start of the game. |
| System.TimeSpan | elapsedTime | The elapsed game time since the last update. |
Properties
Elapsed
Gets the elapsed game time since the last update
public TimeSpan Elapsed { get; }
Property Value
| Type | Description |
|---|---|
| System.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
| Type | Description |
|---|---|
| System.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
| Type | Description |
|---|---|
| System.Int32 |
FramePerSecond
Gets the number of frame per second (FPS) for the current running game.
public float FramePerSecond { get; }
Property Value
| Type | Description |
|---|---|
| System.Single | 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
| Type | Description |
|---|---|
| System.Boolean |
|
TimePerFrame
Gets the time per frame.
public TimeSpan TimePerFrame { get; }
Property Value
| Type | Description |
|---|---|
| System.TimeSpan | The time per frame. |
Total
Gets the amount of game time since the start of the game.
public TimeSpan Total { get; }
Property Value
| Type | Description |
|---|---|
| System.TimeSpan | The total game time. |
WarpElapsed
Gets the amount of time elapsed multiplied by the time factor.
public TimeSpan WarpElapsed { get; }
Property Value
| Type | Description |
|---|---|
| System.TimeSpan | The warped elapsed time |
Methods
ResetTimeFactor()
public void ResetTimeFactor()