namespace Godosa.Core.Runs; /// Game time per frame: deterministic → a fixed whatever the wall clock; otherwise the wall dt /// clamped to [0, maxDt]. (e.g. a map still loading) → no game time and no frame counted. public sealed class FrameClock(bool deterministic, double step = 1.0 / 60, double maxDt = 0.1) { public bool Deterministic { get; } = deterministic; public double Step { get; } = step; public long Frame { get; private set; } public double Seconds { get; private set; } public bool Held { get; set; } /// The game dt of this frame (0 when held); counts the frame unless held. public double Next(double wallDt) { if (Held) return 0; var dt = Deterministic ? Step : Math.Clamp(wallDt, 0, maxDt); Frame++; Seconds += dt; return dt; } }