Sim time, pause and speed - the clock, on screen. More...
| Import Statement: | import Clayground.Lab |
| Inherits: |
No lab showed its clock, which is a strange gap in a framework whose whole claim is determinism: "the same seed and the same stepped frames" is the contract, and until now nothing told the learner what time it was.
Three parts in one chip: the sim-time readout, a pause toggle, and a speed cycle. It drives SimClock.timeScale from the outside rather than owning any clock state, so a lab that also binds a simSpeed parameter to the same clock keeps working - the chip simply reads back whatever the scale now is.
Pausing sets timeScale to 0, which is the kernel's pause verb, and resuming restores the speed that was running before - not 1x, because a pause taken during a 4x run is meant to be resumed at 4x.
TransportChip { anchors.horizontalCenter: parent.horizontalCenter anchors.top: parent.top; anchors.topMargin: LabTheme.spaceXl }
clock : var |
The SimClock; the active one by default.
digits : int |
Decimals on the time readout.
paused : bool |
The clock is standing still.
showSpeed : bool |
Offer the speed cycle.
speeds : var |
The speed rungs the button cycles.
void cycleSpeed() |
Next speed rung, resuming if paused.
void toggle() |
Pause or resume.