Import std.time.timers
FixedStep
class
Public Class FixedStep
Steps at a fixed rate, however far apart the calls that ask for them are: Advance, or Tick, takes the time since the last call and gives how many steps to run, keeping what's left for the next, and Alpha says how far into the next step that is, for showing what's between two steps' states.
Examples
Local physics = FixedStep(10)
Expect(physics.Advance(250.Milliseconds) == 2)
Expect(physics.Alpha == 0.5)
Expect(physics.Step == 100.Milliseconds)-
Steps at a rate of that many a second, which panics for one that isn't above 0.
-
Steps of that length, which panics for one that isn't above 0.
-
How long a step is, to the nearest nanosecond.
-
How long a step is, in seconds.
-
The most steps one call gives, 8 unless it's set, so a long wait doesn't make the next one longer still: the whole steps past them are dropped, and the part of a step left over stays. One below 1 panics.
-
How far into the next step the time left over is, from 0 up to 1.
-
How many steps to run for that much time. A Duration below 0 counts as 0.
-
How many steps to run for the time since the last Tick, now or at the Instant; the first Tick starts the clock and gives 0.
-
How many steps to run for the time from the last Tick to
now; the first Tick starts the clock and gives 0. -
Forgets the time left over and the last Tick.
Report an issue with this page or with FutureBlitz on GitHub.