GameClock class
Pure gameplay clock: no dependency on Flutter/Flame bindings, wall clock,
or any timer — every advance is driven by a caller-supplied delta, so the
exact same sequence of advance calls always produces the exact same
elapsed/step count (see PerformanceTierService's FrameBudgetTracker
for the same "pure core, thin binding-aware wrapper" split this mirrors).
paused freezes elapsed — a call to advance while paused is a no-op, so time spent backgrounded/paused is never counted, and resuming never needs to "catch up" or subtract anything.
Constructors
Properties
- elapsed → Duration
-
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- maxDeltaPerTick → Duration
-
Caps a single advance call's delta — without this, a real delta
spanning an app backgrounded for minutes/hours would jump elapsed by
that same huge amount in one step.
final
- paused ↔ bool
-
getter/setter pair
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- scale → double
-
no setter
Methods
-
advance(
Duration realDelta) → int -
Advances the clock by
realDelta(clamped to[0, maxDeltaPerTick], then multiplied by scale). A no-op while paused. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
setScale(
double value) → SdkResult< double> -
Rejects a non-finite or non-positive
valueand leaves scale unchanged — an invalid scale must never "poison" the clock (e.g. NaN propagating into every future elapsed). -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited