public readonly record struct GameTimeThe clock as a frame sees it: how long the last frame took, how much time has accumulated, and how many frames have gone by. Passed by value into every update, so nothing can advance time behind another subsystem's back.
No guide page documents this yet — the page shows what the code says about itself.
Remarks
Two clocks run at once. Elapsed and Total are scaled by TimeScale and are what gameplay should use — pausing is TimeScale = 0, and everything downstream stops without knowing why. UnscaledElapsed ignores the scale and is what UI animation, profiling and anything that must keep moving during a pause should use.
The fixed-step accumulator that decides how many simulation steps a frame owes lives in Vixen.Engine. This type only records what a step or a frame was handed.
Fields and properties (10)
public TimeSpan Totalpublic TimeSpan Elapsedpublic TimeSpan UnscaledElapsedpublic long FrameCountpublic float TimeScalepublic static GameTime ZeroTime before the first frame: nothing elapsed, running at normal speed.
public float DeltaSecondsElapsed in seconds — the delta almost every caller actually wants, at the precision the rest of the engine works in.
public float UnscaledDeltaSecondsUnscaledElapsed in seconds.
public double TotalSecondsTotal in seconds, at Double precision because it grows without bound and a Single stops resolving a 60 Hz frame after a few hours.
public bool IsPausedWhether time is stopped — a paused game, or a stepped one between steps.
Methods (5)
public GameTime(TimeSpan Total, TimeSpan Elapsed, TimeSpan UnscaledElapsed, long FrameCount, float TimeScale)The clock as a frame sees it: how long the last frame took, how much time has accumulated, and how many frames have gone by. Passed by value into every update, so nothing can advance time behind another subsystem's back.
public GameTime Advance(TimeSpan unscaledElapsed, float timeScale = 1)Produces the next frame's time: scales , adds it to the total, and counts the frame.
public override string ToString()Renders the frame number and both deltas, for logs and overlays.
public string ToString(string? format, IFormatProvider? formatProvider)Formats the value of the current instance using the specified format.
public bool TryFormat(Span<char> destination, out int charsWritten, ReadOnlySpan<char> format = default(ReadOnlySpan<char>), IFormatProvider? provider = null)Tries to format the value of the current instance into the provided span of characters.
Used by (63, showing 40)
- CharacterAnimationThirdPersonShooter
- LampFlickerThirdPersonShooter
- OrbitSystemEcsStressTest
- PbrShowcaseGamePbrShowcase
- SunOrbitThirdPersonShooter
- ThirdPersonShooterGameThirdPersonShooter
- TriangleGameHelloTriangle
- VideoGameVideoPlayback
- VirtualGeometryGameVirtualGeometry
- WeaponFireThirdPersonShooter
- AnimationSystemVixen.Animation
- AudioOverlayVixen.Audio
- AudioSystemVixen.Audio
- BehaviorVixen.Engine
- BehaviorStoreVixen.Engine
- CameraDirectorSystemVixen.Engine
- CharacterMovementSystemVixen.Physics
- ClockVixen.Engine.Tests
- ConsoleOverlayVixen.Engine
- ConsoleTestsVixen.Engine.Tests
- CoroutineAllocationTestsVixen.Engine.Tests
- CoroutineSchedulerVixen.Engine
- DebugDrawSystemVixen.Engine
- DiagnosticOverlayTestsVixen.Engine.Tests
- DiagnosticOverlaysVixen.Engine
- EngineLoopVixen.Engine
- EngineLoopTestsVixen.Engine.Tests
- FixedStepAccumulatorVixen.Engine
- FrameGraphOverlayVixen.Engine
- FrameStatsOverlayVixen.Engine
- GameVixen.App.Hosting
- GameTimeTestsVixen.Core.Tests
- IDiagnosticOverlayVixen.Engine
- InputActionsVixen.Input
- InputServiceVixen.Input
- LogOverlayVixen.Engine
- NavigationSystemVixen.Navigation
- NetworkRigidBodyCorrectionSystemVixen.Net.Physics
- PhysicsStepSystemVixen.Physics
- PhysicsSyncSystemVixen.Physics