McRogueFace/tests/snippets/046_timer_basic.py
John McCardle 3a85dd818d fix(snippets): drop the commit hash from verified -- it churned all 130 every commit
The `# mcrf:` stamp recorded verified=<version>@<commit>, so every commit rewrote
the hash in all 130 snippet headers -- a guaranteed 130-file diff carrying no signal
git history doesn't already have, and one `--check` ignores anyway. The version alone
is stable within a dev cycle ("0.2.8-dev") and becomes the release marker at a tag
("0.2.9"), which is the whole point of the field: freezing a version into the docs
site's history, not pinning a commit.

verified is now version-only. The stamper is idempotent again: a second run on a
clean tree changes zero files. This commit is the one-time normalization that strips
the @hash suffix from the existing headers.

Found while cleaning up after a make release-docs run left all 130 snippets dirty
with nothing but hash churn.
2026-07-14 19:14:49 -04:00

32 lines
725 B
Python

# mcrf: objects=[Caption,Color,Frame,Scene,Timer] verified=0.2.8-dev status=ok
# Timer Basic - Periodic callback
import mcrfpy
scene = mcrfpy.Scene("demo")
mcrfpy.current_scene = scene
scene.children.append(mcrfpy.Frame(
pos=(0, 0), size=(1024, 768),
fill_color=mcrfpy.Color(30, 30, 40)
))
counter = mcrfpy.Caption(
text="Ticks: 0",
pos=(420, 350))
counter.fill_color = mcrfpy.Color(255, 220, 100)
scene.children.append(counter)
count = 0
def on_tick(timer, runtime):
global count
count += 1
counter.text = f"Ticks: {count}"
# Timer fires every 500ms
timer = mcrfpy.Timer("ticker", on_tick, 500)
scene.children.append(mcrfpy.Caption(
text="Timer interval: 500ms",
pos=(410, 450)
))