VariableStepTimer Class |
Namespace: DigitalRune.Game.Timing
The VariableStepTimer type exposes the following members.
Name | Description | |
---|---|---|
VariableStepTimer |
Initializes a new instance of the VariableStepTimer class.
|
Name | Description | |
---|---|---|
Equals | (Inherited from Object.) | |
Finalize | Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.) | |
GetHashCode | Serves as a hash function for a particular type. (Inherited from Object.) | |
GetType | Gets the Type of the current instance. (Inherited from Object.) | |
MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) | |
OnIdle |
Raises the Idle event.
| |
OnTimeChanged |
Raises the TimeChanged event.
| |
Reset |
Stops the timer and resets the time to zero.
| |
Start |
Starts/resumes the timer.
| |
Stop |
Pauses the timer.
| |
ToString | Returns a string that represents the current object. (Inherited from Object.) |
Name | Description | |
---|---|---|
AccumulatedTime |
Gets the accumulated time.
| |
Clock |
Gets or sets the clock.
| |
DeltaTime |
Gets the elapsed game time since the last time step.
| |
FrameCount |
Gets the number of frames since the start of the timer (= the number of
TimeChanged events).
| |
IdleTime |
Gets the idle time.
| |
IsRunning |
Gets a value indicating whether the timer is running.
| |
LostTime |
Gets the amount of time dropped in the current time step.
| |
MaxDeltaTime |
Gets or sets the maximal amount of time for a time step.
| |
MinDeltaTime |
Gets or sets the minimal size of a time step.
| |
Speed |
Gets or sets the speed ratio at which the game time progresses.
| |
Time |
Gets the game time.
|
Name | Description | |
---|---|---|
Idle |
Occurs when application is idle.
| |
TimeChanged |
Occurs when the game time has advanced.
|
See IGameTimer for basic information about game timers.
The VariableStepTimer triggers a new time step (TimeChanged event) as soon as the last time step has finished. DeltaTime returns the elapsed time since the last time step.
MinDeltaTime (default: 0) can be used to set the minimal size of a time step. If MinDeltaTime is greater than 0 than the timer waits until at least MinDeltaTime has passed before the next time step is triggered. During the waiting time the Idle event is raised. IdleTime indicates the time to wait until the next time step.
MaxDeltaTime (default: MaxValue) can be used to set the maximal size of a time step. If the previous time step took longer than MaxDeltaTime, then the size of the time step will be limited to MaxDeltaTime. The time beyond this value will be ignored. LostTime indicates the time that has been dropped.
Memory Leaks: If a Clock is set and the timer is running, the game timer handles the TimeChanged event of the clock. This means, the clock stores a strong reference to the timer and might prevent the timer from being garbage collected. If the timer is not needed anymore, call Stop or set the property Clock tp to allow the timer to be garbage collected.