timer

command
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 10, 2026 License: Apache-2.0 Imports: 12 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Command timer demonstrates the timer component as observable state. Three timers run side by side: a one-shot that fires once and stays readable, a repeating timer that restarts itself, and a timer created paused and started by a key press.

Timers advance on their own each fixed tick; a game never calls an update function on them. Completions are read straight from the component - timer.Timer.JustCompleted against the current tick is the completion edge, and timer.Timer.CompletedOn keeps the tick of the last fire for as long as it is useful. There are no events and no callbacks.

Each timer is its own entity, so any number of them can run for the same game: this program keeps three handles and reads them.

Run from the repository root:

go run ./examples/timer

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL