Click or drag to resize
DigitalRuneIGameTimer Interface
Controls the timing of a game or a game component.

Namespace: DigitalRune.Game.Timing
Assembly: DigitalRune.Game (in DigitalRune.Game.dll) Version: 1.4.0.0 (1.4.0.14427)
Syntax
public interface IGameTimer

The IGameTimer type exposes the following members.

Methods
  NameDescription
Public methodReset
Stops the timer and resets the time to zero.
Public methodStart
Starts/resumes the timer.
Public methodStop
Pauses the timer.
Top
Properties
  NameDescription
Public propertyAccumulatedTime
Gets the accumulated time.
Public propertyClock
Gets or sets the clock.
Public propertyDeltaTime
Gets the elapsed game time since the last time step.
Public propertyFrameCount
Gets the number of frames since the start of the timer (= the number of TimeChanged events).
Public propertyIdleTime
Gets the idle time.
Public propertyIsRunning
Gets a value indicating whether the timer is running.
Public propertyLostTime
Gets the amount of time dropped in the current time step.
Public propertySpeed
Gets or sets the speed ratio at which the game time progresses.
Public propertyTime
Gets the game time.
Top
Events
  NameDescription
Public eventIdle
Occurs when application is idle.
Public eventTimeChanged
Occurs when the game time has advanced.
Top
Remarks

IGameTimers must be attached to a IGameClock. They are updated automatically by handling the clock's TimeChanged event.

A game usually has one IGameClock that is running permanently and acts as the central time source. Each game or game component can further have its own IGameTimer. The IGameTimer controls the timing of the game component. For example: A FixedStepTimer ensures that a game component is updated with a constant frame rate. All IGameTimers are updated by the central IGameClock.

The terms 'time step' and 'frame' in this documentation refer to the TimeChanged event. The TimeChanged event triggers a new time step. (In a game the TimeChanged event usually triggers the "Update" method of a game module which computes and renders the next frame.)

See Also