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
elapsedTime
doubleThe amount of elapsed time since the last update, in seconds.
elapsedRealTime
doubleThe 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
left
TimeStepThe first TimeStep to add.
right
TimeStepThe second TimeStep to add.
result
TimeStepWhen this method returns, contains the TimeStep object representing the sum of the
left
andright
values.
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
obj
objectThe object to compare with this instance.
Returns
- bool
true if
obj
is 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
left
TimeStepThe first TimeStep value.
right
TimeStepThe second TimeStep value.
result
TimeStepWhen this method returns, contains the TimeStep object representing the difference between the
left
andright
values.
ToString()
public override string ToString()
Returns
Operators
operator +(TimeStep, TimeStep)
Adds two TimeStep values together.
public static TimeStep operator +(TimeStep left, TimeStep right)
Parameters
left
TimeStepThe TimeStep value on the left-hand side of the addition operator.
right
TimeStepThe 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
left
TimeStepThe TimeStep value on the left-hand side of the equality operator.
right
TimeStepThe 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
left
TimeStepThe TimeStep value on the left-hand side of the inequality operator.
right
TimeStepThe TimeStep value on the right-hand side of the inequality operator.
Returns
- bool
true if
left
andright
differ in any of their timing values; false ifleft
andright
are equal.
operator -(TimeStep, TimeStep)
Subtracts the second TimeStep value from the first.
public static TimeStep operator -(TimeStep left, TimeStep right)
Parameters
left
TimeStepThe TimeStep value on the left-hand side of the subtraction operator.
right
TimeStepThe TimeStep value on the right-hand side of the subtraction operator.