Struct TimeStep
Represents the amount of time elapsed since the last update.
public struct TimeStep : IEquatable<TimeStep>
- Implements
- Inherited Members
Constructors
TimeStep(double, double)
Initializes a new instance of the TimeStep structure using the specified fixed-step elapsed time and variable-step elapsed clock time.
public TimeStep(double elapsedTime, double elapsedRealTime)
Parameters
elapsedTimedoubleThe amount of elapsed time since the last update, in seconds.
elapsedRealTimedoubleThe amount of elapsed time since the last update, in seconds, following the host computer clock.
Fields
ElapsedRealTime
The amount of elapsed time since the last update, in seconds, following the host computer clock.
public double ElapsedRealTime
Field Value
Remarks
This field can be used to measure the real-time jitter of the update and render loops, or in variable-step state updates.
ElapsedTime
The amount of elapsed time since the last update, in seconds.
public double ElapsedTime
Field Value
Remarks
This field is useful for fixed-step deterministic state updates, where each step follows the target update or render refresh rates.
Zero
Represents the zero TimeStep value. This field is read-only.
public static readonly TimeStep Zero
Field Value
Methods
Add(TimeStep, TimeStep)
Adds two TimeStep values together.
public static TimeStep Add(TimeStep left, TimeStep right)
Parameters
Returns
Add(ref TimeStep, ref TimeStep, out TimeStep)
Adds two TimeStep values together and stores the result in a return value.
public static void Add(ref TimeStep left, ref TimeStep right, out TimeStep result)
Parameters
leftTimeStepThe first TimeStep to add.
rightTimeStepThe second TimeStep to add.
resultTimeStepWhen this method returns, contains the TimeStep object representing the sum of the
leftandrightvalues.
Equals(TimeStep)
Returns a value indicating whether this instance is equal to the specified TimeStep structure.
public bool Equals(TimeStep other)
Parameters
Returns
Equals(object)
Returns a value indicating whether the specified object is a TimeStep structure with the same timing values as this TimeStep object.
public override bool Equals(object obj)
Parameters
objobjectThe object to compare with this instance.
Returns
- bool
true if
objis a TimeStep structure and has the same timing values as this object; otherwise, false.
GetHashCode()
Returns a hash code for this TimeStep value.
public override int GetHashCode()
Returns
Subtract(TimeStep, TimeStep)
Subtracts the second TimeStep value from the first.
public static TimeStep Subtract(TimeStep left, TimeStep right)
Parameters
Returns
Subtract(ref TimeStep, ref TimeStep, out TimeStep)
Subtracts the second TimeStep value from the first and stores the result in a return value.
public static void Subtract(ref TimeStep left, ref TimeStep right, out TimeStep result)
Parameters
leftTimeStepThe first TimeStep value.
rightTimeStepThe second TimeStep value.
resultTimeStepWhen this method returns, contains the TimeStep object representing the difference between the
leftandrightvalues.
ToString()
public override string ToString()
Returns
Operators
operator +(TimeStep, TimeStep)
Adds two TimeStep values together.
public static TimeStep operator +(TimeStep left, TimeStep right)
Parameters
leftTimeStepThe TimeStep value on the left-hand side of the addition operator.
rightTimeStepThe TimeStep value on the right-hand side of the addition operator.
Returns
operator ==(TimeStep, TimeStep)
Indicates whether two TimeStep values are equal.
public static bool operator ==(TimeStep left, TimeStep right)
Parameters
leftTimeStepThe TimeStep value on the left-hand side of the equality operator.
rightTimeStepThe TimeStep value on the right-hand side of the equality operator.
Returns
operator !=(TimeStep, TimeStep)
Indicates whether two TimeStep values are different.
public static bool operator !=(TimeStep left, TimeStep right)
Parameters
leftTimeStepThe TimeStep value on the left-hand side of the inequality operator.
rightTimeStepThe TimeStep value on the right-hand side of the inequality operator.
Returns
- bool
true if
leftandrightdiffer in any of their timing values; false ifleftandrightare equal.
operator -(TimeStep, TimeStep)
Subtracts the second TimeStep value from the first.
public static TimeStep operator -(TimeStep left, TimeStep right)
Parameters
leftTimeStepThe TimeStep value on the left-hand side of the subtraction operator.
rightTimeStepThe TimeStep value on the right-hand side of the subtraction operator.