6d5e99a114
Remove legacy string enum comparisons from InputState/Key/MouseButton, closes #306
...
Removed custom __eq__/__ne__ that allowed comparing enums to legacy string
names (e.g., Key.ESCAPE == "Escape"). Removed _legacy_names dicts and
to_legacy_string() functions. Kept from_legacy_string() in PyKey.cpp as
it's used by C++ event dispatch. Updated ~50 Python test/demo/cookbook
files to use enum members instead of string comparisons. Also updates
grid.position -> grid.pos in files that had both types of changes.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-09 22:19:02 -04:00
55f6ea9502
Add cookbook examples with updated callback signatures for #229 , #230
...
Cookbook structure:
- lib/: Reusable component library (Button, StatBar, AnimationChain, etc.)
- primitives/: Demo apps for individual components
- features/: Demo apps for complex features (animation chaining, shaders)
- apps/: Complete mini-applications (calculator, dialogue system)
- automation/: Screenshot capture utilities
API signature updates applied:
- on_enter/on_exit/on_move callbacks now only receive (pos) per #230
- on_cell_enter/on_cell_exit callbacks only receive (cell_pos) per #230
- Animation chain library uses Timer-based sequencing (unaffected by #229 )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-28 18:58:25 -05:00
2daebc84b5
Simplify on_enter/on_exit callbacks to position-only signature
...
BREAKING CHANGE: Hover callbacks now take only (pos) instead of (pos, button, action)
- Add PyHoverCallable class for on_enter/on_exit/on_move callbacks (position-only)
- Add PyCellHoverCallable class for on_cell_enter/on_cell_exit callbacks
- Change UIDrawable member types from PyClickCallable to PyHoverCallable
- Update PyScene::do_mouse_hover() to call hover callbacks with only position
- Add tryCallPythonMethod overload for position-only subclass method calls
- Update UIGrid::fireCellEnter/fireCellExit to use position-only signature
- Update all tests for new callback signatures
New callback signatures:
| Callback | Old | New |
|----------------|--------------------------|------------|
| on_enter | (pos, button, action) | (pos) |
| on_exit | (pos, button, action) | (pos) |
| on_move | (pos, button, action) | (pos) |
| on_cell_enter | (cell_pos, button, action)| (cell_pos)|
| on_cell_exit | (cell_pos, button, action)| (cell_pos)|
| on_click | unchanged | unchanged |
| on_cell_click | unchanged | unchanged |
closes #230
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-28 17:36:02 -05:00