McRogueFace/tests/snippets/051_input_mouse_hover.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

45 lines
1.1 KiB
Python

# mcrf: objects=[Caption,Color,Frame,Scene] verified=0.2.8-dev status=ok
# Input Mouse Hover - Enter/exit/move events
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)
))
# Hoverable frame
frame = mcrfpy.Frame(
pos=(312, 234), size=(400, 300),
fill_color=mcrfpy.Color(80, 80, 120),
outline=3.0,
outline_color=mcrfpy.Color(120, 120, 180)
)
scene.children.append(frame)
status = mcrfpy.Caption(
text="Mouse outside",
pos=(140, 130)
)
frame.children.append(status)
coords = mcrfpy.Caption(text="", pos=(140, 180))
frame.children.append(coords)
def on_enter(pos):
frame.fill_color = mcrfpy.Color(100, 150, 100)
status.text = "Mouse ENTERED"
def on_exit(pos):
frame.fill_color = mcrfpy.Color(80, 80, 120)
status.text = "Mouse EXITED"
coords.text = ""
def on_move(pos):
coords.text = f"Position: ({pos.x:.0f}, {pos.y:.0f})"
frame.on_enter = on_enter
frame.on_exit = on_exit
frame.on_move = on_move