commands/effect_and_debug_hotkeys¶
Goal¶
Bind function keys and letter keys to toggle visual effects and debug overlays, and see a live status panel reflect each toggle.
Why this tutorial exists¶
Debug tools and visual effects are typically toggled via hotkeys during development and playtesting. This example demonstrates:
using
keys_pressedto detect single-frame key edgestoggling boolean flags for bounding boxes, grid overlay, FPS counter
cycling through background colours
rendering conditional overlays based on toggle state
Source map¶
Settings profile:
examples/settings/commands/effect_and_debug_hotkeys.ymlExample builder:
examples/catalog/commands/effect_and_debug_hotkeys/main.pyScene:
examples/catalog/commands/effect_and_debug_hotkeys/scenes/scene.pyShared runner:
examples/_shared/runner.py
What to verify¶
You should see:
three coloured rectangles on the canvas
a status panel showing each hotkey and its ON/OFF state
pressing
F1draws yellow bounding boxes around the rectanglespressing
F2shows a grid overlay across the entire viewportpressing
F3shows an FPS counter in the top-right cornerpressing
Bcycles the background colour through five presets
Controls¶
Key |
Action |
|---|---|
|
Toggle bounding boxes |
|
Toggle grid overlay |
|
Toggle FPS display |
|
Cycle background colour |
|
Quit |
Run¶
mini-arcade run --example commands/effect_and_debug_hotkeys
mini-arcade run --example commands/effect_and_debug_hotkeys --pass-through --backend pygame
mini-arcade run --example commands/effect_and_debug_hotkeys --pass-through --backend native
Common mistakes¶
Using
keys_heldfor toggles — the flag flips every frame the key is held. Usekeys_pressedfor edge detection.Hardcoding pixel positions without accounting for virtual resolution scaling.
Drawing debug overlays in the SIMULATION phase instead of RENDERING — they get overwritten.
Next step¶
This is the last tutorial in Group E. Continue to the rendering pipeline tutorials when they become available, or revisit: