McRogueFace/tests/snippets/050_input_mouse_click.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

41 lines
1.1 KiB
Python

# mcrf: objects=[Caption,Color,Frame,InputState,Scene] verified=0.2.8-dev status=ok
# Input Mouse Click - Click on frames
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)
))
# Clickable button
button = mcrfpy.Frame(
pos=(362, 284), size=(300, 200),
fill_color=mcrfpy.Color(100, 100, 200),
outline=3.0,
outline_color=mcrfpy.Color(150, 150, 255)
)
scene.children.append(button)
label = mcrfpy.Caption(
text="Click me!",
pos=(100, 80)
)
button.children.append(label)
click_count = 0
status = mcrfpy.Caption(text="Clicks: 0", pos=(450, 550))
scene.children.append(status)
def on_click(pos, button_type, action):
global click_count
if action == mcrfpy.InputState.PRESSED:
click_count += 1
status.text = f"Clicks: {click_count}"
button.fill_color = mcrfpy.Color(150, 150, 255)
elif action == mcrfpy.InputState.RELEASED:
button.fill_color = mcrfpy.Color(100, 100, 200)
button.on_click = on_click