2025-10-30 21:20:50 -04:00
|
|
|
.\" Automatically generated by Pandoc 2.17.1.1
|
|
|
|
|
.\"
|
|
|
|
|
.\" Define V font for inline verbatim, using C font in formats
|
|
|
|
|
.\" that render this, and otherwise B font.
|
|
|
|
|
.ie "\f[CB]x\f[]"x" \{\
|
|
|
|
|
. ftr V B
|
|
|
|
|
. ftr VI BI
|
|
|
|
|
. ftr VB B
|
|
|
|
|
. ftr VBI BI
|
|
|
|
|
.\}
|
|
|
|
|
.el \{\
|
|
|
|
|
. ftr V CR
|
|
|
|
|
. ftr VI CI
|
|
|
|
|
. ftr VB CB
|
|
|
|
|
. ftr VBI CBI
|
|
|
|
|
.\}
|
Windowed perspective writeback in UIEntity::updateVisibility; closes #316
Clip the demote+promote passes in updateVisibility() to an AABB sized to
fov_radius instead of two full-W*H walks per entity. A prev_fov window cache
demotes last tick's promoted rect (not the current one) so a moving entity
leaves no trailing "ghost vision". On a 1000x1000 grid the Phase 5.2 benchmark's
flat ~25-36 ms/entity writeback overhead collapses to single-digit microseconds
(384x-6577x speedup on the cheap algorithms; below timing noise on the rest).
Adversarial verify caught a regression the happy-path test missed: the
documented from_bytes -> assign -> update_visibility() load/resume path left
permanent ghost-VISIBLE cells, because prev_fov only bounds engine-promoted
cells. Fixed with a one-shot perspective_full_demote_pending flag (full demote
only on the tick after an external assignment; per-turn hot path stays
windowed). Documented the engine-owned demote contract on the perspective_map
property.
- src/UIEntity.cpp/.h: windowed demote/promote, prev_fov cache, demote flag
- src/DiscreteMap.cpp/.h: demoteVisibleRect(x0, y0, x1, y1)
- tests/regression/issue_316_sparse_perspective_test.py: 7-section regression
(equivalence matrix, radius-0, moving disjoint, trailing-edge, grid resize,
load/resume assignment, AABB margin lock)
- docs regenerated for the perspective_map docstring change
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KnywUddaFRhkxo5kijxJnv
2026-06-21 09:40:05 -04:00
|
|
|
.TH "MCRFPY" "3" "2026-06-21" "McRogueFace 0.2.7-prerelease-7drl2026-107-g3f39ee0" ""
|
2025-10-30 21:20:50 -04:00
|
|
|
.hy
|
|
|
|
|
.SH McRogueFace API Reference
|
|
|
|
|
.PP
|
Windowed perspective writeback in UIEntity::updateVisibility; closes #316
Clip the demote+promote passes in updateVisibility() to an AABB sized to
fov_radius instead of two full-W*H walks per entity. A prev_fov window cache
demotes last tick's promoted rect (not the current one) so a moving entity
leaves no trailing "ghost vision". On a 1000x1000 grid the Phase 5.2 benchmark's
flat ~25-36 ms/entity writeback overhead collapses to single-digit microseconds
(384x-6577x speedup on the cheap algorithms; below timing noise on the rest).
Adversarial verify caught a regression the happy-path test missed: the
documented from_bytes -> assign -> update_visibility() load/resume path left
permanent ghost-VISIBLE cells, because prev_fov only bounds engine-promoted
cells. Fixed with a one-shot perspective_full_demote_pending flag (full demote
only on the tick after an external assignment; per-turn hot path stays
windowed). Documented the engine-owned demote contract on the perspective_map
property.
- src/UIEntity.cpp/.h: windowed demote/promote, prev_fov cache, demote flag
- src/DiscreteMap.cpp/.h: demoteVisibleRect(x0, y0, x1, y1)
- tests/regression/issue_316_sparse_perspective_test.py: 7-section regression
(equivalence matrix, radius-0, moving disjoint, trailing-edge, grid resize,
load/resume assignment, AABB margin lock)
- docs regenerated for the perspective_map docstring change
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KnywUddaFRhkxo5kijxJnv
2026-06-21 09:40:05 -04:00
|
|
|
\f[I]Generated on 2026-06-21 09:39:04\f[R]
|
2025-10-30 21:20:50 -04:00
|
|
|
.PP
|
|
|
|
|
\f[I]This documentation was dynamically generated from the compiled
|
|
|
|
|
module.\f[R]
|
|
|
|
|
.SS Table of Contents
|
|
|
|
|
.IP \[bu] 2
|
|
|
|
|
Functions
|
|
|
|
|
.IP \[bu] 2
|
|
|
|
|
Classes
|
|
|
|
|
.RS 2
|
|
|
|
|
.IP \[bu] 2
|
2026-01-23 20:49:11 -05:00
|
|
|
AStarPath
|
|
|
|
|
.IP \[bu] 2
|
|
|
|
|
Alignment
|
|
|
|
|
.IP \[bu] 2
|
2025-12-02 09:21:43 -05:00
|
|
|
Arc
|
|
|
|
|
.IP \[bu] 2
|
Replace UIEntity gridstate with DiscreteMap perspective_map; closes #294
Per-entity FOV memory moves from std::vector<UIGridPointState> (two-bool
visible/discovered pairs) to a 3-state DiscreteMap (0=UNKNOWN, 1=DISCOVERED,
2=VISIBLE), exposed as entity.perspective_map. The invariant
visible-subset-of-discovered becomes structural (single value per cell), and
the map is a live, serializable, first-class object rather than an implicit
internal array.
Changes:
- New DiscreteMap C++ class with shared ownership; PyDiscreteMapObject now
holds shared_ptr<DiscreteMap>. UIEntity holds the same shared_ptr.
- New mcrfpy.Perspective IntEnum (UNKNOWN/DISCOVERED/VISIBLE), modelled on
PyInputState.
- entity.perspective_map: lazy-allocated on first access with a grid;
setter validates size against grid and raises ValueError on mismatch;
None clears (next access lazy-reallocates fresh).
- updateVisibility() now demotes 2->1 then promotes visible cells to 2.
- entity.at(x, y) returns grid.at(x, y) when VISIBLE, else None.
- Fog-of-war rendering in UIGridView and UIGrid reads the 3-state map.
- Removed: UIEntity::gridstate, ensureGridstate(), entity.gridstate getter,
UIGridPointState struct + PyUIGridPointStateType.
- Obsolete tests deleted (test_gridpointstate_point,
issue_265_gridpointstate_dangle); 4 new tests cover lazy allocation,
identity, serialization round-trip, size validation, and the
visible-subset-of-discovered invariant.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-17 23:04:27 -04:00
|
|
|
AutoRuleSet
|
|
|
|
|
.IP \[bu] 2
|
2026-01-23 20:49:11 -05:00
|
|
|
BSP
|
|
|
|
|
.IP \[bu] 2
|
Replace UIEntity gridstate with DiscreteMap perspective_map; closes #294
Per-entity FOV memory moves from std::vector<UIGridPointState> (two-bool
visible/discovered pairs) to a 3-state DiscreteMap (0=UNKNOWN, 1=DISCOVERED,
2=VISIBLE), exposed as entity.perspective_map. The invariant
visible-subset-of-discovered becomes structural (single value per cell), and
the map is a live, serializable, first-class object rather than an implicit
internal array.
Changes:
- New DiscreteMap C++ class with shared ownership; PyDiscreteMapObject now
holds shared_ptr<DiscreteMap>. UIEntity holds the same shared_ptr.
- New mcrfpy.Perspective IntEnum (UNKNOWN/DISCOVERED/VISIBLE), modelled on
PyInputState.
- entity.perspective_map: lazy-allocated on first access with a grid;
setter validates size against grid and raises ValueError on mismatch;
None clears (next access lazy-reallocates fresh).
- updateVisibility() now demotes 2->1 then promotes visible cells to 2.
- entity.at(x, y) returns grid.at(x, y) when VISIBLE, else None.
- Fog-of-war rendering in UIGridView and UIGrid reads the 3-state map.
- Removed: UIEntity::gridstate, ensureGridstate(), entity.gridstate getter,
UIGridPointState struct + PyUIGridPointStateType.
- Obsolete tests deleted (test_gridpointstate_point,
issue_265_gridpointstate_dangle); 4 new tests cover lazy allocation,
identity, serialization round-trip, size validation, and the
visible-subset-of-discovered invariant.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-17 23:04:27 -04:00
|
|
|
Behavior
|
|
|
|
|
.IP \[bu] 2
|
|
|
|
|
Billboard
|
|
|
|
|
.IP \[bu] 2
|
Update documentation for API changes #229, #230, #184
CLAUDE.md updates:
- Fix Python version 3.12 -> 3.14
- Update keypressScene -> scene.on_key pattern
- Add API examples for new callback signatures
- Document animation callbacks (target, prop, value)
- Document hover callbacks (position-only)
- Document enum types (Key, MouseButton, InputState)
stubs/mcrfpy.pyi updates:
- Add Key, MouseButton, InputState, Easing enum classes
- Fix Drawable hover callback signatures per #230
- Fix Grid cell callback signatures per #230
- Fix Scene.on_key signature to use enums per #184
- Update Animation class with correct callback signature per #229
- Add deprecation notes to keypressScene, setTimer, delTimer
Regenerated docs:
- API_REFERENCE_DYNAMIC.md
- api_reference_dynamic.html
- mcrfpy.3 man page
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-28 19:20:04 -05:00
|
|
|
CallableBinding
|
|
|
|
|
.IP \[bu] 2
|
2025-10-30 21:20:50 -04:00
|
|
|
Caption
|
|
|
|
|
.IP \[bu] 2
|
2025-12-02 09:21:43 -05:00
|
|
|
Circle
|
|
|
|
|
.IP \[bu] 2
|
2025-10-30 21:20:50 -04:00
|
|
|
Color
|
|
|
|
|
.IP \[bu] 2
|
2025-12-02 09:21:43 -05:00
|
|
|
ColorLayer
|
|
|
|
|
.IP \[bu] 2
|
2026-01-23 20:49:11 -05:00
|
|
|
DijkstraMap
|
|
|
|
|
.IP \[bu] 2
|
Replace UIEntity gridstate with DiscreteMap perspective_map; closes #294
Per-entity FOV memory moves from std::vector<UIGridPointState> (two-bool
visible/discovered pairs) to a 3-state DiscreteMap (0=UNKNOWN, 1=DISCOVERED,
2=VISIBLE), exposed as entity.perspective_map. The invariant
visible-subset-of-discovered becomes structural (single value per cell), and
the map is a live, serializable, first-class object rather than an implicit
internal array.
Changes:
- New DiscreteMap C++ class with shared ownership; PyDiscreteMapObject now
holds shared_ptr<DiscreteMap>. UIEntity holds the same shared_ptr.
- New mcrfpy.Perspective IntEnum (UNKNOWN/DISCOVERED/VISIBLE), modelled on
PyInputState.
- entity.perspective_map: lazy-allocated on first access with a grid;
setter validates size against grid and raises ValueError on mismatch;
None clears (next access lazy-reallocates fresh).
- updateVisibility() now demotes 2->1 then promotes visible cells to 2.
- entity.at(x, y) returns grid.at(x, y) when VISIBLE, else None.
- Fog-of-war rendering in UIGridView and UIGrid reads the 3-state map.
- Removed: UIEntity::gridstate, ensureGridstate(), entity.gridstate getter,
UIGridPointState struct + PyUIGridPointStateType.
- Obsolete tests deleted (test_gridpointstate_point,
issue_265_gridpointstate_dangle); 4 new tests cover lazy allocation,
identity, serialization round-trip, size validation, and the
visible-subset-of-discovered invariant.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-17 23:04:27 -04:00
|
|
|
DiscreteMap
|
|
|
|
|
.IP \[bu] 2
|
2025-10-30 21:20:50 -04:00
|
|
|
Drawable
|
|
|
|
|
.IP \[bu] 2
|
2026-01-23 20:49:11 -05:00
|
|
|
Easing
|
2025-10-30 21:20:50 -04:00
|
|
|
.IP \[bu] 2
|
2026-01-23 20:49:11 -05:00
|
|
|
Entity
|
2025-10-30 21:20:50 -04:00
|
|
|
.IP \[bu] 2
|
Replace UIEntity gridstate with DiscreteMap perspective_map; closes #294
Per-entity FOV memory moves from std::vector<UIGridPointState> (two-bool
visible/discovered pairs) to a 3-state DiscreteMap (0=UNKNOWN, 1=DISCOVERED,
2=VISIBLE), exposed as entity.perspective_map. The invariant
visible-subset-of-discovered becomes structural (single value per cell), and
the map is a live, serializable, first-class object rather than an implicit
internal array.
Changes:
- New DiscreteMap C++ class with shared ownership; PyDiscreteMapObject now
holds shared_ptr<DiscreteMap>. UIEntity holds the same shared_ptr.
- New mcrfpy.Perspective IntEnum (UNKNOWN/DISCOVERED/VISIBLE), modelled on
PyInputState.
- entity.perspective_map: lazy-allocated on first access with a grid;
setter validates size against grid and raises ValueError on mismatch;
None clears (next access lazy-reallocates fresh).
- updateVisibility() now demotes 2->1 then promotes visible cells to 2.
- entity.at(x, y) returns grid.at(x, y) when VISIBLE, else None.
- Fog-of-war rendering in UIGridView and UIGrid reads the 3-state map.
- Removed: UIEntity::gridstate, ensureGridstate(), entity.gridstate getter,
UIGridPointState struct + PyUIGridPointStateType.
- Obsolete tests deleted (test_gridpointstate_point,
issue_265_gridpointstate_dangle); 4 new tests cover lazy allocation,
identity, serialization round-trip, size validation, and the
visible-subset-of-discovered invariant.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-17 23:04:27 -04:00
|
|
|
Entity3D
|
|
|
|
|
.IP \[bu] 2
|
|
|
|
|
EntityCollection3D
|
|
|
|
|
.IP \[bu] 2
|
|
|
|
|
EntityCollection3DIter
|
|
|
|
|
.IP \[bu] 2
|
refactor: Rename click kwarg to on_click for API consistency (closes #126)
BREAKING CHANGE: Constructor keyword argument renamed from `click` to
`on_click` for all UIDrawable types (Frame, Caption, Sprite, Grid, Line,
Circle, Arc).
Before: Frame(pos=(0,0), size=(100,100), click=handler)
After: Frame(pos=(0,0), size=(100,100), on_click=handler)
The property name was already `on_click` - this makes the constructor
kwarg match, completing the callback naming standardization from #139.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-28 14:31:22 -05:00
|
|
|
FOV
|
|
|
|
|
.IP \[bu] 2
|
2025-10-30 21:20:50 -04:00
|
|
|
Font
|
|
|
|
|
.IP \[bu] 2
|
|
|
|
|
Frame
|
|
|
|
|
.IP \[bu] 2
|
|
|
|
|
Grid
|
|
|
|
|
.IP \[bu] 2
|
Replace UIEntity gridstate with DiscreteMap perspective_map; closes #294
Per-entity FOV memory moves from std::vector<UIGridPointState> (two-bool
visible/discovered pairs) to a 3-state DiscreteMap (0=UNKNOWN, 1=DISCOVERED,
2=VISIBLE), exposed as entity.perspective_map. The invariant
visible-subset-of-discovered becomes structural (single value per cell), and
the map is a live, serializable, first-class object rather than an implicit
internal array.
Changes:
- New DiscreteMap C++ class with shared ownership; PyDiscreteMapObject now
holds shared_ptr<DiscreteMap>. UIEntity holds the same shared_ptr.
- New mcrfpy.Perspective IntEnum (UNKNOWN/DISCOVERED/VISIBLE), modelled on
PyInputState.
- entity.perspective_map: lazy-allocated on first access with a grid;
setter validates size against grid and raises ValueError on mismatch;
None clears (next access lazy-reallocates fresh).
- updateVisibility() now demotes 2->1 then promotes visible cells to 2.
- entity.at(x, y) returns grid.at(x, y) when VISIBLE, else None.
- Fog-of-war rendering in UIGridView and UIGrid reads the 3-state map.
- Removed: UIEntity::gridstate, ensureGridstate(), entity.gridstate getter,
UIGridPointState struct + PyUIGridPointStateType.
- Obsolete tests deleted (test_gridpointstate_point,
issue_265_gridpointstate_dangle); 4 new tests cover lazy allocation,
identity, serialization round-trip, size validation, and the
visible-subset-of-discovered invariant.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-17 23:04:27 -04:00
|
|
|
GridView
|
|
|
|
|
.IP \[bu] 2
|
2026-01-23 20:49:11 -05:00
|
|
|
HeightMap
|
|
|
|
|
.IP \[bu] 2
|
2026-04-18 13:35:26 -04:00
|
|
|
Heuristic
|
|
|
|
|
.IP \[bu] 2
|
2026-01-23 20:49:11 -05:00
|
|
|
InputState
|
|
|
|
|
.IP \[bu] 2
|
|
|
|
|
Key
|
2025-10-30 21:20:50 -04:00
|
|
|
.IP \[bu] 2
|
2026-01-23 20:49:11 -05:00
|
|
|
Keyboard
|
2025-10-30 21:20:50 -04:00
|
|
|
.IP \[bu] 2
|
Replace UIEntity gridstate with DiscreteMap perspective_map; closes #294
Per-entity FOV memory moves from std::vector<UIGridPointState> (two-bool
visible/discovered pairs) to a 3-state DiscreteMap (0=UNKNOWN, 1=DISCOVERED,
2=VISIBLE), exposed as entity.perspective_map. The invariant
visible-subset-of-discovered becomes structural (single value per cell), and
the map is a live, serializable, first-class object rather than an implicit
internal array.
Changes:
- New DiscreteMap C++ class with shared ownership; PyDiscreteMapObject now
holds shared_ptr<DiscreteMap>. UIEntity holds the same shared_ptr.
- New mcrfpy.Perspective IntEnum (UNKNOWN/DISCOVERED/VISIBLE), modelled on
PyInputState.
- entity.perspective_map: lazy-allocated on first access with a grid;
setter validates size against grid and raises ValueError on mismatch;
None clears (next access lazy-reallocates fresh).
- updateVisibility() now demotes 2->1 then promotes visible cells to 2.
- entity.at(x, y) returns grid.at(x, y) when VISIBLE, else None.
- Fog-of-war rendering in UIGridView and UIGrid reads the 3-state map.
- Removed: UIEntity::gridstate, ensureGridstate(), entity.gridstate getter,
UIGridPointState struct + PyUIGridPointStateType.
- Obsolete tests deleted (test_gridpointstate_point,
issue_265_gridpointstate_dangle); 4 new tests cover lazy allocation,
identity, serialization round-trip, size validation, and the
visible-subset-of-discovered invariant.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-17 23:04:27 -04:00
|
|
|
LdtkProject
|
|
|
|
|
.IP \[bu] 2
|
2025-12-02 09:21:43 -05:00
|
|
|
Line
|
|
|
|
|
.IP \[bu] 2
|
Replace UIEntity gridstate with DiscreteMap perspective_map; closes #294
Per-entity FOV memory moves from std::vector<UIGridPointState> (two-bool
visible/discovered pairs) to a 3-state DiscreteMap (0=UNKNOWN, 1=DISCOVERED,
2=VISIBLE), exposed as entity.perspective_map. The invariant
visible-subset-of-discovered becomes structural (single value per cell), and
the map is a live, serializable, first-class object rather than an implicit
internal array.
Changes:
- New DiscreteMap C++ class with shared ownership; PyDiscreteMapObject now
holds shared_ptr<DiscreteMap>. UIEntity holds the same shared_ptr.
- New mcrfpy.Perspective IntEnum (UNKNOWN/DISCOVERED/VISIBLE), modelled on
PyInputState.
- entity.perspective_map: lazy-allocated on first access with a grid;
setter validates size against grid and raises ValueError on mismatch;
None clears (next access lazy-reallocates fresh).
- updateVisibility() now demotes 2->1 then promotes visible cells to 2.
- entity.at(x, y) returns grid.at(x, y) when VISIBLE, else None.
- Fog-of-war rendering in UIGridView and UIGrid reads the 3-state map.
- Removed: UIEntity::gridstate, ensureGridstate(), entity.gridstate getter,
UIGridPointState struct + PyUIGridPointStateType.
- Obsolete tests deleted (test_gridpointstate_point,
issue_265_gridpointstate_dangle); 4 new tests cover lazy allocation,
identity, serialization round-trip, size validation, and the
visible-subset-of-discovered invariant.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-17 23:04:27 -04:00
|
|
|
Model3D
|
|
|
|
|
.IP \[bu] 2
|
2026-01-23 20:49:11 -05:00
|
|
|
Mouse
|
|
|
|
|
.IP \[bu] 2
|
|
|
|
|
MouseButton
|
|
|
|
|
.IP \[bu] 2
|
|
|
|
|
Music
|
|
|
|
|
.IP \[bu] 2
|
|
|
|
|
NoiseSource
|
|
|
|
|
.IP \[bu] 2
|
Replace UIEntity gridstate with DiscreteMap perspective_map; closes #294
Per-entity FOV memory moves from std::vector<UIGridPointState> (two-bool
visible/discovered pairs) to a 3-state DiscreteMap (0=UNKNOWN, 1=DISCOVERED,
2=VISIBLE), exposed as entity.perspective_map. The invariant
visible-subset-of-discovered becomes structural (single value per cell), and
the map is a live, serializable, first-class object rather than an implicit
internal array.
Changes:
- New DiscreteMap C++ class with shared ownership; PyDiscreteMapObject now
holds shared_ptr<DiscreteMap>. UIEntity holds the same shared_ptr.
- New mcrfpy.Perspective IntEnum (UNKNOWN/DISCOVERED/VISIBLE), modelled on
PyInputState.
- entity.perspective_map: lazy-allocated on first access with a grid;
setter validates size against grid and raises ValueError on mismatch;
None clears (next access lazy-reallocates fresh).
- updateVisibility() now demotes 2->1 then promotes visible cells to 2.
- entity.at(x, y) returns grid.at(x, y) when VISIBLE, else None.
- Fog-of-war rendering in UIGridView and UIGrid reads the 3-state map.
- Removed: UIEntity::gridstate, ensureGridstate(), entity.gridstate getter,
UIGridPointState struct + PyUIGridPointStateType.
- Obsolete tests deleted (test_gridpointstate_point,
issue_265_gridpointstate_dangle); 4 new tests cover lazy allocation,
identity, serialization round-trip, size validation, and the
visible-subset-of-discovered invariant.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-17 23:04:27 -04:00
|
|
|
Perspective
|
|
|
|
|
.IP \[bu] 2
|
Update documentation for API changes #229, #230, #184
CLAUDE.md updates:
- Fix Python version 3.12 -> 3.14
- Update keypressScene -> scene.on_key pattern
- Add API examples for new callback signatures
- Document animation callbacks (target, prop, value)
- Document hover callbacks (position-only)
- Document enum types (Key, MouseButton, InputState)
stubs/mcrfpy.pyi updates:
- Add Key, MouseButton, InputState, Easing enum classes
- Fix Drawable hover callback signatures per #230
- Fix Grid cell callback signatures per #230
- Fix Scene.on_key signature to use enums per #184
- Update Animation class with correct callback signature per #229
- Add deprecation notes to keypressScene, setTimer, delTimer
Regenerated docs:
- API_REFERENCE_DYNAMIC.md
- api_reference_dynamic.html
- mcrfpy.3 man page
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-28 19:20:04 -05:00
|
|
|
PropertyBinding
|
|
|
|
|
.IP \[bu] 2
|
2025-10-30 21:20:50 -04:00
|
|
|
Scene
|
|
|
|
|
.IP \[bu] 2
|
Update documentation for API changes #229, #230, #184
CLAUDE.md updates:
- Fix Python version 3.12 -> 3.14
- Update keypressScene -> scene.on_key pattern
- Add API examples for new callback signatures
- Document animation callbacks (target, prop, value)
- Document hover callbacks (position-only)
- Document enum types (Key, MouseButton, InputState)
stubs/mcrfpy.pyi updates:
- Add Key, MouseButton, InputState, Easing enum classes
- Fix Drawable hover callback signatures per #230
- Fix Grid cell callback signatures per #230
- Fix Scene.on_key signature to use enums per #184
- Update Animation class with correct callback signature per #229
- Add deprecation notes to keypressScene, setTimer, delTimer
Regenerated docs:
- API_REFERENCE_DYNAMIC.md
- api_reference_dynamic.html
- mcrfpy.3 man page
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-28 19:20:04 -05:00
|
|
|
Shader
|
|
|
|
|
.IP \[bu] 2
|
2026-01-23 20:49:11 -05:00
|
|
|
Sound
|
|
|
|
|
.IP \[bu] 2
|
Replace UIEntity gridstate with DiscreteMap perspective_map; closes #294
Per-entity FOV memory moves from std::vector<UIGridPointState> (two-bool
visible/discovered pairs) to a 3-state DiscreteMap (0=UNKNOWN, 1=DISCOVERED,
2=VISIBLE), exposed as entity.perspective_map. The invariant
visible-subset-of-discovered becomes structural (single value per cell), and
the map is a live, serializable, first-class object rather than an implicit
internal array.
Changes:
- New DiscreteMap C++ class with shared ownership; PyDiscreteMapObject now
holds shared_ptr<DiscreteMap>. UIEntity holds the same shared_ptr.
- New mcrfpy.Perspective IntEnum (UNKNOWN/DISCOVERED/VISIBLE), modelled on
PyInputState.
- entity.perspective_map: lazy-allocated on first access with a grid;
setter validates size against grid and raises ValueError on mismatch;
None clears (next access lazy-reallocates fresh).
- updateVisibility() now demotes 2->1 then promotes visible cells to 2.
- entity.at(x, y) returns grid.at(x, y) when VISIBLE, else None.
- Fog-of-war rendering in UIGridView and UIGrid reads the 3-state map.
- Removed: UIEntity::gridstate, ensureGridstate(), entity.gridstate getter,
UIGridPointState struct + PyUIGridPointStateType.
- Obsolete tests deleted (test_gridpointstate_point,
issue_265_gridpointstate_dangle); 4 new tests cover lazy allocation,
identity, serialization round-trip, size validation, and the
visible-subset-of-discovered invariant.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-17 23:04:27 -04:00
|
|
|
SoundBuffer
|
|
|
|
|
.IP \[bu] 2
|
2025-10-30 21:20:50 -04:00
|
|
|
Sprite
|
|
|
|
|
.IP \[bu] 2
|
|
|
|
|
Texture
|
|
|
|
|
.IP \[bu] 2
|
2025-12-02 09:21:43 -05:00
|
|
|
TileLayer
|
|
|
|
|
.IP \[bu] 2
|
Replace UIEntity gridstate with DiscreteMap perspective_map; closes #294
Per-entity FOV memory moves from std::vector<UIGridPointState> (two-bool
visible/discovered pairs) to a 3-state DiscreteMap (0=UNKNOWN, 1=DISCOVERED,
2=VISIBLE), exposed as entity.perspective_map. The invariant
visible-subset-of-discovered becomes structural (single value per cell), and
the map is a live, serializable, first-class object rather than an implicit
internal array.
Changes:
- New DiscreteMap C++ class with shared ownership; PyDiscreteMapObject now
holds shared_ptr<DiscreteMap>. UIEntity holds the same shared_ptr.
- New mcrfpy.Perspective IntEnum (UNKNOWN/DISCOVERED/VISIBLE), modelled on
PyInputState.
- entity.perspective_map: lazy-allocated on first access with a grid;
setter validates size against grid and raises ValueError on mismatch;
None clears (next access lazy-reallocates fresh).
- updateVisibility() now demotes 2->1 then promotes visible cells to 2.
- entity.at(x, y) returns grid.at(x, y) when VISIBLE, else None.
- Fog-of-war rendering in UIGridView and UIGrid reads the 3-state map.
- Removed: UIEntity::gridstate, ensureGridstate(), entity.gridstate getter,
UIGridPointState struct + PyUIGridPointStateType.
- Obsolete tests deleted (test_gridpointstate_point,
issue_265_gridpointstate_dangle); 4 new tests cover lazy allocation,
identity, serialization round-trip, size validation, and the
visible-subset-of-discovered invariant.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-17 23:04:27 -04:00
|
|
|
TileMapFile
|
|
|
|
|
.IP \[bu] 2
|
|
|
|
|
TileSetFile
|
|
|
|
|
.IP \[bu] 2
|
2025-10-30 21:20:50 -04:00
|
|
|
Timer
|
|
|
|
|
.IP \[bu] 2
|
2026-01-23 20:49:11 -05:00
|
|
|
Transition
|
2025-10-30 21:20:50 -04:00
|
|
|
.IP \[bu] 2
|
2026-01-23 20:49:11 -05:00
|
|
|
Traversal
|
2025-10-30 21:20:50 -04:00
|
|
|
.IP \[bu] 2
|
Replace UIEntity gridstate with DiscreteMap perspective_map; closes #294
Per-entity FOV memory moves from std::vector<UIGridPointState> (two-bool
visible/discovered pairs) to a 3-state DiscreteMap (0=UNKNOWN, 1=DISCOVERED,
2=VISIBLE), exposed as entity.perspective_map. The invariant
visible-subset-of-discovered becomes structural (single value per cell), and
the map is a live, serializable, first-class object rather than an implicit
internal array.
Changes:
- New DiscreteMap C++ class with shared ownership; PyDiscreteMapObject now
holds shared_ptr<DiscreteMap>. UIEntity holds the same shared_ptr.
- New mcrfpy.Perspective IntEnum (UNKNOWN/DISCOVERED/VISIBLE), modelled on
PyInputState.
- entity.perspective_map: lazy-allocated on first access with a grid;
setter validates size against grid and raises ValueError on mismatch;
None clears (next access lazy-reallocates fresh).
- updateVisibility() now demotes 2->1 then promotes visible cells to 2.
- entity.at(x, y) returns grid.at(x, y) when VISIBLE, else None.
- Fog-of-war rendering in UIGridView and UIGrid reads the 3-state map.
- Removed: UIEntity::gridstate, ensureGridstate(), entity.gridstate getter,
UIGridPointState struct + PyUIGridPointStateType.
- Obsolete tests deleted (test_gridpointstate_point,
issue_265_gridpointstate_dangle); 4 new tests cover lazy allocation,
identity, serialization round-trip, size validation, and the
visible-subset-of-discovered invariant.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-17 23:04:27 -04:00
|
|
|
Trigger
|
|
|
|
|
.IP \[bu] 2
|
2025-10-30 21:20:50 -04:00
|
|
|
Vector
|
|
|
|
|
.IP \[bu] 2
|
Replace UIEntity gridstate with DiscreteMap perspective_map; closes #294
Per-entity FOV memory moves from std::vector<UIGridPointState> (two-bool
visible/discovered pairs) to a 3-state DiscreteMap (0=UNKNOWN, 1=DISCOVERED,
2=VISIBLE), exposed as entity.perspective_map. The invariant
visible-subset-of-discovered becomes structural (single value per cell), and
the map is a live, serializable, first-class object rather than an implicit
internal array.
Changes:
- New DiscreteMap C++ class with shared ownership; PyDiscreteMapObject now
holds shared_ptr<DiscreteMap>. UIEntity holds the same shared_ptr.
- New mcrfpy.Perspective IntEnum (UNKNOWN/DISCOVERED/VISIBLE), modelled on
PyInputState.
- entity.perspective_map: lazy-allocated on first access with a grid;
setter validates size against grid and raises ValueError on mismatch;
None clears (next access lazy-reallocates fresh).
- updateVisibility() now demotes 2->1 then promotes visible cells to 2.
- entity.at(x, y) returns grid.at(x, y) when VISIBLE, else None.
- Fog-of-war rendering in UIGridView and UIGrid reads the 3-state map.
- Removed: UIEntity::gridstate, ensureGridstate(), entity.gridstate getter,
UIGridPointState struct + PyUIGridPointStateType.
- Obsolete tests deleted (test_gridpointstate_point,
issue_265_gridpointstate_dangle); 4 new tests cover lazy allocation,
identity, serialization round-trip, size validation, and the
visible-subset-of-discovered invariant.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-17 23:04:27 -04:00
|
|
|
Viewport3D
|
|
|
|
|
.IP \[bu] 2
|
|
|
|
|
VoxelGrid
|
|
|
|
|
.IP \[bu] 2
|
|
|
|
|
VoxelRegion
|
|
|
|
|
.IP \[bu] 2
|
|
|
|
|
WangSet
|
|
|
|
|
.IP \[bu] 2
|
2025-10-30 21:20:50 -04:00
|
|
|
Window
|
|
|
|
|
.RE
|
|
|
|
|
.IP \[bu] 2
|
|
|
|
|
Constants
|
|
|
|
|
.SS Functions
|
F15: correct docstring accuracy from adversarial verify pass (#314)
Follow-up to the macro conversion: an adversarial verify pass (one agent per
file vs. the C++ implementation + stubs) found 62 content issues; the real
ones are fixed here.
Callbacks (centralized):
- on_click: receives (pos, MouseButton, InputState), not str (8 files).
- on_enter/on_exit/on_move (UIBase.h): hover passes only (pos) -- removed the
fictional button/action args.
- bounds/global_bounds (UIBase.h): mark (tuple, read-only).
Signatures / types:
- Grid.find_path: document heuristic + weight; get_dijkstra_map: document roots;
compute_fov: FOV | int = FOV.BASIC (not the C constant FOV_BASIC) + Returns;
at/is_in_fov: document (pos) and (x, y) call forms.
- get_metrics: document all 16 returned dict keys (was 8); bresenham: drop the
bogus '*' keyword-only separator.
- Nullable defaults typed correctly: BSP seed/size, ColorLayer draw_fov/
apply_perspective Color|None, Entity.visible_entities radius int=-1 (None is
rejected by the 'i' parser -> see #319).
- Type-token fixes: GridView.center -> Vector; GridView.texture -> (None,
read-only) (unimplemented, #318); GridPoint.grid_pos -> (tuple, read-only);
EntityCollection.find -> Entity | list[Entity] | None; extend RuntimeError;
UniformCollection.values -> list[float | tuple | None].
- automation: onScreen (x, y) form documented; scroll notes x is ignored (#317).
Also: correct stale AStarPath/DijkstraMap signatures in docs/api-audit-2026-04.md
(the bindings were right, the audit table was outdated). Rebaseline the API
snapshot golden and regenerate docs/stubs.
Code-level bugs surfaced by the pass are filed as #317, #318, #319.
Refs #314, #317, #318, #319
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 06:43:47 -04:00
|
|
|
.SS \f[V]bresenham(start, end, include_start=True, include_end=True) -> list[tuple[int, int]]\f[R]
|
2025-10-30 21:20:50 -04:00
|
|
|
.PP
|
2026-01-23 20:49:11 -05:00
|
|
|
Compute grid cells along a line using Bresenham\[cq]s algorithm.
|
2025-10-30 21:20:50 -04:00
|
|
|
.PP
|
|
|
|
|
Note:
|
|
|
|
|
.PP
|
2026-01-23 20:49:11 -05:00
|
|
|
\f[B]Arguments:\f[R] - \f[V]start\f[R]: (x, y) tuple or Vector -
|
|
|
|
|
starting point - \f[V]end\f[R]: (x, y) tuple or Vector - ending point -
|
|
|
|
|
\f[V]include_start\f[R]: Include the starting point in results (default:
|
|
|
|
|
True) - \f[V]include_end\f[R]: Include the ending point in results
|
|
|
|
|
(default: True)
|
2025-10-30 21:20:50 -04:00
|
|
|
.PP
|
2026-01-23 20:49:11 -05:00
|
|
|
\f[B]Returns:\f[R] list[tuple[int, int]]: List of (x, y) grid
|
|
|
|
|
coordinates along the line Useful for line-of-sight checks, projectile
|
|
|
|
|
paths, and drawing lines on grids.
|
|
|
|
|
The algorithm ensures minimal grid traversal between two points.
|
2025-12-02 09:21:43 -05:00
|
|
|
.SS \f[V]end_benchmark() -> str\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Stop benchmark capture and write data to JSON file.
|
|
|
|
|
.PP
|
|
|
|
|
Note:
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Returns:\f[R] str: The filename of the written benchmark data
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Raises:\f[R] RuntimeError: If no benchmark is currently running
|
|
|
|
|
Returns the auto-generated filename (e.g.,
|
|
|
|
|
`benchmark_12345_20250528_143022.json')
|
2025-10-30 21:20:50 -04:00
|
|
|
.SS \f[V]exit() -> None\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Cleanly shut down the game engine and exit the application.
|
|
|
|
|
.PP
|
|
|
|
|
Note:
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Returns:\f[R] None This immediately closes the window and
|
|
|
|
|
terminates the program.
|
|
|
|
|
.SS \f[V]find(name: str, scene: str = None) -> UIDrawable | None\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Find the first UI element with the specified name.
|
|
|
|
|
.PP
|
|
|
|
|
Note:
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Arguments:\f[R] - \f[V]name\f[R]: Exact name to search for -
|
|
|
|
|
\f[V]scene\f[R]: Scene to search in (default: current scene)
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Returns:\f[R] Frame, Caption, Sprite, Grid, or Entity if found;
|
|
|
|
|
None otherwise Searches scene UI elements and entities within grids.
|
Replace UIEntity gridstate with DiscreteMap perspective_map; closes #294
Per-entity FOV memory moves from std::vector<UIGridPointState> (two-bool
visible/discovered pairs) to a 3-state DiscreteMap (0=UNKNOWN, 1=DISCOVERED,
2=VISIBLE), exposed as entity.perspective_map. The invariant
visible-subset-of-discovered becomes structural (single value per cell), and
the map is a live, serializable, first-class object rather than an implicit
internal array.
Changes:
- New DiscreteMap C++ class with shared ownership; PyDiscreteMapObject now
holds shared_ptr<DiscreteMap>. UIEntity holds the same shared_ptr.
- New mcrfpy.Perspective IntEnum (UNKNOWN/DISCOVERED/VISIBLE), modelled on
PyInputState.
- entity.perspective_map: lazy-allocated on first access with a grid;
setter validates size against grid and raises ValueError on mismatch;
None clears (next access lazy-reallocates fresh).
- updateVisibility() now demotes 2->1 then promotes visible cells to 2.
- entity.at(x, y) returns grid.at(x, y) when VISIBLE, else None.
- Fog-of-war rendering in UIGridView and UIGrid reads the 3-state map.
- Removed: UIEntity::gridstate, ensureGridstate(), entity.gridstate getter,
UIGridPointState struct + PyUIGridPointStateType.
- Obsolete tests deleted (test_gridpointstate_point,
issue_265_gridpointstate_dangle); 4 new tests cover lazy allocation,
identity, serialization round-trip, size validation, and the
visible-subset-of-discovered invariant.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-17 23:04:27 -04:00
|
|
|
.SS \f[V]find_all(pattern: str, scene: str = None) -> list\f[R]
|
2025-10-30 21:20:50 -04:00
|
|
|
.PP
|
|
|
|
|
Find all UI elements matching a name pattern.
|
|
|
|
|
.PP
|
|
|
|
|
Note:
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Arguments:\f[R] - \f[V]pattern\f[R]: Name pattern with optional
|
|
|
|
|
wildcards (* matches any characters) - \f[V]scene\f[R]: Scene to search
|
|
|
|
|
in (default: current scene)
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Returns:\f[R] list: All matching UI elements and entities
|
Replace UIEntity gridstate with DiscreteMap perspective_map; closes #294
Per-entity FOV memory moves from std::vector<UIGridPointState> (two-bool
visible/discovered pairs) to a 3-state DiscreteMap (0=UNKNOWN, 1=DISCOVERED,
2=VISIBLE), exposed as entity.perspective_map. The invariant
visible-subset-of-discovered becomes structural (single value per cell), and
the map is a live, serializable, first-class object rather than an implicit
internal array.
Changes:
- New DiscreteMap C++ class with shared ownership; PyDiscreteMapObject now
holds shared_ptr<DiscreteMap>. UIEntity holds the same shared_ptr.
- New mcrfpy.Perspective IntEnum (UNKNOWN/DISCOVERED/VISIBLE), modelled on
PyInputState.
- entity.perspective_map: lazy-allocated on first access with a grid;
setter validates size against grid and raises ValueError on mismatch;
None clears (next access lazy-reallocates fresh).
- updateVisibility() now demotes 2->1 then promotes visible cells to 2.
- entity.at(x, y) returns grid.at(x, y) when VISIBLE, else None.
- Fog-of-war rendering in UIGridView and UIGrid reads the 3-state map.
- Removed: UIEntity::gridstate, ensureGridstate(), entity.gridstate getter,
UIGridPointState struct + PyUIGridPointStateType.
- Obsolete tests deleted (test_gridpointstate_point,
issue_265_gridpointstate_dangle); 4 new tests cover lazy allocation,
identity, serialization round-trip, size validation, and the
visible-subset-of-discovered invariant.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-17 23:04:27 -04:00
|
|
|
.SS \f[V]get_metrics() -> dict\f[R]
|
2025-10-30 21:20:50 -04:00
|
|
|
.PP
|
|
|
|
|
Get current performance metrics.
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Returns:\f[R] dict: Performance data with keys: frame_time (last
|
|
|
|
|
frame duration in seconds), avg_frame_time (average frame time), fps
|
|
|
|
|
(frames per second), draw_calls (number of draw calls), ui_elements
|
|
|
|
|
(total UI element count), visible_elements (visible element count),
|
F15: correct docstring accuracy from adversarial verify pass (#314)
Follow-up to the macro conversion: an adversarial verify pass (one agent per
file vs. the C++ implementation + stubs) found 62 content issues; the real
ones are fixed here.
Callbacks (centralized):
- on_click: receives (pos, MouseButton, InputState), not str (8 files).
- on_enter/on_exit/on_move (UIBase.h): hover passes only (pos) -- removed the
fictional button/action args.
- bounds/global_bounds (UIBase.h): mark (tuple, read-only).
Signatures / types:
- Grid.find_path: document heuristic + weight; get_dijkstra_map: document roots;
compute_fov: FOV | int = FOV.BASIC (not the C constant FOV_BASIC) + Returns;
at/is_in_fov: document (pos) and (x, y) call forms.
- get_metrics: document all 16 returned dict keys (was 8); bresenham: drop the
bogus '*' keyword-only separator.
- Nullable defaults typed correctly: BSP seed/size, ColorLayer draw_fov/
apply_perspective Color|None, Entity.visible_entities radius int=-1 (None is
rejected by the 'i' parser -> see #319).
- Type-token fixes: GridView.center -> Vector; GridView.texture -> (None,
read-only) (unimplemented, #318); GridPoint.grid_pos -> (tuple, read-only);
EntityCollection.find -> Entity | list[Entity] | None; extend RuntimeError;
UniformCollection.values -> list[float | tuple | None].
- automation: onScreen (x, y) form documented; scroll notes x is ignored (#317).
Also: correct stale AStarPath/DijkstraMap signatures in docs/api-audit-2026-04.md
(the bindings were right, the audit table was outdated). Rebaseline the API
snapshot golden and regenerate docs/stubs.
Code-level bugs surfaced by the pass are filed as #317, #318, #319.
Refs #314, #317, #318, #319
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 06:43:47 -04:00
|
|
|
current_frame (frame counter), runtime (total runtime in seconds),
|
|
|
|
|
grid_render_time (grid rendering time in ms), entity_render_time (entity
|
|
|
|
|
rendering time in ms), fov_overlay_time (FOV overlay rendering time in
|
|
|
|
|
ms), python_time (Python script execution time in ms), animation_time
|
|
|
|
|
(animation processing time in ms), grid_cells_rendered (number of grid
|
|
|
|
|
cells rendered this frame), entities_rendered (number of entities
|
|
|
|
|
rendered this frame), total_entities (total entity count across all
|
|
|
|
|
grids)
|
2026-01-23 20:49:11 -05:00
|
|
|
.SS \f[V]lock() -> _LockContext\f[R]
|
2025-10-30 21:20:50 -04:00
|
|
|
.PP
|
2026-01-23 20:49:11 -05:00
|
|
|
Get a context manager for thread-safe UI updates from background
|
|
|
|
|
threads.
|
2025-10-30 21:20:50 -04:00
|
|
|
.PP
|
|
|
|
|
Note:
|
|
|
|
|
.PP
|
2026-01-23 20:49:11 -05:00
|
|
|
\f[B]Returns:\f[R] _LockContext: A context manager that blocks until
|
|
|
|
|
safe to modify UI Use with \f[V]with mcrfpy.lock():\f[R] to safely
|
|
|
|
|
modify UI objects from a background thread.
|
|
|
|
|
The context manager blocks until the render loop reaches a safe point
|
|
|
|
|
between frames.
|
|
|
|
|
Without this, modifying UI from threads may cause visual glitches or
|
|
|
|
|
crashes.
|
2025-12-02 09:21:43 -05:00
|
|
|
.SS \f[V]log_benchmark(message: str) -> None\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Add a log message to the current benchmark frame.
|
|
|
|
|
.PP
|
|
|
|
|
Note:
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Arguments:\f[R] - \f[V]message\f[R]: Text to associate with the
|
|
|
|
|
current frame
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Returns:\f[R] None
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Raises:\f[R] RuntimeError: If no benchmark is currently running
|
|
|
|
|
Messages appear in the `logs' array of each frame in the output JSON.
|
Replace UIEntity gridstate with DiscreteMap perspective_map; closes #294
Per-entity FOV memory moves from std::vector<UIGridPointState> (two-bool
visible/discovered pairs) to a 3-state DiscreteMap (0=UNKNOWN, 1=DISCOVERED,
2=VISIBLE), exposed as entity.perspective_map. The invariant
visible-subset-of-discovered becomes structural (single value per cell), and
the map is a live, serializable, first-class object rather than an implicit
internal array.
Changes:
- New DiscreteMap C++ class with shared ownership; PyDiscreteMapObject now
holds shared_ptr<DiscreteMap>. UIEntity holds the same shared_ptr.
- New mcrfpy.Perspective IntEnum (UNKNOWN/DISCOVERED/VISIBLE), modelled on
PyInputState.
- entity.perspective_map: lazy-allocated on first access with a grid;
setter validates size against grid and raises ValueError on mismatch;
None clears (next access lazy-reallocates fresh).
- updateVisibility() now demotes 2->1 then promotes visible cells to 2.
- entity.at(x, y) returns grid.at(x, y) when VISIBLE, else None.
- Fog-of-war rendering in UIGridView and UIGrid reads the 3-state map.
- Removed: UIEntity::gridstate, ensureGridstate(), entity.gridstate getter,
UIGridPointState struct + PyUIGridPointStateType.
- Obsolete tests deleted (test_gridpointstate_point,
issue_265_gridpointstate_dangle); 4 new tests cover lazy allocation,
identity, serialization round-trip, size validation, and the
visible-subset-of-discovered invariant.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-17 23:04:27 -04:00
|
|
|
.SS \f[V]set_dev_console(enabled: bool) -> None\f[R]
|
2025-12-02 09:21:43 -05:00
|
|
|
.PP
|
|
|
|
|
Enable or disable the developer console overlay.
|
|
|
|
|
.PP
|
|
|
|
|
Note:
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Arguments:\f[R] - \f[V]enabled\f[R]: True to enable the console
|
|
|
|
|
(default), False to disable
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Returns:\f[R] None When disabled, the grave/tilde key will not open
|
|
|
|
|
the console.
|
|
|
|
|
Use this to ship games without debug features.
|
Replace UIEntity gridstate with DiscreteMap perspective_map; closes #294
Per-entity FOV memory moves from std::vector<UIGridPointState> (two-bool
visible/discovered pairs) to a 3-state DiscreteMap (0=UNKNOWN, 1=DISCOVERED,
2=VISIBLE), exposed as entity.perspective_map. The invariant
visible-subset-of-discovered becomes structural (single value per cell), and
the map is a live, serializable, first-class object rather than an implicit
internal array.
Changes:
- New DiscreteMap C++ class with shared ownership; PyDiscreteMapObject now
holds shared_ptr<DiscreteMap>. UIEntity holds the same shared_ptr.
- New mcrfpy.Perspective IntEnum (UNKNOWN/DISCOVERED/VISIBLE), modelled on
PyInputState.
- entity.perspective_map: lazy-allocated on first access with a grid;
setter validates size against grid and raises ValueError on mismatch;
None clears (next access lazy-reallocates fresh).
- updateVisibility() now demotes 2->1 then promotes visible cells to 2.
- entity.at(x, y) returns grid.at(x, y) when VISIBLE, else None.
- Fog-of-war rendering in UIGridView and UIGrid reads the 3-state map.
- Removed: UIEntity::gridstate, ensureGridstate(), entity.gridstate getter,
UIGridPointState struct + PyUIGridPointStateType.
- Obsolete tests deleted (test_gridpointstate_point,
issue_265_gridpointstate_dangle); 4 new tests cover lazy allocation,
identity, serialization round-trip, size validation, and the
visible-subset-of-discovered invariant.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-17 23:04:27 -04:00
|
|
|
.SS \f[V]set_scale(multiplier: float) -> None\f[R]
|
2025-10-30 21:20:50 -04:00
|
|
|
.PP
|
Replace UIEntity gridstate with DiscreteMap perspective_map; closes #294
Per-entity FOV memory moves from std::vector<UIGridPointState> (two-bool
visible/discovered pairs) to a 3-state DiscreteMap (0=UNKNOWN, 1=DISCOVERED,
2=VISIBLE), exposed as entity.perspective_map. The invariant
visible-subset-of-discovered becomes structural (single value per cell), and
the map is a live, serializable, first-class object rather than an implicit
internal array.
Changes:
- New DiscreteMap C++ class with shared ownership; PyDiscreteMapObject now
holds shared_ptr<DiscreteMap>. UIEntity holds the same shared_ptr.
- New mcrfpy.Perspective IntEnum (UNKNOWN/DISCOVERED/VISIBLE), modelled on
PyInputState.
- entity.perspective_map: lazy-allocated on first access with a grid;
setter validates size against grid and raises ValueError on mismatch;
None clears (next access lazy-reallocates fresh).
- updateVisibility() now demotes 2->1 then promotes visible cells to 2.
- entity.at(x, y) returns grid.at(x, y) when VISIBLE, else None.
- Fog-of-war rendering in UIGridView and UIGrid reads the 3-state map.
- Removed: UIEntity::gridstate, ensureGridstate(), entity.gridstate getter,
UIGridPointState struct + PyUIGridPointStateType.
- Obsolete tests deleted (test_gridpointstate_point,
issue_265_gridpointstate_dangle); 4 new tests cover lazy allocation,
identity, serialization round-trip, size validation, and the
visible-subset-of-discovered invariant.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-17 23:04:27 -04:00
|
|
|
Deprecated: use Window.resolution instead.
|
2025-10-30 21:20:50 -04:00
|
|
|
Scale the game window size.
|
|
|
|
|
.PP
|
|
|
|
|
Note:
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Arguments:\f[R] - \f[V]multiplier\f[R]: Scale factor (e.g., 2.0 for
|
|
|
|
|
double size)
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Returns:\f[R] None The internal resolution remains 1024x768, but
|
|
|
|
|
the window is scaled.
|
|
|
|
|
This is deprecated - use Window.resolution instead.
|
2025-12-02 09:21:43 -05:00
|
|
|
.SS \f[V]start_benchmark() -> None\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Start capturing benchmark data to a file.
|
|
|
|
|
.PP
|
|
|
|
|
Note:
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Returns:\f[R] None
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Raises:\f[R] RuntimeError: If a benchmark is already running
|
|
|
|
|
Benchmark filename is auto-generated from PID and timestamp.
|
|
|
|
|
Use end_benchmark() to stop and get filename.
|
refactor: Rename click kwarg to on_click for API consistency (closes #126)
BREAKING CHANGE: Constructor keyword argument renamed from `click` to
`on_click` for all UIDrawable types (Frame, Caption, Sprite, Grid, Line,
Circle, Arc).
Before: Frame(pos=(0,0), size=(100,100), click=handler)
After: Frame(pos=(0,0), size=(100,100), on_click=handler)
The property name was already `on_click` - this makes the constructor
kwarg match, completing the callback naming standardization from #139.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-28 14:31:22 -05:00
|
|
|
.SS \f[V]step(dt: float = None) -> float\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Advance simulation time (headless mode only).
|
|
|
|
|
.PP
|
|
|
|
|
Note:
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Arguments:\f[R] - \f[V]dt\f[R]: Time to advance in seconds.
|
|
|
|
|
If None, advances to the next scheduled event (timer/animation).
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Returns:\f[R] float: Actual time advanced in seconds.
|
|
|
|
|
Returns 0.0 in windowed mode.
|
|
|
|
|
In windowed mode, this is a no-op and returns 0.0.
|
|
|
|
|
Use this for deterministic simulation control in headless/testing
|
|
|
|
|
scenarios.
|
2025-10-30 21:20:50 -04:00
|
|
|
.SS Classes
|
2026-01-23 20:49:11 -05:00
|
|
|
.SS AStarPath
|
|
|
|
|
.PP
|
|
|
|
|
A computed A* path result, consumed step by step.
|
|
|
|
|
.PP
|
|
|
|
|
Created by Grid.find_path().
|
|
|
|
|
Cannot be instantiated directly.
|
|
|
|
|
.PP
|
|
|
|
|
Use walk() to get and consume each step, or iterate directly.
|
|
|
|
|
Use peek() to see the next step without consuming it.
|
|
|
|
|
Use bool(path) or len(path) to check if steps remain.
|
|
|
|
|
.PP
|
|
|
|
|
Properties: origin (Vector): Starting position (read-only) destination
|
|
|
|
|
(Vector): Ending position (read-only) remaining (int): Steps remaining
|
|
|
|
|
(read-only)
|
|
|
|
|
.PP
|
|
|
|
|
Example: path = grid.find_path(start, end) if path: while path: next_pos
|
|
|
|
|
= path.walk() entity.pos = next_pos
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Properties:\f[R] - \f[V]destination\f[R] \f[I](read-only)\f[R]:
|
|
|
|
|
Ending position of the path (Vector, read-only).
|
|
|
|
|
- \f[V]origin\f[R] \f[I](read-only)\f[R]: Starting position of the path
|
|
|
|
|
(Vector, read-only).
|
|
|
|
|
- \f[V]remaining\f[R] \f[I](read-only)\f[R]: Number of steps remaining
|
|
|
|
|
in the path (int, read-only).
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Methods:\f[R]
|
|
|
|
|
.SS \f[V]peek() -> Vector\f[R]
|
|
|
|
|
.PP
|
F15: convert frozen binding docstrings to MCRF_* macros (#314)
Convert 289 raw PyMethodDef/PyGetSetDef docstring slots to MCRF_METHOD /
MCRF_PROPERTY across the 20 frozen (non-3D) binding files, bringing the
frozen surface to 100% macro compliance (check_frozen_docstrings.sh PASS).
Done via a one-agent-per-file workflow gated by validate_file_docstrings.sh
and per-wave build/doc-rebuild checks.
- Adds #include "McRFPy_Doc.h" where missing; fills the lone genuine doc
gap (UIGrid.at, which was MISSING a doc field in two arrays).
- McRFPy_Doc.h: comment documenting the MCRF_METHOD_DOC comma rule (the
trap that broke the GridLayers conversion mid-run).
- Rebaseline api_surface golden: property types now resolve to real types
instead of "Any" (e.g. grid_pos: Vector, on_cell_click: Callable | None),
and 11 properties correctly flip rw->ro now that their docstrings carry
"read-only" (collections, grid_size, hovered_cell, texture, view — all
verified against NULL setter slots).
- Regenerate docs/stubs/man page from the new docstrings.
Module-level functions use MCRF_METHOD(<name>, ...) (expands identically to
the intended MCRF_FUNCTION; the audit's compliance set is METHOD/PROPERTY).
Experimental 3D/Voxel bindings (src/3d/) remain exempt from the freeze.
Pre-existing failures unrelated to this change: test_animation_*,
test_constructor_comprehensive (reference the removed mcrfpy.Animation and
old constructor arity).
Refs #314
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 01:20:55 -04:00
|
|
|
See the next step without consuming it.
|
2026-01-23 20:49:11 -05:00
|
|
|
.PP
|
F15: convert frozen binding docstrings to MCRF_* macros (#314)
Convert 289 raw PyMethodDef/PyGetSetDef docstring slots to MCRF_METHOD /
MCRF_PROPERTY across the 20 frozen (non-3D) binding files, bringing the
frozen surface to 100% macro compliance (check_frozen_docstrings.sh PASS).
Done via a one-agent-per-file workflow gated by validate_file_docstrings.sh
and per-wave build/doc-rebuild checks.
- Adds #include "McRFPy_Doc.h" where missing; fills the lone genuine doc
gap (UIGrid.at, which was MISSING a doc field in two arrays).
- McRFPy_Doc.h: comment documenting the MCRF_METHOD_DOC comma rule (the
trap that broke the GridLayers conversion mid-run).
- Rebaseline api_surface golden: property types now resolve to real types
instead of "Any" (e.g. grid_pos: Vector, on_cell_click: Callable | None),
and 11 properties correctly flip rw->ro now that their docstrings carry
"read-only" (collections, grid_size, hovered_cell, texture, view — all
verified against NULL setter slots).
- Regenerate docs/stubs/man page from the new docstrings.
Module-level functions use MCRF_METHOD(<name>, ...) (expands identically to
the intended MCRF_FUNCTION; the audit's compliance set is METHOD/PROPERTY).
Experimental 3D/Voxel bindings (src/3d/) remain exempt from the freeze.
Pre-existing failures unrelated to this change: test_animation_*,
test_constructor_comprehensive (reference the removed mcrfpy.Animation and
old constructor arity).
Refs #314
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 01:20:55 -04:00
|
|
|
\f[B]Returns:\f[R] Next position as Vector
|
2026-01-23 20:49:11 -05:00
|
|
|
.PP
|
F15: convert frozen binding docstrings to MCRF_* macros (#314)
Convert 289 raw PyMethodDef/PyGetSetDef docstring slots to MCRF_METHOD /
MCRF_PROPERTY across the 20 frozen (non-3D) binding files, bringing the
frozen surface to 100% macro compliance (check_frozen_docstrings.sh PASS).
Done via a one-agent-per-file workflow gated by validate_file_docstrings.sh
and per-wave build/doc-rebuild checks.
- Adds #include "McRFPy_Doc.h" where missing; fills the lone genuine doc
gap (UIGrid.at, which was MISSING a doc field in two arrays).
- McRFPy_Doc.h: comment documenting the MCRF_METHOD_DOC comma rule (the
trap that broke the GridLayers conversion mid-run).
- Rebaseline api_surface golden: property types now resolve to real types
instead of "Any" (e.g. grid_pos: Vector, on_cell_click: Callable | None),
and 11 properties correctly flip rw->ro now that their docstrings carry
"read-only" (collections, grid_size, hovered_cell, texture, view — all
verified against NULL setter slots).
- Regenerate docs/stubs/man page from the new docstrings.
Module-level functions use MCRF_METHOD(<name>, ...) (expands identically to
the intended MCRF_FUNCTION; the audit's compliance set is METHOD/PROPERTY).
Experimental 3D/Voxel bindings (src/3d/) remain exempt from the freeze.
Pre-existing failures unrelated to this change: test_animation_*,
test_constructor_comprehensive (reference the removed mcrfpy.Animation and
old constructor arity).
Refs #314
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 01:20:55 -04:00
|
|
|
\f[B]Raises:\f[R] IndexError: If the path is exhausted
|
2026-01-23 20:49:11 -05:00
|
|
|
.SS \f[V]walk() -> Vector\f[R]
|
|
|
|
|
.PP
|
F15: convert frozen binding docstrings to MCRF_* macros (#314)
Convert 289 raw PyMethodDef/PyGetSetDef docstring slots to MCRF_METHOD /
MCRF_PROPERTY across the 20 frozen (non-3D) binding files, bringing the
frozen surface to 100% macro compliance (check_frozen_docstrings.sh PASS).
Done via a one-agent-per-file workflow gated by validate_file_docstrings.sh
and per-wave build/doc-rebuild checks.
- Adds #include "McRFPy_Doc.h" where missing; fills the lone genuine doc
gap (UIGrid.at, which was MISSING a doc field in two arrays).
- McRFPy_Doc.h: comment documenting the MCRF_METHOD_DOC comma rule (the
trap that broke the GridLayers conversion mid-run).
- Rebaseline api_surface golden: property types now resolve to real types
instead of "Any" (e.g. grid_pos: Vector, on_cell_click: Callable | None),
and 11 properties correctly flip rw->ro now that their docstrings carry
"read-only" (collections, grid_size, hovered_cell, texture, view — all
verified against NULL setter slots).
- Regenerate docs/stubs/man page from the new docstrings.
Module-level functions use MCRF_METHOD(<name>, ...) (expands identically to
the intended MCRF_FUNCTION; the audit's compliance set is METHOD/PROPERTY).
Experimental 3D/Voxel bindings (src/3d/) remain exempt from the freeze.
Pre-existing failures unrelated to this change: test_animation_*,
test_constructor_comprehensive (reference the removed mcrfpy.Animation and
old constructor arity).
Refs #314
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 01:20:55 -04:00
|
|
|
Get and consume the next step in the path.
|
2026-01-23 20:49:11 -05:00
|
|
|
.PP
|
F15: convert frozen binding docstrings to MCRF_* macros (#314)
Convert 289 raw PyMethodDef/PyGetSetDef docstring slots to MCRF_METHOD /
MCRF_PROPERTY across the 20 frozen (non-3D) binding files, bringing the
frozen surface to 100% macro compliance (check_frozen_docstrings.sh PASS).
Done via a one-agent-per-file workflow gated by validate_file_docstrings.sh
and per-wave build/doc-rebuild checks.
- Adds #include "McRFPy_Doc.h" where missing; fills the lone genuine doc
gap (UIGrid.at, which was MISSING a doc field in two arrays).
- McRFPy_Doc.h: comment documenting the MCRF_METHOD_DOC comma rule (the
trap that broke the GridLayers conversion mid-run).
- Rebaseline api_surface golden: property types now resolve to real types
instead of "Any" (e.g. grid_pos: Vector, on_cell_click: Callable | None),
and 11 properties correctly flip rw->ro now that their docstrings carry
"read-only" (collections, grid_size, hovered_cell, texture, view — all
verified against NULL setter slots).
- Regenerate docs/stubs/man page from the new docstrings.
Module-level functions use MCRF_METHOD(<name>, ...) (expands identically to
the intended MCRF_FUNCTION; the audit's compliance set is METHOD/PROPERTY).
Experimental 3D/Voxel bindings (src/3d/) remain exempt from the freeze.
Pre-existing failures unrelated to this change: test_animation_*,
test_constructor_comprehensive (reference the removed mcrfpy.Animation and
old constructor arity).
Refs #314
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 01:20:55 -04:00
|
|
|
\f[B]Returns:\f[R] Next position as Vector
|
2026-01-23 20:49:11 -05:00
|
|
|
.PP
|
F15: convert frozen binding docstrings to MCRF_* macros (#314)
Convert 289 raw PyMethodDef/PyGetSetDef docstring slots to MCRF_METHOD /
MCRF_PROPERTY across the 20 frozen (non-3D) binding files, bringing the
frozen surface to 100% macro compliance (check_frozen_docstrings.sh PASS).
Done via a one-agent-per-file workflow gated by validate_file_docstrings.sh
and per-wave build/doc-rebuild checks.
- Adds #include "McRFPy_Doc.h" where missing; fills the lone genuine doc
gap (UIGrid.at, which was MISSING a doc field in two arrays).
- McRFPy_Doc.h: comment documenting the MCRF_METHOD_DOC comma rule (the
trap that broke the GridLayers conversion mid-run).
- Rebaseline api_surface golden: property types now resolve to real types
instead of "Any" (e.g. grid_pos: Vector, on_cell_click: Callable | None),
and 11 properties correctly flip rw->ro now that their docstrings carry
"read-only" (collections, grid_size, hovered_cell, texture, view — all
verified against NULL setter slots).
- Regenerate docs/stubs/man page from the new docstrings.
Module-level functions use MCRF_METHOD(<name>, ...) (expands identically to
the intended MCRF_FUNCTION; the audit's compliance set is METHOD/PROPERTY).
Experimental 3D/Voxel bindings (src/3d/) remain exempt from the freeze.
Pre-existing failures unrelated to this change: test_animation_*,
test_constructor_comprehensive (reference the removed mcrfpy.Animation and
old constructor arity).
Refs #314
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 01:20:55 -04:00
|
|
|
\f[B]Raises:\f[R] IndexError: If the path is exhausted
|
2026-01-23 20:49:11 -05:00
|
|
|
.SS Alignment
|
|
|
|
|
.PP
|
|
|
|
|
\f[I]Inherits from: IntEnum\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Alignment enum for positioning UI elements relative to parent bounds.
|
|
|
|
|
.PP
|
|
|
|
|
Values: TOP_LEFT, TOP_CENTER, TOP_RIGHT CENTER_LEFT, CENTER,
|
|
|
|
|
CENTER_RIGHT BOTTOM_LEFT, BOTTOM_CENTER, BOTTOM_RIGHT
|
|
|
|
|
.PP
|
|
|
|
|
Margin Validation Rules: Margins define distance from parent edge when
|
|
|
|
|
aligned.
|
|
|
|
|
.IP
|
|
|
|
|
.nf
|
|
|
|
|
\f[C]
|
|
|
|
|
- CENTER: No margins allowed (raises ValueError if margin != 0)
|
|
|
|
|
- TOP_CENTER, BOTTOM_CENTER: Only vert_margin applies (horiz_margin raises ValueError)
|
|
|
|
|
- CENTER_LEFT, CENTER_RIGHT: Only horiz_margin applies (vert_margin raises ValueError)
|
|
|
|
|
- Corner alignments (TOP_LEFT, etc.): All margins valid
|
|
|
|
|
\f[R]
|
|
|
|
|
.fi
|
|
|
|
|
.PP
|
|
|
|
|
Properties: align: Alignment value or None to disable margin: General
|
|
|
|
|
margin for all applicable edges horiz_margin: Override for horizontal
|
|
|
|
|
edge (0 = use general margin) vert_margin: Override for vertical edge (0
|
|
|
|
|
= use general margin)
|
|
|
|
|
.PP
|
|
|
|
|
Example: # Center a panel in the scene panel = Frame(size=(200, 100),
|
|
|
|
|
align=Alignment.CENTER) scene.children.append(panel)
|
|
|
|
|
.IP
|
|
|
|
|
.nf
|
|
|
|
|
\f[C]
|
|
|
|
|
# Place button in bottom-right with 10px margin
|
|
|
|
|
button = Frame(size=(80, 30), align=Alignment.BOTTOM_RIGHT, margin=10)
|
|
|
|
|
panel.children.append(button)
|
|
|
|
|
\f[R]
|
|
|
|
|
.fi
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Properties:\f[R] - \f[V]denominator\f[R]: the denominator of a
|
|
|
|
|
rational number in lowest terms - \f[V]imag\f[R]: the imaginary part of
|
|
|
|
|
a complex number - \f[V]numerator\f[R]: the numerator of a rational
|
|
|
|
|
number in lowest terms - \f[V]real\f[R]: the real part of a complex
|
|
|
|
|
number
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Methods:\f[R]
|
|
|
|
|
.SS \f[V]as_integer_ratio(...)\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Return a pair of integers, whose ratio is equal to the original int.
|
|
|
|
|
The ratio is in lowest terms and has a positive denominator.
|
|
|
|
|
>>> (10).as_integer_ratio() (10, 1) >>> (-10).as_integer_ratio() (-10,
|
|
|
|
|
1) >>> (0).as_integer_ratio() (0, 1)
|
|
|
|
|
.SS \f[V]bit_count(...)\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Number of ones in the binary representation of the absolute value of
|
|
|
|
|
self.
|
|
|
|
|
Also known as the population count.
|
|
|
|
|
>>> bin(13) `0b1101' >>> (13).bit_count() 3
|
|
|
|
|
.SS \f[V]bit_length(...)\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Number of bits necessary to represent self in binary.
|
|
|
|
|
>>> bin(37) `0b100101' >>> (37).bit_length() 6
|
|
|
|
|
.SS \f[V]conjugate(...)\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Returns self, the complex conjugate of any int.
|
|
|
|
|
.SS \f[V]from_bytes(...)\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Return the integer represented by the given array of bytes.
|
|
|
|
|
bytes Holds the array of bytes to convert.
|
|
|
|
|
The argument must either support the buffer protocol or be an iterable
|
|
|
|
|
object producing bytes.
|
|
|
|
|
Bytes and bytearray are examples of built-in objects that support the
|
|
|
|
|
buffer protocol.
|
|
|
|
|
byteorder The byte order used to represent the integer.
|
|
|
|
|
If byteorder is `big', the most significant byte is at the beginning of
|
|
|
|
|
the byte array.
|
|
|
|
|
If byteorder is `little', the most significant byte is at the end of the
|
|
|
|
|
byte array.
|
|
|
|
|
To request the native byte order of the host system, use sys.byteorder
|
|
|
|
|
as the byte order value.
|
|
|
|
|
Default is to use `big'.
|
|
|
|
|
signed Indicates whether two\[cq]s complement is used to represent the
|
|
|
|
|
integer.
|
|
|
|
|
.SS \f[V]is_integer(...)\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Returns True.
|
|
|
|
|
Exists for duck type compatibility with float.is_integer.
|
|
|
|
|
.SS \f[V]to_bytes(...)\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Return an array of bytes representing an integer.
|
|
|
|
|
length Length of bytes object to use.
|
|
|
|
|
An OverflowError is raised if the integer is not representable with the
|
|
|
|
|
given number of bytes.
|
|
|
|
|
Default is length 1.
|
|
|
|
|
byteorder The byte order used to represent the integer.
|
|
|
|
|
If byteorder is `big', the most significant byte is at the beginning of
|
|
|
|
|
the byte array.
|
|
|
|
|
If byteorder is `little', the most significant byte is at the end of the
|
|
|
|
|
byte array.
|
|
|
|
|
To request the native byte order of the host system, use sys.byteorder
|
|
|
|
|
as the byte order value.
|
|
|
|
|
Default is to use `big'.
|
|
|
|
|
signed Determines whether two\[cq]s complement is used to represent the
|
|
|
|
|
integer.
|
|
|
|
|
If signed is False and a negative integer is given, an OverflowError is
|
|
|
|
|
raised.
|
2025-12-02 09:21:43 -05:00
|
|
|
.SS Arc
|
|
|
|
|
.PP
|
|
|
|
|
\f[I]Inherits from: Drawable\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Arc(center=None, radius=0, start_angle=0, end_angle=90, color=None,
|
|
|
|
|
thickness=1, **kwargs)
|
|
|
|
|
.PP
|
|
|
|
|
An arc UI element for drawing curved line segments.
|
|
|
|
|
.PP
|
|
|
|
|
Args: center (tuple, optional): Center position as (x, y).
|
|
|
|
|
Default: (0, 0) radius (float, optional): Arc radius in pixels.
|
|
|
|
|
Default: 0 start_angle (float, optional): Starting angle in degrees.
|
|
|
|
|
Default: 0 end_angle (float, optional): Ending angle in degrees.
|
|
|
|
|
Default: 90 color (Color, optional): Arc color.
|
|
|
|
|
Default: White thickness (float, optional): Line thickness.
|
|
|
|
|
Default: 1.0
|
|
|
|
|
.PP
|
refactor: Rename click kwarg to on_click for API consistency (closes #126)
BREAKING CHANGE: Constructor keyword argument renamed from `click` to
`on_click` for all UIDrawable types (Frame, Caption, Sprite, Grid, Line,
Circle, Arc).
Before: Frame(pos=(0,0), size=(100,100), click=handler)
After: Frame(pos=(0,0), size=(100,100), on_click=handler)
The property name was already `on_click` - this makes the constructor
kwarg match, completing the callback naming standardization from #139.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-28 14:31:22 -05:00
|
|
|
Keyword Args: on_click (callable): Click handler.
|
2025-12-02 09:21:43 -05:00
|
|
|
Default: None visible (bool): Visibility state.
|
|
|
|
|
Default: True opacity (float): Opacity (0.0-1.0).
|
|
|
|
|
Default: 1.0 z_index (int): Rendering order.
|
|
|
|
|
Default: 0 name (str): Element name for finding.
|
2026-01-23 20:49:11 -05:00
|
|
|
Default: None align (Alignment): Alignment relative to parent.
|
|
|
|
|
Default: None margin (float): Margin from parent edge when aligned.
|
|
|
|
|
Default: 0 horiz_margin (float): Horizontal margin override.
|
|
|
|
|
Default: 0 (use margin) vert_margin (float): Vertical margin override.
|
|
|
|
|
Default: 0 (use margin)
|
2025-12-02 09:21:43 -05:00
|
|
|
.PP
|
|
|
|
|
Attributes: center (Vector): Center position radius (float): Arc radius
|
|
|
|
|
start_angle (float): Starting angle in degrees end_angle (float): Ending
|
|
|
|
|
angle in degrees color (Color): Arc color thickness (float): Line
|
|
|
|
|
thickness visible (bool): Visibility state opacity (float): Opacity
|
2026-01-23 20:49:11 -05:00
|
|
|
value z_index (int): Rendering order name (str): Element name align
|
|
|
|
|
(Alignment): Alignment relative to parent (or None) margin (float):
|
|
|
|
|
General margin for alignment horiz_margin (float): Horizontal margin
|
|
|
|
|
override vert_margin (float): Vertical margin override
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Properties:\f[R] - \f[V]align\f[R]: Alignment relative to parent
|
|
|
|
|
bounds (Alignment enum or None).
|
|
|
|
|
When set, position is automatically calculated when parent is assigned
|
|
|
|
|
or resized.
|
|
|
|
|
Set to None to disable alignment and use manual positioning.
|
F15: correct docstring accuracy from adversarial verify pass (#314)
Follow-up to the macro conversion: an adversarial verify pass (one agent per
file vs. the C++ implementation + stubs) found 62 content issues; the real
ones are fixed here.
Callbacks (centralized):
- on_click: receives (pos, MouseButton, InputState), not str (8 files).
- on_enter/on_exit/on_move (UIBase.h): hover passes only (pos) -- removed the
fictional button/action args.
- bounds/global_bounds (UIBase.h): mark (tuple, read-only).
Signatures / types:
- Grid.find_path: document heuristic + weight; get_dijkstra_map: document roots;
compute_fov: FOV | int = FOV.BASIC (not the C constant FOV_BASIC) + Returns;
at/is_in_fov: document (pos) and (x, y) call forms.
- get_metrics: document all 16 returned dict keys (was 8); bresenham: drop the
bogus '*' keyword-only separator.
- Nullable defaults typed correctly: BSP seed/size, ColorLayer draw_fov/
apply_perspective Color|None, Entity.visible_entities radius int=-1 (None is
rejected by the 'i' parser -> see #319).
- Type-token fixes: GridView.center -> Vector; GridView.texture -> (None,
read-only) (unimplemented, #318); GridPoint.grid_pos -> (tuple, read-only);
EntityCollection.find -> Entity | list[Entity] | None; extend RuntimeError;
UniformCollection.values -> list[float | tuple | None].
- automation: onScreen (x, y) form documented; scroll notes x is ignored (#317).
Also: correct stale AStarPath/DijkstraMap signatures in docs/api-audit-2026-04.md
(the bindings were right, the audit table was outdated). Rebaseline the API
snapshot golden and regenerate docs/stubs.
Code-level bugs surfaced by the pass are filed as #317, #318, #319.
Refs #314, #317, #318, #319
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 06:43:47 -04:00
|
|
|
- \f[V]bounds\f[R] \f[I](read-only)\f[R]: Axis-aligned bounding box
|
|
|
|
|
(tuple, read-only) as a (pos, size) pair of Vectors: (Vector(x, y),
|
|
|
|
|
Vector(width, height)).
|
F15: convert frozen binding docstrings to MCRF_* macros (#314)
Convert 289 raw PyMethodDef/PyGetSetDef docstring slots to MCRF_METHOD /
MCRF_PROPERTY across the 20 frozen (non-3D) binding files, bringing the
frozen surface to 100% macro compliance (check_frozen_docstrings.sh PASS).
Done via a one-agent-per-file workflow gated by validate_file_docstrings.sh
and per-wave build/doc-rebuild checks.
- Adds #include "McRFPy_Doc.h" where missing; fills the lone genuine doc
gap (UIGrid.at, which was MISSING a doc field in two arrays).
- McRFPy_Doc.h: comment documenting the MCRF_METHOD_DOC comma rule (the
trap that broke the GridLayers conversion mid-run).
- Rebaseline api_surface golden: property types now resolve to real types
instead of "Any" (e.g. grid_pos: Vector, on_cell_click: Callable | None),
and 11 properties correctly flip rw->ro now that their docstrings carry
"read-only" (collections, grid_size, hovered_cell, texture, view — all
verified against NULL setter slots).
- Regenerate docs/stubs/man page from the new docstrings.
Module-level functions use MCRF_METHOD(<name>, ...) (expands identically to
the intended MCRF_FUNCTION; the audit's compliance set is METHOD/PROPERTY).
Experimental 3D/Voxel bindings (src/3d/) remain exempt from the freeze.
Pre-existing failures unrelated to this change: test_animation_*,
test_constructor_comprehensive (reference the removed mcrfpy.Animation and
old constructor arity).
Refs #314
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 01:20:55 -04:00
|
|
|
- \f[V]center\f[R]: Center position of the arc (Vector).
|
|
|
|
|
- \f[V]color\f[R]: Arc fill color (Color).
|
|
|
|
|
- \f[V]end_angle\f[R]: Ending angle in degrees (float).
|
F15: correct docstring accuracy from adversarial verify pass (#314)
Follow-up to the macro conversion: an adversarial verify pass (one agent per
file vs. the C++ implementation + stubs) found 62 content issues; the real
ones are fixed here.
Callbacks (centralized):
- on_click: receives (pos, MouseButton, InputState), not str (8 files).
- on_enter/on_exit/on_move (UIBase.h): hover passes only (pos) -- removed the
fictional button/action args.
- bounds/global_bounds (UIBase.h): mark (tuple, read-only).
Signatures / types:
- Grid.find_path: document heuristic + weight; get_dijkstra_map: document roots;
compute_fov: FOV | int = FOV.BASIC (not the C constant FOV_BASIC) + Returns;
at/is_in_fov: document (pos) and (x, y) call forms.
- get_metrics: document all 16 returned dict keys (was 8); bresenham: drop the
bogus '*' keyword-only separator.
- Nullable defaults typed correctly: BSP seed/size, ColorLayer draw_fov/
apply_perspective Color|None, Entity.visible_entities radius int=-1 (None is
rejected by the 'i' parser -> see #319).
- Type-token fixes: GridView.center -> Vector; GridView.texture -> (None,
read-only) (unimplemented, #318); GridPoint.grid_pos -> (tuple, read-only);
EntityCollection.find -> Entity | list[Entity] | None; extend RuntimeError;
UniformCollection.values -> list[float | tuple | None].
- automation: onScreen (x, y) form documented; scroll notes x is ignored (#317).
Also: correct stale AStarPath/DijkstraMap signatures in docs/api-audit-2026-04.md
(the bindings were right, the audit table was outdated). Rebaseline the API
snapshot golden and regenerate docs/stubs.
Code-level bugs surfaced by the pass are filed as #317, #318, #319.
Refs #314, #317, #318, #319
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 06:43:47 -04:00
|
|
|
- \f[V]global_bounds\f[R] \f[I](read-only)\f[R]: Axis-aligned bounding
|
|
|
|
|
box in screen coordinates (tuple, read-only) as a (pos, size) pair of
|
|
|
|
|
Vectors: (Vector(x, y), Vector(width, height)).
|
2026-01-23 20:49:11 -05:00
|
|
|
- \f[V]global_position\f[R] \f[I](read-only)\f[R]: Global screen
|
|
|
|
|
position (read-only).
|
|
|
|
|
Calculates absolute position by walking up the parent chain.
|
F15: convert frozen binding docstrings to MCRF_* macros (#314)
Convert 289 raw PyMethodDef/PyGetSetDef docstring slots to MCRF_METHOD /
MCRF_PROPERTY across the 20 frozen (non-3D) binding files, bringing the
frozen surface to 100% macro compliance (check_frozen_docstrings.sh PASS).
Done via a one-agent-per-file workflow gated by validate_file_docstrings.sh
and per-wave build/doc-rebuild checks.
- Adds #include "McRFPy_Doc.h" where missing; fills the lone genuine doc
gap (UIGrid.at, which was MISSING a doc field in two arrays).
- McRFPy_Doc.h: comment documenting the MCRF_METHOD_DOC comma rule (the
trap that broke the GridLayers conversion mid-run).
- Rebaseline api_surface golden: property types now resolve to real types
instead of "Any" (e.g. grid_pos: Vector, on_cell_click: Callable | None),
and 11 properties correctly flip rw->ro now that their docstrings carry
"read-only" (collections, grid_size, hovered_cell, texture, view — all
verified against NULL setter slots).
- Regenerate docs/stubs/man page from the new docstrings.
Module-level functions use MCRF_METHOD(<name>, ...) (expands identically to
the intended MCRF_FUNCTION; the audit's compliance set is METHOD/PROPERTY).
Experimental 3D/Voxel bindings (src/3d/) remain exempt from the freeze.
Pre-existing failures unrelated to this change: test_animation_*,
test_constructor_comprehensive (reference the removed mcrfpy.Animation and
old constructor arity).
Refs #314
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 01:20:55 -04:00
|
|
|
- \f[V]grid_pos\f[R]: Position in grid tile coordinates (Vector, only
|
|
|
|
|
when parent is Grid).
|
|
|
|
|
- \f[V]grid_size\f[R]: Size in grid tile coordinates (Vector, only when
|
|
|
|
|
parent is Grid).
|
|
|
|
|
- \f[V]horiz_margin\f[R]: Horizontal margin override (float, 0 = use
|
|
|
|
|
general margin).
|
2026-01-23 20:49:11 -05:00
|
|
|
Invalid for vertically-centered alignments (TOP_CENTER, BOTTOM_CENTER,
|
|
|
|
|
CENTER).
|
|
|
|
|
- \f[V]hovered\f[R] \f[I](read-only)\f[R]: Whether mouse is currently
|
|
|
|
|
over this element (read-only).
|
|
|
|
|
Updated automatically by the engine during mouse movement.
|
|
|
|
|
- \f[V]margin\f[R]: General margin from edge when aligned (float).
|
|
|
|
|
Applied to both horizontal and vertical edges unless overridden.
|
|
|
|
|
Invalid for CENTER alignment (raises ValueError).
|
F15: convert frozen binding docstrings to MCRF_* macros (#314)
Convert 289 raw PyMethodDef/PyGetSetDef docstring slots to MCRF_METHOD /
MCRF_PROPERTY across the 20 frozen (non-3D) binding files, bringing the
frozen surface to 100% macro compliance (check_frozen_docstrings.sh PASS).
Done via a one-agent-per-file workflow gated by validate_file_docstrings.sh
and per-wave build/doc-rebuild checks.
- Adds #include "McRFPy_Doc.h" where missing; fills the lone genuine doc
gap (UIGrid.at, which was MISSING a doc field in two arrays).
- McRFPy_Doc.h: comment documenting the MCRF_METHOD_DOC comma rule (the
trap that broke the GridLayers conversion mid-run).
- Rebaseline api_surface golden: property types now resolve to real types
instead of "Any" (e.g. grid_pos: Vector, on_cell_click: Callable | None),
and 11 properties correctly flip rw->ro now that their docstrings carry
"read-only" (collections, grid_size, hovered_cell, texture, view — all
verified against NULL setter slots).
- Regenerate docs/stubs/man page from the new docstrings.
Module-level functions use MCRF_METHOD(<name>, ...) (expands identically to
the intended MCRF_FUNCTION; the audit's compliance set is METHOD/PROPERTY).
Experimental 3D/Voxel bindings (src/3d/) remain exempt from the freeze.
Pre-existing failures unrelated to this change: test_animation_*,
test_constructor_comprehensive (reference the removed mcrfpy.Animation and
old constructor arity).
Refs #314
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 01:20:55 -04:00
|
|
|
- \f[V]name\f[R]: Name for finding this element (str).
|
2026-01-23 20:49:11 -05:00
|
|
|
- \f[V]on_click\f[R]: Callable executed when arc is clicked.
|
F15: correct docstring accuracy from adversarial verify pass (#314)
Follow-up to the macro conversion: an adversarial verify pass (one agent per
file vs. the C++ implementation + stubs) found 62 content issues; the real
ones are fixed here.
Callbacks (centralized):
- on_click: receives (pos, MouseButton, InputState), not str (8 files).
- on_enter/on_exit/on_move (UIBase.h): hover passes only (pos) -- removed the
fictional button/action args.
- bounds/global_bounds (UIBase.h): mark (tuple, read-only).
Signatures / types:
- Grid.find_path: document heuristic + weight; get_dijkstra_map: document roots;
compute_fov: FOV | int = FOV.BASIC (not the C constant FOV_BASIC) + Returns;
at/is_in_fov: document (pos) and (x, y) call forms.
- get_metrics: document all 16 returned dict keys (was 8); bresenham: drop the
bogus '*' keyword-only separator.
- Nullable defaults typed correctly: BSP seed/size, ColorLayer draw_fov/
apply_perspective Color|None, Entity.visible_entities radius int=-1 (None is
rejected by the 'i' parser -> see #319).
- Type-token fixes: GridView.center -> Vector; GridView.texture -> (None,
read-only) (unimplemented, #318); GridPoint.grid_pos -> (tuple, read-only);
EntityCollection.find -> Entity | list[Entity] | None; extend RuntimeError;
UniformCollection.values -> list[float | tuple | None].
- automation: onScreen (x, y) form documented; scroll notes x is ignored (#317).
Also: correct stale AStarPath/DijkstraMap signatures in docs/api-audit-2026-04.md
(the bindings were right, the audit table was outdated). Rebaseline the API
snapshot golden and regenerate docs/stubs.
Code-level bugs surfaced by the pass are filed as #317, #318, #319.
Refs #314, #317, #318, #319
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 06:43:47 -04:00
|
|
|
Function receives (pos: Vector, button: MouseButton, action:
|
|
|
|
|
InputState).
|
2026-01-23 20:49:11 -05:00
|
|
|
- \f[V]on_enter\f[R]: Callback for mouse enter events.
|
F15: correct docstring accuracy from adversarial verify pass (#314)
Follow-up to the macro conversion: an adversarial verify pass (one agent per
file vs. the C++ implementation + stubs) found 62 content issues; the real
ones are fixed here.
Callbacks (centralized):
- on_click: receives (pos, MouseButton, InputState), not str (8 files).
- on_enter/on_exit/on_move (UIBase.h): hover passes only (pos) -- removed the
fictional button/action args.
- bounds/global_bounds (UIBase.h): mark (tuple, read-only).
Signatures / types:
- Grid.find_path: document heuristic + weight; get_dijkstra_map: document roots;
compute_fov: FOV | int = FOV.BASIC (not the C constant FOV_BASIC) + Returns;
at/is_in_fov: document (pos) and (x, y) call forms.
- get_metrics: document all 16 returned dict keys (was 8); bresenham: drop the
bogus '*' keyword-only separator.
- Nullable defaults typed correctly: BSP seed/size, ColorLayer draw_fov/
apply_perspective Color|None, Entity.visible_entities radius int=-1 (None is
rejected by the 'i' parser -> see #319).
- Type-token fixes: GridView.center -> Vector; GridView.texture -> (None,
read-only) (unimplemented, #318); GridPoint.grid_pos -> (tuple, read-only);
EntityCollection.find -> Entity | list[Entity] | None; extend RuntimeError;
UniformCollection.values -> list[float | tuple | None].
- automation: onScreen (x, y) form documented; scroll notes x is ignored (#317).
Also: correct stale AStarPath/DijkstraMap signatures in docs/api-audit-2026-04.md
(the bindings were right, the audit table was outdated). Rebaseline the API
snapshot golden and regenerate docs/stubs.
Code-level bugs surfaced by the pass are filed as #317, #318, #319.
Refs #314, #317, #318, #319
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 06:43:47 -04:00
|
|
|
Called with (pos: Vector) when mouse enters this element\[cq]s bounds.
|
2026-01-23 20:49:11 -05:00
|
|
|
- \f[V]on_exit\f[R]: Callback for mouse exit events.
|
F15: correct docstring accuracy from adversarial verify pass (#314)
Follow-up to the macro conversion: an adversarial verify pass (one agent per
file vs. the C++ implementation + stubs) found 62 content issues; the real
ones are fixed here.
Callbacks (centralized):
- on_click: receives (pos, MouseButton, InputState), not str (8 files).
- on_enter/on_exit/on_move (UIBase.h): hover passes only (pos) -- removed the
fictional button/action args.
- bounds/global_bounds (UIBase.h): mark (tuple, read-only).
Signatures / types:
- Grid.find_path: document heuristic + weight; get_dijkstra_map: document roots;
compute_fov: FOV | int = FOV.BASIC (not the C constant FOV_BASIC) + Returns;
at/is_in_fov: document (pos) and (x, y) call forms.
- get_metrics: document all 16 returned dict keys (was 8); bresenham: drop the
bogus '*' keyword-only separator.
- Nullable defaults typed correctly: BSP seed/size, ColorLayer draw_fov/
apply_perspective Color|None, Entity.visible_entities radius int=-1 (None is
rejected by the 'i' parser -> see #319).
- Type-token fixes: GridView.center -> Vector; GridView.texture -> (None,
read-only) (unimplemented, #318); GridPoint.grid_pos -> (tuple, read-only);
EntityCollection.find -> Entity | list[Entity] | None; extend RuntimeError;
UniformCollection.values -> list[float | tuple | None].
- automation: onScreen (x, y) form documented; scroll notes x is ignored (#317).
Also: correct stale AStarPath/DijkstraMap signatures in docs/api-audit-2026-04.md
(the bindings were right, the audit table was outdated). Rebaseline the API
snapshot golden and regenerate docs/stubs.
Code-level bugs surfaced by the pass are filed as #317, #318, #319.
Refs #314, #317, #318, #319
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 06:43:47 -04:00
|
|
|
Called with (pos: Vector) when mouse leaves this element\[cq]s bounds.
|
2026-01-23 20:49:11 -05:00
|
|
|
- \f[V]on_move\f[R]: Callback for mouse movement within bounds.
|
F15: correct docstring accuracy from adversarial verify pass (#314)
Follow-up to the macro conversion: an adversarial verify pass (one agent per
file vs. the C++ implementation + stubs) found 62 content issues; the real
ones are fixed here.
Callbacks (centralized):
- on_click: receives (pos, MouseButton, InputState), not str (8 files).
- on_enter/on_exit/on_move (UIBase.h): hover passes only (pos) -- removed the
fictional button/action args.
- bounds/global_bounds (UIBase.h): mark (tuple, read-only).
Signatures / types:
- Grid.find_path: document heuristic + weight; get_dijkstra_map: document roots;
compute_fov: FOV | int = FOV.BASIC (not the C constant FOV_BASIC) + Returns;
at/is_in_fov: document (pos) and (x, y) call forms.
- get_metrics: document all 16 returned dict keys (was 8); bresenham: drop the
bogus '*' keyword-only separator.
- Nullable defaults typed correctly: BSP seed/size, ColorLayer draw_fov/
apply_perspective Color|None, Entity.visible_entities radius int=-1 (None is
rejected by the 'i' parser -> see #319).
- Type-token fixes: GridView.center -> Vector; GridView.texture -> (None,
read-only) (unimplemented, #318); GridPoint.grid_pos -> (tuple, read-only);
EntityCollection.find -> Entity | list[Entity] | None; extend RuntimeError;
UniformCollection.values -> list[float | tuple | None].
- automation: onScreen (x, y) form documented; scroll notes x is ignored (#317).
Also: correct stale AStarPath/DijkstraMap signatures in docs/api-audit-2026-04.md
(the bindings were right, the audit table was outdated). Rebaseline the API
snapshot golden and regenerate docs/stubs.
Code-level bugs surfaced by the pass are filed as #317, #318, #319.
Refs #314, #317, #318, #319
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 06:43:47 -04:00
|
|
|
Called with (pos: Vector) for each mouse movement while inside.
|
2026-01-23 20:49:11 -05:00
|
|
|
Performance note: Called frequently during movement - keep handlers
|
|
|
|
|
fast.
|
|
|
|
|
- \f[V]opacity\f[R]: Opacity level (0.0 = transparent, 1.0 = opaque).
|
|
|
|
|
Automatically clamped to valid range [0.0, 1.0].
|
Update documentation for API changes #229, #230, #184
CLAUDE.md updates:
- Fix Python version 3.12 -> 3.14
- Update keypressScene -> scene.on_key pattern
- Add API examples for new callback signatures
- Document animation callbacks (target, prop, value)
- Document hover callbacks (position-only)
- Document enum types (Key, MouseButton, InputState)
stubs/mcrfpy.pyi updates:
- Add Key, MouseButton, InputState, Easing enum classes
- Fix Drawable hover callback signatures per #230
- Fix Grid cell callback signatures per #230
- Fix Scene.on_key signature to use enums per #184
- Update Animation class with correct callback signature per #229
- Add deprecation notes to keypressScene, setTimer, delTimer
Regenerated docs:
- API_REFERENCE_DYNAMIC.md
- api_reference_dynamic.html
- mcrfpy.3 man page
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-28 19:20:04 -05:00
|
|
|
- \f[V]origin\f[R]: Transform origin as Vector (pivot point for
|
|
|
|
|
rotation).
|
|
|
|
|
Default (0,0) is top-left; set to (w/2, h/2) to rotate around center.
|
2026-01-23 20:49:11 -05:00
|
|
|
- \f[V]parent\f[R]: Parent drawable.
|
|
|
|
|
Get: Returns the parent Frame/Grid if nested, or None if at scene level.
|
|
|
|
|
Set: Assign a Frame/Grid to reparent, or None to remove from parent.
|
|
|
|
|
- \f[V]pos\f[R]: Position as a Vector (same as center).
|
F15: convert frozen binding docstrings to MCRF_* macros (#314)
Convert 289 raw PyMethodDef/PyGetSetDef docstring slots to MCRF_METHOD /
MCRF_PROPERTY across the 20 frozen (non-3D) binding files, bringing the
frozen surface to 100% macro compliance (check_frozen_docstrings.sh PASS).
Done via a one-agent-per-file workflow gated by validate_file_docstrings.sh
and per-wave build/doc-rebuild checks.
- Adds #include "McRFPy_Doc.h" where missing; fills the lone genuine doc
gap (UIGrid.at, which was MISSING a doc field in two arrays).
- McRFPy_Doc.h: comment documenting the MCRF_METHOD_DOC comma rule (the
trap that broke the GridLayers conversion mid-run).
- Rebaseline api_surface golden: property types now resolve to real types
instead of "Any" (e.g. grid_pos: Vector, on_cell_click: Callable | None),
and 11 properties correctly flip rw->ro now that their docstrings carry
"read-only" (collections, grid_size, hovered_cell, texture, view — all
verified against NULL setter slots).
- Regenerate docs/stubs/man page from the new docstrings.
Module-level functions use MCRF_METHOD(<name>, ...) (expands identically to
the intended MCRF_FUNCTION; the audit's compliance set is METHOD/PROPERTY).
Experimental 3D/Voxel bindings (src/3d/) remain exempt from the freeze.
Pre-existing failures unrelated to this change: test_animation_*,
test_constructor_comprehensive (reference the removed mcrfpy.Animation and
old constructor arity).
Refs #314
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 01:20:55 -04:00
|
|
|
- \f[V]radius\f[R]: Arc radius in pixels (float).
|
|
|
|
|
- \f[V]rotate_with_camera\f[R]: Whether to rotate visually with parent
|
|
|
|
|
Grid\[cq]s camera_rotation (bool).
|
Update documentation for API changes #229, #230, #184
CLAUDE.md updates:
- Fix Python version 3.12 -> 3.14
- Update keypressScene -> scene.on_key pattern
- Add API examples for new callback signatures
- Document animation callbacks (target, prop, value)
- Document hover callbacks (position-only)
- Document enum types (Key, MouseButton, InputState)
stubs/mcrfpy.pyi updates:
- Add Key, MouseButton, InputState, Easing enum classes
- Fix Drawable hover callback signatures per #230
- Fix Grid cell callback signatures per #230
- Fix Scene.on_key signature to use enums per #184
- Update Animation class with correct callback signature per #229
- Add deprecation notes to keypressScene, setTimer, delTimer
Regenerated docs:
- API_REFERENCE_DYNAMIC.md
- api_reference_dynamic.html
- mcrfpy.3 man page
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-28 19:20:04 -05:00
|
|
|
False (default): stay screen-aligned.
|
|
|
|
|
True: tilt with camera.
|
|
|
|
|
Only affects children of UIGrid; ignored for other parents.
|
|
|
|
|
- \f[V]rotation\f[R]: Rotation angle in degrees (clockwise around
|
|
|
|
|
origin).
|
|
|
|
|
Animatable property.
|
F15: convert frozen binding docstrings to MCRF_* macros (#314)
Convert 289 raw PyMethodDef/PyGetSetDef docstring slots to MCRF_METHOD /
MCRF_PROPERTY across the 20 frozen (non-3D) binding files, bringing the
frozen surface to 100% macro compliance (check_frozen_docstrings.sh PASS).
Done via a one-agent-per-file workflow gated by validate_file_docstrings.sh
and per-wave build/doc-rebuild checks.
- Adds #include "McRFPy_Doc.h" where missing; fills the lone genuine doc
gap (UIGrid.at, which was MISSING a doc field in two arrays).
- McRFPy_Doc.h: comment documenting the MCRF_METHOD_DOC comma rule (the
trap that broke the GridLayers conversion mid-run).
- Rebaseline api_surface golden: property types now resolve to real types
instead of "Any" (e.g. grid_pos: Vector, on_cell_click: Callable | None),
and 11 properties correctly flip rw->ro now that their docstrings carry
"read-only" (collections, grid_size, hovered_cell, texture, view — all
verified against NULL setter slots).
- Regenerate docs/stubs/man page from the new docstrings.
Module-level functions use MCRF_METHOD(<name>, ...) (expands identically to
the intended MCRF_FUNCTION; the audit's compliance set is METHOD/PROPERTY).
Experimental 3D/Voxel bindings (src/3d/) remain exempt from the freeze.
Pre-existing failures unrelated to this change: test_animation_*,
test_constructor_comprehensive (reference the removed mcrfpy.Animation and
old constructor arity).
Refs #314
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 01:20:55 -04:00
|
|
|
- \f[V]start_angle\f[R]: Starting angle in degrees (float).
|
|
|
|
|
- \f[V]thickness\f[R]: Line thickness in pixels (float).
|
|
|
|
|
- \f[V]vert_margin\f[R]: Vertical margin override (float, 0 = use
|
|
|
|
|
general margin).
|
2026-01-23 20:49:11 -05:00
|
|
|
Invalid for horizontally-centered alignments (CENTER_LEFT, CENTER_RIGHT,
|
|
|
|
|
CENTER).
|
|
|
|
|
- \f[V]visible\f[R]: Whether the object is visible (bool).
|
|
|
|
|
Invisible objects are not rendered or clickable.
|
F15: convert frozen binding docstrings to MCRF_* macros (#314)
Convert 289 raw PyMethodDef/PyGetSetDef docstring slots to MCRF_METHOD /
MCRF_PROPERTY across the 20 frozen (non-3D) binding files, bringing the
frozen surface to 100% macro compliance (check_frozen_docstrings.sh PASS).
Done via a one-agent-per-file workflow gated by validate_file_docstrings.sh
and per-wave build/doc-rebuild checks.
- Adds #include "McRFPy_Doc.h" where missing; fills the lone genuine doc
gap (UIGrid.at, which was MISSING a doc field in two arrays).
- McRFPy_Doc.h: comment documenting the MCRF_METHOD_DOC comma rule (the
trap that broke the GridLayers conversion mid-run).
- Rebaseline api_surface golden: property types now resolve to real types
instead of "Any" (e.g. grid_pos: Vector, on_cell_click: Callable | None),
and 11 properties correctly flip rw->ro now that their docstrings carry
"read-only" (collections, grid_size, hovered_cell, texture, view — all
verified against NULL setter slots).
- Regenerate docs/stubs/man page from the new docstrings.
Module-level functions use MCRF_METHOD(<name>, ...) (expands identically to
the intended MCRF_FUNCTION; the audit's compliance set is METHOD/PROPERTY).
Experimental 3D/Voxel bindings (src/3d/) remain exempt from the freeze.
Pre-existing failures unrelated to this change: test_animation_*,
test_constructor_comprehensive (reference the removed mcrfpy.Animation and
old constructor arity).
Refs #314
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 01:20:55 -04:00
|
|
|
- \f[V]z_index\f[R]: Z-order for rendering (int, lower values rendered
|
2026-01-23 20:49:11 -05:00
|
|
|
first).
|
2025-12-02 09:21:43 -05:00
|
|
|
.PP
|
|
|
|
|
\f[B]Methods:\f[R]
|
Replace UIEntity gridstate with DiscreteMap perspective_map; closes #294
Per-entity FOV memory moves from std::vector<UIGridPointState> (two-bool
visible/discovered pairs) to a 3-state DiscreteMap (0=UNKNOWN, 1=DISCOVERED,
2=VISIBLE), exposed as entity.perspective_map. The invariant
visible-subset-of-discovered becomes structural (single value per cell), and
the map is a live, serializable, first-class object rather than an implicit
internal array.
Changes:
- New DiscreteMap C++ class with shared ownership; PyDiscreteMapObject now
holds shared_ptr<DiscreteMap>. UIEntity holds the same shared_ptr.
- New mcrfpy.Perspective IntEnum (UNKNOWN/DISCOVERED/VISIBLE), modelled on
PyInputState.
- entity.perspective_map: lazy-allocated on first access with a grid;
setter validates size against grid and raises ValueError on mismatch;
None clears (next access lazy-reallocates fresh).
- updateVisibility() now demotes 2->1 then promotes visible cells to 2.
- entity.at(x, y) returns grid.at(x, y) when VISIBLE, else None.
- Fog-of-war rendering in UIGridView and UIGrid reads the 3-state map.
- Removed: UIEntity::gridstate, ensureGridstate(), entity.gridstate getter,
UIGridPointState struct + PyUIGridPointStateType.
- Obsolete tests deleted (test_gridpointstate_point,
issue_265_gridpointstate_dangle); 4 new tests cover lazy allocation,
identity, serialization round-trip, size validation, and the
visible-subset-of-discovered invariant.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-17 23:04:27 -04:00
|
|
|
.SS \f[V]animate(property: str, target: Any, duration: float, easing=None, delta=False, loop=False, callback=None, conflict_mode=\[aq]replace\[aq]) -> Animation\f[R]
|
2025-12-02 09:21:43 -05:00
|
|
|
.PP
|
2026-01-23 20:49:11 -05:00
|
|
|
Create and start an animation on this drawable\[cq]s property.
|
2025-12-02 09:21:43 -05:00
|
|
|
.PP
|
|
|
|
|
Note:
|
|
|
|
|
.PP
|
2026-01-23 20:49:11 -05:00
|
|
|
\f[B]Arguments:\f[R] - \f[V]property\f[R]: Name of the property to
|
|
|
|
|
animate (e.g., `x', `fill_color', `opacity') - \f[V]target\f[R]: Target
|
|
|
|
|
value - type depends on property (float, tuple for color/vector, etc.)
|
|
|
|
|
- \f[V]duration\f[R]: Animation duration in seconds - \f[V]easing\f[R]:
|
|
|
|
|
Easing function: Easing enum value, string name, or None for linear -
|
|
|
|
|
\f[V]delta\f[R]: If True, target is relative to current value; if False,
|
Replace UIEntity gridstate with DiscreteMap perspective_map; closes #294
Per-entity FOV memory moves from std::vector<UIGridPointState> (two-bool
visible/discovered pairs) to a 3-state DiscreteMap (0=UNKNOWN, 1=DISCOVERED,
2=VISIBLE), exposed as entity.perspective_map. The invariant
visible-subset-of-discovered becomes structural (single value per cell), and
the map is a live, serializable, first-class object rather than an implicit
internal array.
Changes:
- New DiscreteMap C++ class with shared ownership; PyDiscreteMapObject now
holds shared_ptr<DiscreteMap>. UIEntity holds the same shared_ptr.
- New mcrfpy.Perspective IntEnum (UNKNOWN/DISCOVERED/VISIBLE), modelled on
PyInputState.
- entity.perspective_map: lazy-allocated on first access with a grid;
setter validates size against grid and raises ValueError on mismatch;
None clears (next access lazy-reallocates fresh).
- updateVisibility() now demotes 2->1 then promotes visible cells to 2.
- entity.at(x, y) returns grid.at(x, y) when VISIBLE, else None.
- Fog-of-war rendering in UIGridView and UIGrid reads the 3-state map.
- Removed: UIEntity::gridstate, ensureGridstate(), entity.gridstate getter,
UIGridPointState struct + PyUIGridPointStateType.
- Obsolete tests deleted (test_gridpointstate_point,
issue_265_gridpointstate_dangle); 4 new tests cover lazy allocation,
identity, serialization round-trip, size validation, and the
visible-subset-of-discovered invariant.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-17 23:04:27 -04:00
|
|
|
target is absolute - \f[V]loop\f[R]: If True, animation repeats from
|
|
|
|
|
start when it reaches the end (default False) - \f[V]callback\f[R]:
|
|
|
|
|
Optional callable invoked when animation completes (not called for
|
|
|
|
|
looping animations) - \f[V]conflict_mode\f[R]: `replace' (default),
|
2026-01-23 20:49:11 -05:00
|
|
|
`queue', or `error' if property already animating
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Returns:\f[R] Animation object for monitoring progress
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Raises:\f[R] ValueError: If property name is not valid for this
|
|
|
|
|
drawable type This is a convenience method that creates an Animation,
|
|
|
|
|
starts it, and adds it to the AnimationManager.
|
|
|
|
|
.SS \f[V]move(dx, dy) or (delta) -> None\f[R]
|
2025-12-02 09:21:43 -05:00
|
|
|
.PP
|
|
|
|
|
Move the element by a relative offset.
|
|
|
|
|
.PP
|
|
|
|
|
Note:
|
|
|
|
|
.PP
|
2026-01-23 20:49:11 -05:00
|
|
|
\f[B]Arguments:\f[R] - \f[V]dx\f[R]: Horizontal offset in pixels (or use
|
|
|
|
|
delta) - \f[V]dy\f[R]: Vertical offset in pixels (or use delta) -
|
|
|
|
|
\f[V]delta\f[R]: Offset as tuple, list, or Vector: (dx, dy)
|
|
|
|
|
.SS \f[V]realign() -> None\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Reapply alignment relative to parent, useful for responsive layouts.
|
|
|
|
|
.PP
|
|
|
|
|
Note: Call this to recalculate position after parent changes size.
|
|
|
|
|
For elements with align=None, this has no effect.
|
|
|
|
|
.SS \f[V]resize(width, height) or (size) -> None\f[R]
|
2025-12-02 09:21:43 -05:00
|
|
|
.PP
|
|
|
|
|
Resize the element to new dimensions.
|
|
|
|
|
.PP
|
|
|
|
|
Note:
|
|
|
|
|
.PP
|
2026-01-23 20:49:11 -05:00
|
|
|
\f[B]Arguments:\f[R] - \f[V]width\f[R]: New width in pixels (or use
|
|
|
|
|
size) - \f[V]height\f[R]: New height in pixels (or use size) -
|
|
|
|
|
\f[V]size\f[R]: Size as tuple, list, or Vector: (width, height)
|
Replace UIEntity gridstate with DiscreteMap perspective_map; closes #294
Per-entity FOV memory moves from std::vector<UIGridPointState> (two-bool
visible/discovered pairs) to a 3-state DiscreteMap (0=UNKNOWN, 1=DISCOVERED,
2=VISIBLE), exposed as entity.perspective_map. The invariant
visible-subset-of-discovered becomes structural (single value per cell), and
the map is a live, serializable, first-class object rather than an implicit
internal array.
Changes:
- New DiscreteMap C++ class with shared ownership; PyDiscreteMapObject now
holds shared_ptr<DiscreteMap>. UIEntity holds the same shared_ptr.
- New mcrfpy.Perspective IntEnum (UNKNOWN/DISCOVERED/VISIBLE), modelled on
PyInputState.
- entity.perspective_map: lazy-allocated on first access with a grid;
setter validates size against grid and raises ValueError on mismatch;
None clears (next access lazy-reallocates fresh).
- updateVisibility() now demotes 2->1 then promotes visible cells to 2.
- entity.at(x, y) returns grid.at(x, y) when VISIBLE, else None.
- Fog-of-war rendering in UIGridView and UIGrid reads the 3-state map.
- Removed: UIEntity::gridstate, ensureGridstate(), entity.gridstate getter,
UIGridPointState struct + PyUIGridPointStateType.
- Obsolete tests deleted (test_gridpointstate_point,
issue_265_gridpointstate_dangle); 4 new tests cover lazy allocation,
identity, serialization round-trip, size validation, and the
visible-subset-of-discovered invariant.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-17 23:04:27 -04:00
|
|
|
.SS AutoRuleSet
|
|
|
|
|
.PP
|
|
|
|
|
AutoRuleSet - LDtk auto-tile rule set for pattern-based terrain
|
|
|
|
|
rendering.
|
|
|
|
|
.PP
|
|
|
|
|
AutoRuleSets are obtained from LdtkProject.ruleset().
|
|
|
|
|
They map IntGrid terrain values to sprite tiles using LDtk\[cq]s
|
|
|
|
|
pattern-matching auto-rule system.
|
|
|
|
|
.PP
|
|
|
|
|
Properties: name (str, read-only): Rule set name (layer identifier).
|
|
|
|
|
grid_size (int, read-only): Cell size in pixels.
|
|
|
|
|
value_count (int, read-only): Number of IntGrid values.
|
|
|
|
|
values (list, read-only): List of value dicts.
|
|
|
|
|
rule_count (int, read-only): Total rules across all groups.
|
|
|
|
|
group_count (int, read-only): Number of rule groups.
|
|
|
|
|
.PP
|
|
|
|
|
Example: rs = project.ruleset(`Walls') Terrain = rs.terrain_enum()
|
|
|
|
|
rs.apply(discrete_map, tile_layer, seed=42)
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Properties:\f[R] - \f[V]grid_size\f[R] \f[I](read-only)\f[R]: Cell
|
|
|
|
|
size in pixels (int, read-only).
|
|
|
|
|
- \f[V]group_count\f[R] \f[I](read-only)\f[R]: Number of rule groups
|
|
|
|
|
(int, read-only).
|
|
|
|
|
- \f[V]name\f[R] \f[I](read-only)\f[R]: Rule set name / layer identifier
|
|
|
|
|
(str, read-only).
|
|
|
|
|
- \f[V]rule_count\f[R] \f[I](read-only)\f[R]: Total number of rules
|
|
|
|
|
across all groups (int, read-only).
|
|
|
|
|
- \f[V]value_count\f[R] \f[I](read-only)\f[R]: Number of IntGrid terrain
|
|
|
|
|
values (int, read-only).
|
|
|
|
|
- \f[V]values\f[R] \f[I](read-only)\f[R]: List of IntGrid value dicts
|
|
|
|
|
with value and name (read-only).
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Methods:\f[R]
|
|
|
|
|
.SS \f[V]apply(discrete_map: DiscreteMap, tile_layer: TileLayer, seed: int = 0) -> None\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Resolve auto-rules and write tile indices directly into a TileLayer.
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Arguments:\f[R] - \f[V]discrete_map\f[R]: A DiscreteMap with
|
|
|
|
|
IntGrid values - \f[V]tile_layer\f[R]: Target TileLayer to write
|
|
|
|
|
resolved tiles into - \f[V]seed\f[R]: Random seed for deterministic
|
|
|
|
|
results (default: 0)
|
|
|
|
|
.SS \f[V]resolve(discrete_map: DiscreteMap, seed: int = 0) -> list[int]\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Resolve IntGrid data to tile indices using LDtk auto-rules.
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Arguments:\f[R] - \f[V]discrete_map\f[R]: A DiscreteMap with
|
|
|
|
|
IntGrid values matching this rule set - \f[V]seed\f[R]: Random seed for
|
|
|
|
|
deterministic tile selection and probability (default: 0)
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Returns:\f[R] List of tile IDs (one per cell).
|
|
|
|
|
-1 means no matching rule.
|
|
|
|
|
.SS \f[V]terrain_enum() -> IntEnum\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Generate a Python IntEnum from this rule set\[cq]s IntGrid values.
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Returns:\f[R] IntEnum class with NONE=0 and one member per IntGrid
|
|
|
|
|
value (UPPER_SNAKE_CASE).
|
2026-01-23 20:49:11 -05:00
|
|
|
.SS BSP
|
|
|
|
|
.PP
|
|
|
|
|
BSP(pos: tuple[int, int], size: tuple[int, int])
|
|
|
|
|
.PP
|
|
|
|
|
Binary Space Partitioning tree for procedural dungeon generation.
|
|
|
|
|
.PP
|
|
|
|
|
BSP recursively divides a rectangular region into smaller sub-regions,
|
|
|
|
|
creating a tree structure perfect for generating dungeon rooms and
|
|
|
|
|
corridors.
|
|
|
|
|
.PP
|
|
|
|
|
Args: pos: (x, y) - Top-left position of the root region.
|
|
|
|
|
size: (w, h) - Width and height of the root region.
|
|
|
|
|
.PP
|
|
|
|
|
Properties: pos (tuple[int, int]): Read-only.
|
|
|
|
|
Top-left position (x, y).
|
|
|
|
|
size (tuple[int, int]): Read-only.
|
|
|
|
|
Dimensions (width, height).
|
|
|
|
|
bounds ((pos), (size)): Read-only.
|
|
|
|
|
Combined position and size.
|
|
|
|
|
root (BSPNode): Read-only.
|
|
|
|
|
Reference to the root node.
|
|
|
|
|
.PP
|
|
|
|
|
Iteration: for leaf in bsp: # Iterates over leaf nodes (rooms) len(bsp)
|
|
|
|
|
# Returns number of leaf nodes
|
|
|
|
|
.PP
|
|
|
|
|
Example: bsp = mcrfpy.BSP(pos=(0, 0), size=(80, 50))
|
|
|
|
|
bsp.split_recursive(depth=4, min_size=(8, 8)) for leaf in bsp:
|
|
|
|
|
print(f\[cq]Room at {leaf.pos}, size {leaf.size}\[cq])
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Properties:\f[R] - \f[V]adjacency\f[R] \f[I](read-only)\f[R]: Leaf
|
|
|
|
|
adjacency graph.
|
|
|
|
|
adjacency[i] returns tuple of neighbor indices.
|
|
|
|
|
Read-only.
|
|
|
|
|
- \f[V]bounds\f[R] \f[I](read-only)\f[R]: Root node bounds as ((x, y),
|
|
|
|
|
(w, h)).
|
|
|
|
|
Read-only.
|
|
|
|
|
- \f[V]pos\f[R] \f[I](read-only)\f[R]: Top-left position (x, y).
|
|
|
|
|
Read-only.
|
|
|
|
|
- \f[V]root\f[R] \f[I](read-only)\f[R]: Reference to the root BSPNode.
|
|
|
|
|
Read-only.
|
|
|
|
|
- \f[V]size\f[R] \f[I](read-only)\f[R]: Dimensions (width, height).
|
|
|
|
|
Read-only.
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Methods:\f[R]
|
|
|
|
|
.SS \f[V]clear() -> BSP\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Remove all children, keeping only the root node with original bounds.
|
|
|
|
|
WARNING: Invalidates all existing BSPNode references from this tree.
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Returns:\f[R] BSP: self, for method chaining
|
F15: correct docstring accuracy from adversarial verify pass (#314)
Follow-up to the macro conversion: an adversarial verify pass (one agent per
file vs. the C++ implementation + stubs) found 62 content issues; the real
ones are fixed here.
Callbacks (centralized):
- on_click: receives (pos, MouseButton, InputState), not str (8 files).
- on_enter/on_exit/on_move (UIBase.h): hover passes only (pos) -- removed the
fictional button/action args.
- bounds/global_bounds (UIBase.h): mark (tuple, read-only).
Signatures / types:
- Grid.find_path: document heuristic + weight; get_dijkstra_map: document roots;
compute_fov: FOV | int = FOV.BASIC (not the C constant FOV_BASIC) + Returns;
at/is_in_fov: document (pos) and (x, y) call forms.
- get_metrics: document all 16 returned dict keys (was 8); bresenham: drop the
bogus '*' keyword-only separator.
- Nullable defaults typed correctly: BSP seed/size, ColorLayer draw_fov/
apply_perspective Color|None, Entity.visible_entities radius int=-1 (None is
rejected by the 'i' parser -> see #319).
- Type-token fixes: GridView.center -> Vector; GridView.texture -> (None,
read-only) (unimplemented, #318); GridPoint.grid_pos -> (tuple, read-only);
EntityCollection.find -> Entity | list[Entity] | None; extend RuntimeError;
UniformCollection.values -> list[float | tuple | None].
- automation: onScreen (x, y) form documented; scroll notes x is ignored (#317).
Also: correct stale AStarPath/DijkstraMap signatures in docs/api-audit-2026-04.md
(the bindings were right, the audit table was outdated). Rebaseline the API
snapshot golden and regenerate docs/stubs.
Code-level bugs surfaced by the pass are filed as #317, #318, #319.
Refs #314, #317, #318, #319
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 06:43:47 -04:00
|
|
|
.SS \f[V]find(pos: tuple[int, int] | list | Vector) -> BSPNode | None\f[R]
|
2026-01-23 20:49:11 -05:00
|
|
|
.PP
|
|
|
|
|
Find the smallest (deepest) node containing the position.
|
|
|
|
|
.PP
|
F15: correct docstring accuracy from adversarial verify pass (#314)
Follow-up to the macro conversion: an adversarial verify pass (one agent per
file vs. the C++ implementation + stubs) found 62 content issues; the real
ones are fixed here.
Callbacks (centralized):
- on_click: receives (pos, MouseButton, InputState), not str (8 files).
- on_enter/on_exit/on_move (UIBase.h): hover passes only (pos) -- removed the
fictional button/action args.
- bounds/global_bounds (UIBase.h): mark (tuple, read-only).
Signatures / types:
- Grid.find_path: document heuristic + weight; get_dijkstra_map: document roots;
compute_fov: FOV | int = FOV.BASIC (not the C constant FOV_BASIC) + Returns;
at/is_in_fov: document (pos) and (x, y) call forms.
- get_metrics: document all 16 returned dict keys (was 8); bresenham: drop the
bogus '*' keyword-only separator.
- Nullable defaults typed correctly: BSP seed/size, ColorLayer draw_fov/
apply_perspective Color|None, Entity.visible_entities radius int=-1 (None is
rejected by the 'i' parser -> see #319).
- Type-token fixes: GridView.center -> Vector; GridView.texture -> (None,
read-only) (unimplemented, #318); GridPoint.grid_pos -> (tuple, read-only);
EntityCollection.find -> Entity | list[Entity] | None; extend RuntimeError;
UniformCollection.values -> list[float | tuple | None].
- automation: onScreen (x, y) form documented; scroll notes x is ignored (#317).
Also: correct stale AStarPath/DijkstraMap signatures in docs/api-audit-2026-04.md
(the bindings were right, the audit table was outdated). Rebaseline the API
snapshot golden and regenerate docs/stubs.
Code-level bugs surfaced by the pass are filed as #317, #318, #319.
Refs #314, #317, #318, #319
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 06:43:47 -04:00
|
|
|
Note:
|
|
|
|
|
.PP
|
2026-01-23 20:49:11 -05:00
|
|
|
\f[B]Arguments:\f[R] - \f[V]pos\f[R]: Position as (x, y) tuple, list, or
|
|
|
|
|
Vector
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Returns:\f[R] BSPNode if found, None if position is outside bounds
|
F15: correct docstring accuracy from adversarial verify pass (#314)
Follow-up to the macro conversion: an adversarial verify pass (one agent per
file vs. the C++ implementation + stubs) found 62 content issues; the real
ones are fixed here.
Callbacks (centralized):
- on_click: receives (pos, MouseButton, InputState), not str (8 files).
- on_enter/on_exit/on_move (UIBase.h): hover passes only (pos) -- removed the
fictional button/action args.
- bounds/global_bounds (UIBase.h): mark (tuple, read-only).
Signatures / types:
- Grid.find_path: document heuristic + weight; get_dijkstra_map: document roots;
compute_fov: FOV | int = FOV.BASIC (not the C constant FOV_BASIC) + Returns;
at/is_in_fov: document (pos) and (x, y) call forms.
- get_metrics: document all 16 returned dict keys (was 8); bresenham: drop the
bogus '*' keyword-only separator.
- Nullable defaults typed correctly: BSP seed/size, ColorLayer draw_fov/
apply_perspective Color|None, Entity.visible_entities radius int=-1 (None is
rejected by the 'i' parser -> see #319).
- Type-token fixes: GridView.center -> Vector; GridView.texture -> (None,
read-only) (unimplemented, #318); GridPoint.grid_pos -> (tuple, read-only);
EntityCollection.find -> Entity | list[Entity] | None; extend RuntimeError;
UniformCollection.values -> list[float | tuple | None].
- automation: onScreen (x, y) form documented; scroll notes x is ignored (#317).
Also: correct stale AStarPath/DijkstraMap signatures in docs/api-audit-2026-04.md
(the bindings were right, the audit table was outdated). Rebaseline the API
snapshot golden and regenerate docs/stubs.
Code-level bugs surfaced by the pass are filed as #317, #318, #319.
Refs #314, #317, #318, #319
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 06:43:47 -04:00
|
|
|
Also accepts two separate int arguments: find(x, y)
|
2026-01-23 20:49:11 -05:00
|
|
|
.SS \f[V]get_leaf(index: int) -> BSPNode\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Get a leaf node by its index (0 to len(bsp)-1).
|
|
|
|
|
This is useful when working with adjacency data, which returns leaf
|
|
|
|
|
indices.
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Arguments:\f[R] - \f[V]index\f[R]: Leaf index (0 to len(bsp)-1).
|
|
|
|
|
Negative indices supported.
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Returns:\f[R] BSPNode at the specified index
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Raises:\f[R] IndexError: If index is out of range
|
|
|
|
|
.SS \f[V]leaves() -> Iterator[BSPNode]\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Iterate all leaf nodes (the actual rooms).
|
|
|
|
|
Same as iterating the BSP directly.
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Returns:\f[R] Iterator yielding BSPNode objects
|
|
|
|
|
.SS \f[V]split_once(horizontal: bool, position: int) -> BSP\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Split the root node once at the specified position.
|
|
|
|
|
horizontal=True creates a horizontal divider, producing top/bottom
|
|
|
|
|
rooms.
|
|
|
|
|
horizontal=False creates a vertical divider, producing left/right rooms.
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Arguments:\f[R] - \f[V]horizontal\f[R]: True for horizontal divider
|
|
|
|
|
(top/bottom), False for vertical (left/right) - \f[V]position\f[R]:
|
|
|
|
|
Split coordinate (y for horizontal, x for vertical)
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Returns:\f[R] BSP: self, for method chaining
|
F15: correct docstring accuracy from adversarial verify pass (#314)
Follow-up to the macro conversion: an adversarial verify pass (one agent per
file vs. the C++ implementation + stubs) found 62 content issues; the real
ones are fixed here.
Callbacks (centralized):
- on_click: receives (pos, MouseButton, InputState), not str (8 files).
- on_enter/on_exit/on_move (UIBase.h): hover passes only (pos) -- removed the
fictional button/action args.
- bounds/global_bounds (UIBase.h): mark (tuple, read-only).
Signatures / types:
- Grid.find_path: document heuristic + weight; get_dijkstra_map: document roots;
compute_fov: FOV | int = FOV.BASIC (not the C constant FOV_BASIC) + Returns;
at/is_in_fov: document (pos) and (x, y) call forms.
- get_metrics: document all 16 returned dict keys (was 8); bresenham: drop the
bogus '*' keyword-only separator.
- Nullable defaults typed correctly: BSP seed/size, ColorLayer draw_fov/
apply_perspective Color|None, Entity.visible_entities radius int=-1 (None is
rejected by the 'i' parser -> see #319).
- Type-token fixes: GridView.center -> Vector; GridView.texture -> (None,
read-only) (unimplemented, #318); GridPoint.grid_pos -> (tuple, read-only);
EntityCollection.find -> Entity | list[Entity] | None; extend RuntimeError;
UniformCollection.values -> list[float | tuple | None].
- automation: onScreen (x, y) form documented; scroll notes x is ignored (#317).
Also: correct stale AStarPath/DijkstraMap signatures in docs/api-audit-2026-04.md
(the bindings were right, the audit table was outdated). Rebaseline the API
snapshot golden and regenerate docs/stubs.
Code-level bugs surfaced by the pass are filed as #317, #318, #319.
Refs #314, #317, #318, #319
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 06:43:47 -04:00
|
|
|
.SS \f[V]split_recursive(depth: int, min_size: tuple[int, int], max_ratio: float = 1.5, seed: int | None = None) -> BSP\f[R]
|
2026-01-23 20:49:11 -05:00
|
|
|
.PP
|
|
|
|
|
Recursively split to the specified depth.
|
|
|
|
|
WARNING: Invalidates all existing BSPNode references from this tree.
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Arguments:\f[R] - \f[V]depth\f[R]: Maximum recursion depth (1-16).
|
|
|
|
|
Creates up to 2\[ha]depth leaves.
|
|
|
|
|
- \f[V]min_size\f[R]: Minimum (width, height) for a node to be split.
|
|
|
|
|
- \f[V]max_ratio\f[R]: Maximum aspect ratio before forcing split
|
|
|
|
|
direction.
|
|
|
|
|
Default: 1.5.
|
|
|
|
|
- \f[V]seed\f[R]: Random seed.
|
|
|
|
|
None for random.
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Returns:\f[R] BSP: self, for method chaining
|
F15: correct docstring accuracy from adversarial verify pass (#314)
Follow-up to the macro conversion: an adversarial verify pass (one agent per
file vs. the C++ implementation + stubs) found 62 content issues; the real
ones are fixed here.
Callbacks (centralized):
- on_click: receives (pos, MouseButton, InputState), not str (8 files).
- on_enter/on_exit/on_move (UIBase.h): hover passes only (pos) -- removed the
fictional button/action args.
- bounds/global_bounds (UIBase.h): mark (tuple, read-only).
Signatures / types:
- Grid.find_path: document heuristic + weight; get_dijkstra_map: document roots;
compute_fov: FOV | int = FOV.BASIC (not the C constant FOV_BASIC) + Returns;
at/is_in_fov: document (pos) and (x, y) call forms.
- get_metrics: document all 16 returned dict keys (was 8); bresenham: drop the
bogus '*' keyword-only separator.
- Nullable defaults typed correctly: BSP seed/size, ColorLayer draw_fov/
apply_perspective Color|None, Entity.visible_entities radius int=-1 (None is
rejected by the 'i' parser -> see #319).
- Type-token fixes: GridView.center -> Vector; GridView.texture -> (None,
read-only) (unimplemented, #318); GridPoint.grid_pos -> (tuple, read-only);
EntityCollection.find -> Entity | list[Entity] | None; extend RuntimeError;
UniformCollection.values -> list[float | tuple | None].
- automation: onScreen (x, y) form documented; scroll notes x is ignored (#317).
Also: correct stale AStarPath/DijkstraMap signatures in docs/api-audit-2026-04.md
(the bindings were right, the audit table was outdated). Rebaseline the API
snapshot golden and regenerate docs/stubs.
Code-level bugs surfaced by the pass are filed as #317, #318, #319.
Refs #314, #317, #318, #319
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 06:43:47 -04:00
|
|
|
.SS \f[V]to_heightmap(size: tuple[int, int] | None = None, select: str = \[aq]leaves\[aq], shrink: int = 0, value: float = 1.0) -> HeightMap\f[R]
|
2026-01-23 20:49:11 -05:00
|
|
|
.PP
|
|
|
|
|
Convert BSP node selection to a HeightMap.
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Arguments:\f[R] - \f[V]size\f[R]: Output size (width, height).
|
|
|
|
|
Default: bounds size.
|
|
|
|
|
- \f[V]select\f[R]: `leaves', `all', or `internal'.
|
|
|
|
|
Default: `leaves'.
|
|
|
|
|
- \f[V]shrink\f[R]: Pixels to shrink from each node\[cq]s bounds.
|
|
|
|
|
Default: 0.
|
|
|
|
|
- \f[V]value\f[R]: Value inside selected regions.
|
|
|
|
|
Default: 1.0.
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Returns:\f[R] HeightMap with selected regions filled
|
|
|
|
|
.SS \f[V]traverse(order: Traversal = Traversal.LEVEL_ORDER) -> Iterator[BSPNode]\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Iterate all nodes in the specified order.
|
|
|
|
|
.PP
|
|
|
|
|
Note:
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Arguments:\f[R] - \f[V]order\f[R]: Traversal order from Traversal
|
|
|
|
|
enum.
|
|
|
|
|
Default: LEVEL_ORDER.
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Returns:\f[R] Iterator yielding BSPNode objects Orders: PRE_ORDER,
|
|
|
|
|
IN_ORDER, POST_ORDER, LEVEL_ORDER, INVERTED_LEVEL_ORDER
|
Replace UIEntity gridstate with DiscreteMap perspective_map; closes #294
Per-entity FOV memory moves from std::vector<UIGridPointState> (two-bool
visible/discovered pairs) to a 3-state DiscreteMap (0=UNKNOWN, 1=DISCOVERED,
2=VISIBLE), exposed as entity.perspective_map. The invariant
visible-subset-of-discovered becomes structural (single value per cell), and
the map is a live, serializable, first-class object rather than an implicit
internal array.
Changes:
- New DiscreteMap C++ class with shared ownership; PyDiscreteMapObject now
holds shared_ptr<DiscreteMap>. UIEntity holds the same shared_ptr.
- New mcrfpy.Perspective IntEnum (UNKNOWN/DISCOVERED/VISIBLE), modelled on
PyInputState.
- entity.perspective_map: lazy-allocated on first access with a grid;
setter validates size against grid and raises ValueError on mismatch;
None clears (next access lazy-reallocates fresh).
- updateVisibility() now demotes 2->1 then promotes visible cells to 2.
- entity.at(x, y) returns grid.at(x, y) when VISIBLE, else None.
- Fog-of-war rendering in UIGridView and UIGrid reads the 3-state map.
- Removed: UIEntity::gridstate, ensureGridstate(), entity.gridstate getter,
UIGridPointState struct + PyUIGridPointStateType.
- Obsolete tests deleted (test_gridpointstate_point,
issue_265_gridpointstate_dangle); 4 new tests cover lazy allocation,
identity, serialization round-trip, size validation, and the
visible-subset-of-discovered invariant.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-17 23:04:27 -04:00
|
|
|
.SS Behavior
|
|
|
|
|
.PP
|
|
|
|
|
\f[I]Inherits from: IntEnum\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Enum representing entity behavior types for grid.step() turn management.
|
|
|
|
|
.PP
|
|
|
|
|
Values: IDLE: No action each turn CUSTOM: Calls step callback only, no
|
|
|
|
|
built-in movement NOISE4: Random movement in 4 cardinal directions
|
|
|
|
|
NOISE8: Random movement in 8 directions (incl.\ diagonals) PATH: Follow
|
|
|
|
|
a precomputed path to completion WAYPOINT: Path through a sequence of
|
|
|
|
|
waypoints in order PATROL: Patrol waypoints back and forth (reversing at
|
|
|
|
|
ends) LOOP: Loop through waypoints cyclically SLEEP: Wait for N turns,
|
|
|
|
|
then trigger DONE SEEK: Move toward target using Dijkstra map FLEE: Move
|
|
|
|
|
away from target using Dijkstra map
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Properties:\f[R] - \f[V]denominator\f[R]: the denominator of a
|
|
|
|
|
rational number in lowest terms - \f[V]imag\f[R]: the imaginary part of
|
|
|
|
|
a complex number - \f[V]numerator\f[R]: the numerator of a rational
|
|
|
|
|
number in lowest terms - \f[V]real\f[R]: the real part of a complex
|
|
|
|
|
number
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Methods:\f[R]
|
|
|
|
|
.SS \f[V]as_integer_ratio(...)\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Return a pair of integers, whose ratio is equal to the original int.
|
|
|
|
|
The ratio is in lowest terms and has a positive denominator.
|
|
|
|
|
>>> (10).as_integer_ratio() (10, 1) >>> (-10).as_integer_ratio() (-10,
|
|
|
|
|
1) >>> (0).as_integer_ratio() (0, 1)
|
|
|
|
|
.SS \f[V]bit_count(...)\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Number of ones in the binary representation of the absolute value of
|
|
|
|
|
self.
|
|
|
|
|
Also known as the population count.
|
|
|
|
|
>>> bin(13) `0b1101' >>> (13).bit_count() 3
|
|
|
|
|
.SS \f[V]bit_length(...)\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Number of bits necessary to represent self in binary.
|
|
|
|
|
>>> bin(37) `0b100101' >>> (37).bit_length() 6
|
|
|
|
|
.SS \f[V]conjugate(...)\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Returns self, the complex conjugate of any int.
|
|
|
|
|
.SS \f[V]from_bytes(...)\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Return the integer represented by the given array of bytes.
|
|
|
|
|
bytes Holds the array of bytes to convert.
|
|
|
|
|
The argument must either support the buffer protocol or be an iterable
|
|
|
|
|
object producing bytes.
|
|
|
|
|
Bytes and bytearray are examples of built-in objects that support the
|
|
|
|
|
buffer protocol.
|
|
|
|
|
byteorder The byte order used to represent the integer.
|
|
|
|
|
If byteorder is `big', the most significant byte is at the beginning of
|
|
|
|
|
the byte array.
|
|
|
|
|
If byteorder is `little', the most significant byte is at the end of the
|
|
|
|
|
byte array.
|
|
|
|
|
To request the native byte order of the host system, use sys.byteorder
|
|
|
|
|
as the byte order value.
|
|
|
|
|
Default is to use `big'.
|
|
|
|
|
signed Indicates whether two\[cq]s complement is used to represent the
|
|
|
|
|
integer.
|
|
|
|
|
.SS \f[V]is_integer(...)\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Returns True.
|
|
|
|
|
Exists for duck type compatibility with float.is_integer.
|
|
|
|
|
.SS \f[V]to_bytes(...)\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Return an array of bytes representing an integer.
|
|
|
|
|
length Length of bytes object to use.
|
|
|
|
|
An OverflowError is raised if the integer is not representable with the
|
|
|
|
|
given number of bytes.
|
|
|
|
|
Default is length 1.
|
|
|
|
|
byteorder The byte order used to represent the integer.
|
|
|
|
|
If byteorder is `big', the most significant byte is at the beginning of
|
|
|
|
|
the byte array.
|
|
|
|
|
If byteorder is `little', the most significant byte is at the end of the
|
|
|
|
|
byte array.
|
|
|
|
|
To request the native byte order of the host system, use sys.byteorder
|
|
|
|
|
as the byte order value.
|
|
|
|
|
Default is to use `big'.
|
|
|
|
|
signed Determines whether two\[cq]s complement is used to represent the
|
|
|
|
|
integer.
|
|
|
|
|
If signed is False and a negative integer is given, an OverflowError is
|
|
|
|
|
raised.
|
|
|
|
|
.SS Billboard
|
|
|
|
|
.PP
|
|
|
|
|
Billboard(texture=None, sprite_index=0, pos=(0,0,0), scale=1.0,
|
|
|
|
|
facing=`camera_y')
|
|
|
|
|
.PP
|
|
|
|
|
A camera-facing 3D sprite for trees, items, particles, etc.
|
|
|
|
|
.PP
|
|
|
|
|
Args: texture (Texture, optional): Sprite sheet texture.
|
|
|
|
|
Default: None sprite_index (int): Index into sprite sheet.
|
|
|
|
|
Default: 0 pos (tuple): World position (x, y, z).
|
|
|
|
|
Default: (0, 0, 0) scale (float): Uniform scale factor.
|
|
|
|
|
Default: 1.0 facing (str): Facing mode - `camera', `camera_y', or
|
|
|
|
|
`fixed'.
|
|
|
|
|
Default: `camera_y'
|
|
|
|
|
.PP
|
|
|
|
|
Properties: texture (Texture): Sprite sheet texture sprite_index (int):
|
|
|
|
|
Index into sprite sheet pos (tuple): World position (x, y, z) scale
|
|
|
|
|
(float): Uniform scale factor facing (str): Facing mode - `camera',
|
|
|
|
|
`camera_y', or `fixed' theta (float): Horizontal rotation for `fixed'
|
|
|
|
|
mode (radians) phi (float): Vertical tilt for `fixed' mode (radians)
|
|
|
|
|
opacity (float): Opacity 0.0 (transparent) to 1.0 (opaque) visible
|
|
|
|
|
(bool): Visibility state
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Properties:\f[R] - \f[V]facing\f[R]: Facing mode: `camera',
|
|
|
|
|
`camera_y', or `fixed' (str) - \f[V]opacity\f[R]: Opacity from 0.0
|
|
|
|
|
(transparent) to 1.0 (opaque) (float) - \f[V]phi\f[R]: Vertical tilt for
|
|
|
|
|
`fixed' mode in radians (float) - \f[V]pos\f[R]: World position as (x,
|
|
|
|
|
y, z) tuple - \f[V]scale\f[R]: Uniform scale factor (float) -
|
|
|
|
|
\f[V]sprite_index\f[R]: Index into sprite sheet (int) -
|
|
|
|
|
\f[V]texture\f[R]: Sprite sheet texture (Texture or None) -
|
|
|
|
|
\f[V]theta\f[R]: Horizontal rotation for `fixed' mode in radians (float)
|
|
|
|
|
- \f[V]visible\f[R]: Visibility state (bool)
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Methods:\f[R]
|
Update documentation for API changes #229, #230, #184
CLAUDE.md updates:
- Fix Python version 3.12 -> 3.14
- Update keypressScene -> scene.on_key pattern
- Add API examples for new callback signatures
- Document animation callbacks (target, prop, value)
- Document hover callbacks (position-only)
- Document enum types (Key, MouseButton, InputState)
stubs/mcrfpy.pyi updates:
- Add Key, MouseButton, InputState, Easing enum classes
- Fix Drawable hover callback signatures per #230
- Fix Grid cell callback signatures per #230
- Fix Scene.on_key signature to use enums per #184
- Update Animation class with correct callback signature per #229
- Add deprecation notes to keypressScene, setTimer, delTimer
Regenerated docs:
- API_REFERENCE_DYNAMIC.md
- api_reference_dynamic.html
- mcrfpy.3 man page
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-28 19:20:04 -05:00
|
|
|
.SS CallableBinding
|
|
|
|
|
.PP
|
|
|
|
|
CallableBinding(callable: Callable[[], float])
|
|
|
|
|
.PP
|
|
|
|
|
A binding that calls a Python function to get its value.
|
|
|
|
|
.PP
|
|
|
|
|
Args: callable: A function that takes no arguments and returns a float
|
|
|
|
|
.PP
|
|
|
|
|
The callable is invoked every frame when the shader is rendered.
|
|
|
|
|
Keep the callable lightweight to avoid performance issues.
|
|
|
|
|
.PP
|
|
|
|
|
Example: player_health = 100 frame.uniforms[`health_pct'] =
|
|
|
|
|
mcrfpy.CallableBinding( lambda: player_health / 100.0 )
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Properties:\f[R] - \f[V]callable\f[R] \f[I](read-only)\f[R]: The
|
|
|
|
|
Python callable (read-only).
|
|
|
|
|
- \f[V]is_valid\f[R] \f[I](read-only)\f[R]: True if the callable is
|
|
|
|
|
still valid (bool, read-only).
|
|
|
|
|
- \f[V]value\f[R] \f[I](read-only)\f[R]: Current value from calling the
|
|
|
|
|
callable (float, read-only).
|
|
|
|
|
Returns None on error.
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Methods:\f[R]
|
2025-10-30 21:20:50 -04:00
|
|
|
.SS Caption
|
|
|
|
|
.PP
|
|
|
|
|
\f[I]Inherits from: Drawable\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Caption(pos=None, font=None, text=\[cq]\[cq], **kwargs)
|
|
|
|
|
.PP
|
|
|
|
|
A text display UI element with customizable font and styling.
|
|
|
|
|
.PP
|
|
|
|
|
Args: pos (tuple, optional): Position as (x, y) tuple.
|
|
|
|
|
Default: (0, 0) font (Font, optional): Font object for text rendering.
|
|
|
|
|
Default: engine default font text (str, optional): The text content to
|
|
|
|
|
display.
|
|
|
|
|
Default: \[cq]\[cq]
|
|
|
|
|
.PP
|
|
|
|
|
Keyword Args: fill_color (Color): Text fill color.
|
|
|
|
|
Default: (255, 255, 255, 255) outline_color (Color): Text outline color.
|
|
|
|
|
Default: (0, 0, 0, 255) outline (float): Text outline thickness.
|
|
|
|
|
Default: 0 font_size (float): Font size in points.
|
|
|
|
|
Default: 16 click (callable): Click event handler.
|
|
|
|
|
Default: None visible (bool): Visibility state.
|
|
|
|
|
Default: True opacity (float): Opacity (0.0-1.0).
|
|
|
|
|
Default: 1.0 z_index (int): Rendering order.
|
|
|
|
|
Default: 0 name (str): Element name for finding.
|
|
|
|
|
Default: None x (float): X position override.
|
|
|
|
|
Default: 0 y (float): Y position override.
|
2026-01-23 20:49:11 -05:00
|
|
|
Default: 0 align (Alignment): Alignment relative to parent.
|
|
|
|
|
Default: None margin (float): Margin from parent edge when aligned.
|
|
|
|
|
Default: 0 horiz_margin (float): Horizontal margin override.
|
|
|
|
|
Default: 0 (use margin) vert_margin (float): Vertical margin override.
|
|
|
|
|
Default: 0 (use margin)
|
2025-10-30 21:20:50 -04:00
|
|
|
.PP
|
|
|
|
|
Attributes: text (str): The displayed text content x, y (float):
|
|
|
|
|
Position in pixels pos (Vector): Position as a Vector object font
|
|
|
|
|
(Font): Font used for rendering font_size (float): Font size in points
|
|
|
|
|
fill_color, outline_color (Color): Text appearance outline (float):
|
|
|
|
|
Outline thickness click (callable): Click event handler visible (bool):
|
|
|
|
|
Visibility state opacity (float): Opacity value z_index (int): Rendering
|
|
|
|
|
order name (str): Element name w, h (float): Read-only computed size
|
2026-01-23 20:49:11 -05:00
|
|
|
based on text and font align (Alignment): Alignment relative to parent
|
|
|
|
|
(or None) margin (float): General margin for alignment horiz_margin
|
|
|
|
|
(float): Horizontal margin override vert_margin (float): Vertical margin
|
|
|
|
|
override
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Properties:\f[R] - \f[V]align\f[R]: Alignment relative to parent
|
|
|
|
|
bounds (Alignment enum or None).
|
|
|
|
|
When set, position is automatically calculated when parent is assigned
|
|
|
|
|
or resized.
|
|
|
|
|
Set to None to disable alignment and use manual positioning.
|
F15: correct docstring accuracy from adversarial verify pass (#314)
Follow-up to the macro conversion: an adversarial verify pass (one agent per
file vs. the C++ implementation + stubs) found 62 content issues; the real
ones are fixed here.
Callbacks (centralized):
- on_click: receives (pos, MouseButton, InputState), not str (8 files).
- on_enter/on_exit/on_move (UIBase.h): hover passes only (pos) -- removed the
fictional button/action args.
- bounds/global_bounds (UIBase.h): mark (tuple, read-only).
Signatures / types:
- Grid.find_path: document heuristic + weight; get_dijkstra_map: document roots;
compute_fov: FOV | int = FOV.BASIC (not the C constant FOV_BASIC) + Returns;
at/is_in_fov: document (pos) and (x, y) call forms.
- get_metrics: document all 16 returned dict keys (was 8); bresenham: drop the
bogus '*' keyword-only separator.
- Nullable defaults typed correctly: BSP seed/size, ColorLayer draw_fov/
apply_perspective Color|None, Entity.visible_entities radius int=-1 (None is
rejected by the 'i' parser -> see #319).
- Type-token fixes: GridView.center -> Vector; GridView.texture -> (None,
read-only) (unimplemented, #318); GridPoint.grid_pos -> (tuple, read-only);
EntityCollection.find -> Entity | list[Entity] | None; extend RuntimeError;
UniformCollection.values -> list[float | tuple | None].
- automation: onScreen (x, y) form documented; scroll notes x is ignored (#317).
Also: correct stale AStarPath/DijkstraMap signatures in docs/api-audit-2026-04.md
(the bindings were right, the audit table was outdated). Rebaseline the API
snapshot golden and regenerate docs/stubs.
Code-level bugs surfaced by the pass are filed as #317, #318, #319.
Refs #314, #317, #318, #319
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 06:43:47 -04:00
|
|
|
- \f[V]bounds\f[R] \f[I](read-only)\f[R]: Axis-aligned bounding box
|
|
|
|
|
(tuple, read-only) as a (pos, size) pair of Vectors: (Vector(x, y),
|
|
|
|
|
Vector(width, height)).
|
F15: convert frozen binding docstrings to MCRF_* macros (#314)
Convert 289 raw PyMethodDef/PyGetSetDef docstring slots to MCRF_METHOD /
MCRF_PROPERTY across the 20 frozen (non-3D) binding files, bringing the
frozen surface to 100% macro compliance (check_frozen_docstrings.sh PASS).
Done via a one-agent-per-file workflow gated by validate_file_docstrings.sh
and per-wave build/doc-rebuild checks.
- Adds #include "McRFPy_Doc.h" where missing; fills the lone genuine doc
gap (UIGrid.at, which was MISSING a doc field in two arrays).
- McRFPy_Doc.h: comment documenting the MCRF_METHOD_DOC comma rule (the
trap that broke the GridLayers conversion mid-run).
- Rebaseline api_surface golden: property types now resolve to real types
instead of "Any" (e.g. grid_pos: Vector, on_cell_click: Callable | None),
and 11 properties correctly flip rw->ro now that their docstrings carry
"read-only" (collections, grid_size, hovered_cell, texture, view — all
verified against NULL setter slots).
- Regenerate docs/stubs/man page from the new docstrings.
Module-level functions use MCRF_METHOD(<name>, ...) (expands identically to
the intended MCRF_FUNCTION; the audit's compliance set is METHOD/PROPERTY).
Experimental 3D/Voxel bindings (src/3d/) remain exempt from the freeze.
Pre-existing failures unrelated to this change: test_animation_*,
test_constructor_comprehensive (reference the removed mcrfpy.Animation and
old constructor arity).
Refs #314
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 01:20:55 -04:00
|
|
|
- \f[V]fill_color\f[R]: Fill color of the text (Color).
|
2026-01-23 20:49:11 -05:00
|
|
|
Returns a copy; modifying components requires reassignment.
|
|
|
|
|
For animation, use `fill_color.r', `fill_color.g', etc.
|
F15: convert frozen binding docstrings to MCRF_* macros (#314)
Convert 289 raw PyMethodDef/PyGetSetDef docstring slots to MCRF_METHOD /
MCRF_PROPERTY across the 20 frozen (non-3D) binding files, bringing the
frozen surface to 100% macro compliance (check_frozen_docstrings.sh PASS).
Done via a one-agent-per-file workflow gated by validate_file_docstrings.sh
and per-wave build/doc-rebuild checks.
- Adds #include "McRFPy_Doc.h" where missing; fills the lone genuine doc
gap (UIGrid.at, which was MISSING a doc field in two arrays).
- McRFPy_Doc.h: comment documenting the MCRF_METHOD_DOC comma rule (the
trap that broke the GridLayers conversion mid-run).
- Rebaseline api_surface golden: property types now resolve to real types
instead of "Any" (e.g. grid_pos: Vector, on_cell_click: Callable | None),
and 11 properties correctly flip rw->ro now that their docstrings carry
"read-only" (collections, grid_size, hovered_cell, texture, view — all
verified against NULL setter slots).
- Regenerate docs/stubs/man page from the new docstrings.
Module-level functions use MCRF_METHOD(<name>, ...) (expands identically to
the intended MCRF_FUNCTION; the audit's compliance set is METHOD/PROPERTY).
Experimental 3D/Voxel bindings (src/3d/) remain exempt from the freeze.
Pre-existing failures unrelated to this change: test_animation_*,
test_constructor_comprehensive (reference the removed mcrfpy.Animation and
old constructor arity).
Refs #314
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 01:20:55 -04:00
|
|
|
- \f[V]font_size\f[R]: Font size in points (int).
|
|
|
|
|
Clamped to the range [0, 65535].
|
F15: correct docstring accuracy from adversarial verify pass (#314)
Follow-up to the macro conversion: an adversarial verify pass (one agent per
file vs. the C++ implementation + stubs) found 62 content issues; the real
ones are fixed here.
Callbacks (centralized):
- on_click: receives (pos, MouseButton, InputState), not str (8 files).
- on_enter/on_exit/on_move (UIBase.h): hover passes only (pos) -- removed the
fictional button/action args.
- bounds/global_bounds (UIBase.h): mark (tuple, read-only).
Signatures / types:
- Grid.find_path: document heuristic + weight; get_dijkstra_map: document roots;
compute_fov: FOV | int = FOV.BASIC (not the C constant FOV_BASIC) + Returns;
at/is_in_fov: document (pos) and (x, y) call forms.
- get_metrics: document all 16 returned dict keys (was 8); bresenham: drop the
bogus '*' keyword-only separator.
- Nullable defaults typed correctly: BSP seed/size, ColorLayer draw_fov/
apply_perspective Color|None, Entity.visible_entities radius int=-1 (None is
rejected by the 'i' parser -> see #319).
- Type-token fixes: GridView.center -> Vector; GridView.texture -> (None,
read-only) (unimplemented, #318); GridPoint.grid_pos -> (tuple, read-only);
EntityCollection.find -> Entity | list[Entity] | None; extend RuntimeError;
UniformCollection.values -> list[float | tuple | None].
- automation: onScreen (x, y) form documented; scroll notes x is ignored (#317).
Also: correct stale AStarPath/DijkstraMap signatures in docs/api-audit-2026-04.md
(the bindings were right, the audit table was outdated). Rebaseline the API
snapshot golden and regenerate docs/stubs.
Code-level bugs surfaced by the pass are filed as #317, #318, #319.
Refs #314, #317, #318, #319
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 06:43:47 -04:00
|
|
|
- \f[V]global_bounds\f[R] \f[I](read-only)\f[R]: Axis-aligned bounding
|
|
|
|
|
box in screen coordinates (tuple, read-only) as a (pos, size) pair of
|
|
|
|
|
Vectors: (Vector(x, y), Vector(width, height)).
|
2026-01-23 20:49:11 -05:00
|
|
|
- \f[V]global_position\f[R] \f[I](read-only)\f[R]: Global screen
|
|
|
|
|
position (read-only).
|
|
|
|
|
Calculates absolute position by walking up the parent chain.
|
F15: convert frozen binding docstrings to MCRF_* macros (#314)
Convert 289 raw PyMethodDef/PyGetSetDef docstring slots to MCRF_METHOD /
MCRF_PROPERTY across the 20 frozen (non-3D) binding files, bringing the
frozen surface to 100% macro compliance (check_frozen_docstrings.sh PASS).
Done via a one-agent-per-file workflow gated by validate_file_docstrings.sh
and per-wave build/doc-rebuild checks.
- Adds #include "McRFPy_Doc.h" where missing; fills the lone genuine doc
gap (UIGrid.at, which was MISSING a doc field in two arrays).
- McRFPy_Doc.h: comment documenting the MCRF_METHOD_DOC comma rule (the
trap that broke the GridLayers conversion mid-run).
- Rebaseline api_surface golden: property types now resolve to real types
instead of "Any" (e.g. grid_pos: Vector, on_cell_click: Callable | None),
and 11 properties correctly flip rw->ro now that their docstrings carry
"read-only" (collections, grid_size, hovered_cell, texture, view — all
verified against NULL setter slots).
- Regenerate docs/stubs/man page from the new docstrings.
Module-level functions use MCRF_METHOD(<name>, ...) (expands identically to
the intended MCRF_FUNCTION; the audit's compliance set is METHOD/PROPERTY).
Experimental 3D/Voxel bindings (src/3d/) remain exempt from the freeze.
Pre-existing failures unrelated to this change: test_animation_*,
test_constructor_comprehensive (reference the removed mcrfpy.Animation and
old constructor arity).
Refs #314
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 01:20:55 -04:00
|
|
|
- \f[V]grid_pos\f[R]: Position in grid tile coordinates (Vector).
|
|
|
|
|
Only valid when parent is a Grid.
|
|
|
|
|
- \f[V]grid_size\f[R]: Size in grid tile coordinates (Vector).
|
|
|
|
|
Only valid when parent is a Grid.
|
|
|
|
|
- \f[V]h\f[R] \f[I](read-only)\f[R]: Text height in pixels (float,
|
|
|
|
|
read-only).
|
|
|
|
|
- \f[V]horiz_margin\f[R]: Horizontal margin override (float, 0 = use
|
|
|
|
|
general margin).
|
2026-01-23 20:49:11 -05:00
|
|
|
Invalid for vertically-centered alignments (TOP_CENTER, BOTTOM_CENTER,
|
|
|
|
|
CENTER).
|
|
|
|
|
- \f[V]hovered\f[R] \f[I](read-only)\f[R]: Whether mouse is currently
|
|
|
|
|
over this element (read-only).
|
|
|
|
|
Updated automatically by the engine during mouse movement.
|
|
|
|
|
- \f[V]margin\f[R]: General margin from edge when aligned (float).
|
|
|
|
|
Applied to both horizontal and vertical edges unless overridden.
|
|
|
|
|
Invalid for CENTER alignment (raises ValueError).
|
F15: convert frozen binding docstrings to MCRF_* macros (#314)
Convert 289 raw PyMethodDef/PyGetSetDef docstring slots to MCRF_METHOD /
MCRF_PROPERTY across the 20 frozen (non-3D) binding files, bringing the
frozen surface to 100% macro compliance (check_frozen_docstrings.sh PASS).
Done via a one-agent-per-file workflow gated by validate_file_docstrings.sh
and per-wave build/doc-rebuild checks.
- Adds #include "McRFPy_Doc.h" where missing; fills the lone genuine doc
gap (UIGrid.at, which was MISSING a doc field in two arrays).
- McRFPy_Doc.h: comment documenting the MCRF_METHOD_DOC comma rule (the
trap that broke the GridLayers conversion mid-run).
- Rebaseline api_surface golden: property types now resolve to real types
instead of "Any" (e.g. grid_pos: Vector, on_cell_click: Callable | None),
and 11 properties correctly flip rw->ro now that their docstrings carry
"read-only" (collections, grid_size, hovered_cell, texture, view — all
verified against NULL setter slots).
- Regenerate docs/stubs/man page from the new docstrings.
Module-level functions use MCRF_METHOD(<name>, ...) (expands identically to
the intended MCRF_FUNCTION; the audit's compliance set is METHOD/PROPERTY).
Experimental 3D/Voxel bindings (src/3d/) remain exempt from the freeze.
Pre-existing failures unrelated to this change: test_animation_*,
test_constructor_comprehensive (reference the removed mcrfpy.Animation and
old constructor arity).
Refs #314
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 01:20:55 -04:00
|
|
|
- \f[V]name\f[R]: Name for finding elements (str).
|
|
|
|
|
- \f[V]on_click\f[R]: Callable executed when object is clicked.
|
F15: correct docstring accuracy from adversarial verify pass (#314)
Follow-up to the macro conversion: an adversarial verify pass (one agent per
file vs. the C++ implementation + stubs) found 62 content issues; the real
ones are fixed here.
Callbacks (centralized):
- on_click: receives (pos, MouseButton, InputState), not str (8 files).
- on_enter/on_exit/on_move (UIBase.h): hover passes only (pos) -- removed the
fictional button/action args.
- bounds/global_bounds (UIBase.h): mark (tuple, read-only).
Signatures / types:
- Grid.find_path: document heuristic + weight; get_dijkstra_map: document roots;
compute_fov: FOV | int = FOV.BASIC (not the C constant FOV_BASIC) + Returns;
at/is_in_fov: document (pos) and (x, y) call forms.
- get_metrics: document all 16 returned dict keys (was 8); bresenham: drop the
bogus '*' keyword-only separator.
- Nullable defaults typed correctly: BSP seed/size, ColorLayer draw_fov/
apply_perspective Color|None, Entity.visible_entities radius int=-1 (None is
rejected by the 'i' parser -> see #319).
- Type-token fixes: GridView.center -> Vector; GridView.texture -> (None,
read-only) (unimplemented, #318); GridPoint.grid_pos -> (tuple, read-only);
EntityCollection.find -> Entity | list[Entity] | None; extend RuntimeError;
UniformCollection.values -> list[float | tuple | None].
- automation: onScreen (x, y) form documented; scroll notes x is ignored (#317).
Also: correct stale AStarPath/DijkstraMap signatures in docs/api-audit-2026-04.md
(the bindings were right, the audit table was outdated). Rebaseline the API
snapshot golden and regenerate docs/stubs.
Code-level bugs surfaced by the pass are filed as #317, #318, #319.
Refs #314, #317, #318, #319
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 06:43:47 -04:00
|
|
|
Function receives (pos: Vector, button: MouseButton, action:
|
|
|
|
|
InputState).
|
2026-01-23 20:49:11 -05:00
|
|
|
- \f[V]on_enter\f[R]: Callback for mouse enter events.
|
F15: correct docstring accuracy from adversarial verify pass (#314)
Follow-up to the macro conversion: an adversarial verify pass (one agent per
file vs. the C++ implementation + stubs) found 62 content issues; the real
ones are fixed here.
Callbacks (centralized):
- on_click: receives (pos, MouseButton, InputState), not str (8 files).
- on_enter/on_exit/on_move (UIBase.h): hover passes only (pos) -- removed the
fictional button/action args.
- bounds/global_bounds (UIBase.h): mark (tuple, read-only).
Signatures / types:
- Grid.find_path: document heuristic + weight; get_dijkstra_map: document roots;
compute_fov: FOV | int = FOV.BASIC (not the C constant FOV_BASIC) + Returns;
at/is_in_fov: document (pos) and (x, y) call forms.
- get_metrics: document all 16 returned dict keys (was 8); bresenham: drop the
bogus '*' keyword-only separator.
- Nullable defaults typed correctly: BSP seed/size, ColorLayer draw_fov/
apply_perspective Color|None, Entity.visible_entities radius int=-1 (None is
rejected by the 'i' parser -> see #319).
- Type-token fixes: GridView.center -> Vector; GridView.texture -> (None,
read-only) (unimplemented, #318); GridPoint.grid_pos -> (tuple, read-only);
EntityCollection.find -> Entity | list[Entity] | None; extend RuntimeError;
UniformCollection.values -> list[float | tuple | None].
- automation: onScreen (x, y) form documented; scroll notes x is ignored (#317).
Also: correct stale AStarPath/DijkstraMap signatures in docs/api-audit-2026-04.md
(the bindings were right, the audit table was outdated). Rebaseline the API
snapshot golden and regenerate docs/stubs.
Code-level bugs surfaced by the pass are filed as #317, #318, #319.
Refs #314, #317, #318, #319
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 06:43:47 -04:00
|
|
|
Called with (pos: Vector) when mouse enters this element\[cq]s bounds.
|
2026-01-23 20:49:11 -05:00
|
|
|
- \f[V]on_exit\f[R]: Callback for mouse exit events.
|
F15: correct docstring accuracy from adversarial verify pass (#314)
Follow-up to the macro conversion: an adversarial verify pass (one agent per
file vs. the C++ implementation + stubs) found 62 content issues; the real
ones are fixed here.
Callbacks (centralized):
- on_click: receives (pos, MouseButton, InputState), not str (8 files).
- on_enter/on_exit/on_move (UIBase.h): hover passes only (pos) -- removed the
fictional button/action args.
- bounds/global_bounds (UIBase.h): mark (tuple, read-only).
Signatures / types:
- Grid.find_path: document heuristic + weight; get_dijkstra_map: document roots;
compute_fov: FOV | int = FOV.BASIC (not the C constant FOV_BASIC) + Returns;
at/is_in_fov: document (pos) and (x, y) call forms.
- get_metrics: document all 16 returned dict keys (was 8); bresenham: drop the
bogus '*' keyword-only separator.
- Nullable defaults typed correctly: BSP seed/size, ColorLayer draw_fov/
apply_perspective Color|None, Entity.visible_entities radius int=-1 (None is
rejected by the 'i' parser -> see #319).
- Type-token fixes: GridView.center -> Vector; GridView.texture -> (None,
read-only) (unimplemented, #318); GridPoint.grid_pos -> (tuple, read-only);
EntityCollection.find -> Entity | list[Entity] | None; extend RuntimeError;
UniformCollection.values -> list[float | tuple | None].
- automation: onScreen (x, y) form documented; scroll notes x is ignored (#317).
Also: correct stale AStarPath/DijkstraMap signatures in docs/api-audit-2026-04.md
(the bindings were right, the audit table was outdated). Rebaseline the API
snapshot golden and regenerate docs/stubs.
Code-level bugs surfaced by the pass are filed as #317, #318, #319.
Refs #314, #317, #318, #319
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 06:43:47 -04:00
|
|
|
Called with (pos: Vector) when mouse leaves this element\[cq]s bounds.
|
2026-01-23 20:49:11 -05:00
|
|
|
- \f[V]on_move\f[R]: Callback for mouse movement within bounds.
|
F15: correct docstring accuracy from adversarial verify pass (#314)
Follow-up to the macro conversion: an adversarial verify pass (one agent per
file vs. the C++ implementation + stubs) found 62 content issues; the real
ones are fixed here.
Callbacks (centralized):
- on_click: receives (pos, MouseButton, InputState), not str (8 files).
- on_enter/on_exit/on_move (UIBase.h): hover passes only (pos) -- removed the
fictional button/action args.
- bounds/global_bounds (UIBase.h): mark (tuple, read-only).
Signatures / types:
- Grid.find_path: document heuristic + weight; get_dijkstra_map: document roots;
compute_fov: FOV | int = FOV.BASIC (not the C constant FOV_BASIC) + Returns;
at/is_in_fov: document (pos) and (x, y) call forms.
- get_metrics: document all 16 returned dict keys (was 8); bresenham: drop the
bogus '*' keyword-only separator.
- Nullable defaults typed correctly: BSP seed/size, ColorLayer draw_fov/
apply_perspective Color|None, Entity.visible_entities radius int=-1 (None is
rejected by the 'i' parser -> see #319).
- Type-token fixes: GridView.center -> Vector; GridView.texture -> (None,
read-only) (unimplemented, #318); GridPoint.grid_pos -> (tuple, read-only);
EntityCollection.find -> Entity | list[Entity] | None; extend RuntimeError;
UniformCollection.values -> list[float | tuple | None].
- automation: onScreen (x, y) form documented; scroll notes x is ignored (#317).
Also: correct stale AStarPath/DijkstraMap signatures in docs/api-audit-2026-04.md
(the bindings were right, the audit table was outdated). Rebaseline the API
snapshot golden and regenerate docs/stubs.
Code-level bugs surfaced by the pass are filed as #317, #318, #319.
Refs #314, #317, #318, #319
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 06:43:47 -04:00
|
|
|
Called with (pos: Vector) for each mouse movement while inside.
|
2026-01-23 20:49:11 -05:00
|
|
|
Performance note: Called frequently during movement - keep handlers
|
|
|
|
|
fast.
|
|
|
|
|
- \f[V]opacity\f[R]: Opacity level (0.0 = transparent, 1.0 = opaque).
|
|
|
|
|
Automatically clamped to valid range [0.0, 1.0].
|
Update documentation for API changes #229, #230, #184
CLAUDE.md updates:
- Fix Python version 3.12 -> 3.14
- Update keypressScene -> scene.on_key pattern
- Add API examples for new callback signatures
- Document animation callbacks (target, prop, value)
- Document hover callbacks (position-only)
- Document enum types (Key, MouseButton, InputState)
stubs/mcrfpy.pyi updates:
- Add Key, MouseButton, InputState, Easing enum classes
- Fix Drawable hover callback signatures per #230
- Fix Grid cell callback signatures per #230
- Fix Scene.on_key signature to use enums per #184
- Update Animation class with correct callback signature per #229
- Add deprecation notes to keypressScene, setTimer, delTimer
Regenerated docs:
- API_REFERENCE_DYNAMIC.md
- api_reference_dynamic.html
- mcrfpy.3 man page
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-28 19:20:04 -05:00
|
|
|
- \f[V]origin\f[R]: Transform origin as Vector (pivot point for
|
|
|
|
|
rotation).
|
|
|
|
|
Default (0,0) is top-left; set to (w/2, h/2) to rotate around center.
|
F15: convert frozen binding docstrings to MCRF_* macros (#314)
Convert 289 raw PyMethodDef/PyGetSetDef docstring slots to MCRF_METHOD /
MCRF_PROPERTY across the 20 frozen (non-3D) binding files, bringing the
frozen surface to 100% macro compliance (check_frozen_docstrings.sh PASS).
Done via a one-agent-per-file workflow gated by validate_file_docstrings.sh
and per-wave build/doc-rebuild checks.
- Adds #include "McRFPy_Doc.h" where missing; fills the lone genuine doc
gap (UIGrid.at, which was MISSING a doc field in two arrays).
- McRFPy_Doc.h: comment documenting the MCRF_METHOD_DOC comma rule (the
trap that broke the GridLayers conversion mid-run).
- Rebaseline api_surface golden: property types now resolve to real types
instead of "Any" (e.g. grid_pos: Vector, on_cell_click: Callable | None),
and 11 properties correctly flip rw->ro now that their docstrings carry
"read-only" (collections, grid_size, hovered_cell, texture, view — all
verified against NULL setter slots).
- Regenerate docs/stubs/man page from the new docstrings.
Module-level functions use MCRF_METHOD(<name>, ...) (expands identically to
the intended MCRF_FUNCTION; the audit's compliance set is METHOD/PROPERTY).
Experimental 3D/Voxel bindings (src/3d/) remain exempt from the freeze.
Pre-existing failures unrelated to this change: test_animation_*,
test_constructor_comprehensive (reference the removed mcrfpy.Animation and
old constructor arity).
Refs #314
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 01:20:55 -04:00
|
|
|
- \f[V]outline\f[R]: Thickness of the text outline border (float).
|
|
|
|
|
Clamped to non-negative values.
|
|
|
|
|
- \f[V]outline_color\f[R]: Outline color of the text (Color).
|
2026-01-23 20:49:11 -05:00
|
|
|
Returns a copy; modifying components requires reassignment.
|
|
|
|
|
For animation, use `outline_color.r', `outline_color.g', etc.
|
|
|
|
|
- \f[V]parent\f[R]: Parent drawable.
|
|
|
|
|
Get: Returns the parent Frame/Grid if nested, or None if at scene level.
|
|
|
|
|
Set: Assign a Frame/Grid to reparent, or None to remove from parent.
|
F15: convert frozen binding docstrings to MCRF_* macros (#314)
Convert 289 raw PyMethodDef/PyGetSetDef docstring slots to MCRF_METHOD /
MCRF_PROPERTY across the 20 frozen (non-3D) binding files, bringing the
frozen surface to 100% macro compliance (check_frozen_docstrings.sh PASS).
Done via a one-agent-per-file workflow gated by validate_file_docstrings.sh
and per-wave build/doc-rebuild checks.
- Adds #include "McRFPy_Doc.h" where missing; fills the lone genuine doc
gap (UIGrid.at, which was MISSING a doc field in two arrays).
- McRFPy_Doc.h: comment documenting the MCRF_METHOD_DOC comma rule (the
trap that broke the GridLayers conversion mid-run).
- Rebaseline api_surface golden: property types now resolve to real types
instead of "Any" (e.g. grid_pos: Vector, on_cell_click: Callable | None),
and 11 properties correctly flip rw->ro now that their docstrings carry
"read-only" (collections, grid_size, hovered_cell, texture, view — all
verified against NULL setter slots).
- Regenerate docs/stubs/man page from the new docstrings.
Module-level functions use MCRF_METHOD(<name>, ...) (expands identically to
the intended MCRF_FUNCTION; the audit's compliance set is METHOD/PROPERTY).
Experimental 3D/Voxel bindings (src/3d/) remain exempt from the freeze.
Pre-existing failures unrelated to this change: test_animation_*,
test_constructor_comprehensive (reference the removed mcrfpy.Animation and
old constructor arity).
Refs #314
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 01:20:55 -04:00
|
|
|
- \f[V]pos\f[R]: Position as (x, y) Vector.
|
|
|
|
|
- \f[V]rotate_with_camera\f[R]: Whether to rotate visually with parent
|
|
|
|
|
Grid\[cq]s camera_rotation (bool).
|
Update documentation for API changes #229, #230, #184
CLAUDE.md updates:
- Fix Python version 3.12 -> 3.14
- Update keypressScene -> scene.on_key pattern
- Add API examples for new callback signatures
- Document animation callbacks (target, prop, value)
- Document hover callbacks (position-only)
- Document enum types (Key, MouseButton, InputState)
stubs/mcrfpy.pyi updates:
- Add Key, MouseButton, InputState, Easing enum classes
- Fix Drawable hover callback signatures per #230
- Fix Grid cell callback signatures per #230
- Fix Scene.on_key signature to use enums per #184
- Update Animation class with correct callback signature per #229
- Add deprecation notes to keypressScene, setTimer, delTimer
Regenerated docs:
- API_REFERENCE_DYNAMIC.md
- api_reference_dynamic.html
- mcrfpy.3 man page
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-28 19:20:04 -05:00
|
|
|
False (default): stay screen-aligned.
|
|
|
|
|
True: tilt with camera.
|
|
|
|
|
Only affects children of UIGrid; ignored for other parents.
|
|
|
|
|
- \f[V]rotation\f[R]: Rotation angle in degrees (clockwise around
|
|
|
|
|
origin).
|
|
|
|
|
Animatable property.
|
|
|
|
|
- \f[V]shader\f[R]: Shader for GPU visual effects (Shader or None).
|
|
|
|
|
When set, the drawable is rendered through the shader program.
|
|
|
|
|
Set to None to disable shader effects.
|
|
|
|
|
- \f[V]size\f[R] \f[I](read-only)\f[R]: Text dimensions as Vector
|
F15: convert frozen binding docstrings to MCRF_* macros (#314)
Convert 289 raw PyMethodDef/PyGetSetDef docstring slots to MCRF_METHOD /
MCRF_PROPERTY across the 20 frozen (non-3D) binding files, bringing the
frozen surface to 100% macro compliance (check_frozen_docstrings.sh PASS).
Done via a one-agent-per-file workflow gated by validate_file_docstrings.sh
and per-wave build/doc-rebuild checks.
- Adds #include "McRFPy_Doc.h" where missing; fills the lone genuine doc
gap (UIGrid.at, which was MISSING a doc field in two arrays).
- McRFPy_Doc.h: comment documenting the MCRF_METHOD_DOC comma rule (the
trap that broke the GridLayers conversion mid-run).
- Rebaseline api_surface golden: property types now resolve to real types
instead of "Any" (e.g. grid_pos: Vector, on_cell_click: Callable | None),
and 11 properties correctly flip rw->ro now that their docstrings carry
"read-only" (collections, grid_size, hovered_cell, texture, view — all
verified against NULL setter slots).
- Regenerate docs/stubs/man page from the new docstrings.
Module-level functions use MCRF_METHOD(<name>, ...) (expands identically to
the intended MCRF_FUNCTION; the audit's compliance set is METHOD/PROPERTY).
Experimental 3D/Voxel bindings (src/3d/) remain exempt from the freeze.
Pre-existing failures unrelated to this change: test_animation_*,
test_constructor_comprehensive (reference the removed mcrfpy.Animation and
old constructor arity).
Refs #314
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 01:20:55 -04:00
|
|
|
(read-only).
|
|
|
|
|
- \f[V]text\f[R]: The text string displayed by this Caption (str).
|
|
|
|
|
- \f[V]uniforms\f[R] \f[I](read-only)\f[R]: Collection of shader
|
|
|
|
|
uniforms (read-only access to collection).
|
Update documentation for API changes #229, #230, #184
CLAUDE.md updates:
- Fix Python version 3.12 -> 3.14
- Update keypressScene -> scene.on_key pattern
- Add API examples for new callback signatures
- Document animation callbacks (target, prop, value)
- Document hover callbacks (position-only)
- Document enum types (Key, MouseButton, InputState)
stubs/mcrfpy.pyi updates:
- Add Key, MouseButton, InputState, Easing enum classes
- Fix Drawable hover callback signatures per #230
- Fix Grid cell callback signatures per #230
- Fix Scene.on_key signature to use enums per #184
- Update Animation class with correct callback signature per #229
- Add deprecation notes to keypressScene, setTimer, delTimer
Regenerated docs:
- API_REFERENCE_DYNAMIC.md
- api_reference_dynamic.html
- mcrfpy.3 man page
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-28 19:20:04 -05:00
|
|
|
Set uniforms via dict-like syntax: drawable.uniforms[`name'] = value.
|
|
|
|
|
Supports float, vec2/3/4 tuples, PropertyBinding, and CallableBinding.
|
|
|
|
|
- \f[V]vert_margin\f[R]: Vertical margin override (float, 0 = use
|
|
|
|
|
general margin).
|
2026-01-23 20:49:11 -05:00
|
|
|
Invalid for horizontally-centered alignments (CENTER_LEFT, CENTER_RIGHT,
|
|
|
|
|
CENTER).
|
|
|
|
|
- \f[V]visible\f[R]: Whether the object is visible (bool).
|
|
|
|
|
Invisible objects are not rendered or clickable.
|
F15: convert frozen binding docstrings to MCRF_* macros (#314)
Convert 289 raw PyMethodDef/PyGetSetDef docstring slots to MCRF_METHOD /
MCRF_PROPERTY across the 20 frozen (non-3D) binding files, bringing the
frozen surface to 100% macro compliance (check_frozen_docstrings.sh PASS).
Done via a one-agent-per-file workflow gated by validate_file_docstrings.sh
and per-wave build/doc-rebuild checks.
- Adds #include "McRFPy_Doc.h" where missing; fills the lone genuine doc
gap (UIGrid.at, which was MISSING a doc field in two arrays).
- McRFPy_Doc.h: comment documenting the MCRF_METHOD_DOC comma rule (the
trap that broke the GridLayers conversion mid-run).
- Rebaseline api_surface golden: property types now resolve to real types
instead of "Any" (e.g. grid_pos: Vector, on_cell_click: Callable | None),
and 11 properties correctly flip rw->ro now that their docstrings carry
"read-only" (collections, grid_size, hovered_cell, texture, view — all
verified against NULL setter slots).
- Regenerate docs/stubs/man page from the new docstrings.
Module-level functions use MCRF_METHOD(<name>, ...) (expands identically to
the intended MCRF_FUNCTION; the audit's compliance set is METHOD/PROPERTY).
Experimental 3D/Voxel bindings (src/3d/) remain exempt from the freeze.
Pre-existing failures unrelated to this change: test_animation_*,
test_constructor_comprehensive (reference the removed mcrfpy.Animation and
old constructor arity).
Refs #314
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 01:20:55 -04:00
|
|
|
- \f[V]w\f[R] \f[I](read-only)\f[R]: Text width in pixels (float,
|
|
|
|
|
read-only).
|
|
|
|
|
- \f[V]x\f[R]: X coordinate of top-left corner (float).
|
|
|
|
|
- \f[V]y\f[R]: Y coordinate of top-left corner (float).
|
|
|
|
|
- \f[V]z_index\f[R]: Z-order for rendering (lower values rendered
|
|
|
|
|
first).
|
2026-01-23 20:49:11 -05:00
|
|
|
Automatically triggers scene resort when changed.
|
2025-10-30 21:20:50 -04:00
|
|
|
.PP
|
|
|
|
|
\f[B]Methods:\f[R]
|
Replace UIEntity gridstate with DiscreteMap perspective_map; closes #294
Per-entity FOV memory moves from std::vector<UIGridPointState> (two-bool
visible/discovered pairs) to a 3-state DiscreteMap (0=UNKNOWN, 1=DISCOVERED,
2=VISIBLE), exposed as entity.perspective_map. The invariant
visible-subset-of-discovered becomes structural (single value per cell), and
the map is a live, serializable, first-class object rather than an implicit
internal array.
Changes:
- New DiscreteMap C++ class with shared ownership; PyDiscreteMapObject now
holds shared_ptr<DiscreteMap>. UIEntity holds the same shared_ptr.
- New mcrfpy.Perspective IntEnum (UNKNOWN/DISCOVERED/VISIBLE), modelled on
PyInputState.
- entity.perspective_map: lazy-allocated on first access with a grid;
setter validates size against grid and raises ValueError on mismatch;
None clears (next access lazy-reallocates fresh).
- updateVisibility() now demotes 2->1 then promotes visible cells to 2.
- entity.at(x, y) returns grid.at(x, y) when VISIBLE, else None.
- Fog-of-war rendering in UIGridView and UIGrid reads the 3-state map.
- Removed: UIEntity::gridstate, ensureGridstate(), entity.gridstate getter,
UIGridPointState struct + PyUIGridPointStateType.
- Obsolete tests deleted (test_gridpointstate_point,
issue_265_gridpointstate_dangle); 4 new tests cover lazy allocation,
identity, serialization round-trip, size validation, and the
visible-subset-of-discovered invariant.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-17 23:04:27 -04:00
|
|
|
.SS \f[V]animate(property: str, target: Any, duration: float, easing=None, delta=False, loop=False, callback=None, conflict_mode=\[aq]replace\[aq]) -> Animation\f[R]
|
2025-10-30 21:20:50 -04:00
|
|
|
.PP
|
2026-01-23 20:49:11 -05:00
|
|
|
Create and start an animation on this drawable\[cq]s property.
|
2025-10-30 21:20:50 -04:00
|
|
|
.PP
|
|
|
|
|
Note:
|
|
|
|
|
.PP
|
2026-01-23 20:49:11 -05:00
|
|
|
\f[B]Arguments:\f[R] - \f[V]property\f[R]: Name of the property to
|
|
|
|
|
animate (e.g., `x', `fill_color', `opacity') - \f[V]target\f[R]: Target
|
|
|
|
|
value - type depends on property (float, tuple for color/vector, etc.)
|
|
|
|
|
- \f[V]duration\f[R]: Animation duration in seconds - \f[V]easing\f[R]:
|
|
|
|
|
Easing function: Easing enum value, string name, or None for linear -
|
|
|
|
|
\f[V]delta\f[R]: If True, target is relative to current value; if False,
|
Replace UIEntity gridstate with DiscreteMap perspective_map; closes #294
Per-entity FOV memory moves from std::vector<UIGridPointState> (two-bool
visible/discovered pairs) to a 3-state DiscreteMap (0=UNKNOWN, 1=DISCOVERED,
2=VISIBLE), exposed as entity.perspective_map. The invariant
visible-subset-of-discovered becomes structural (single value per cell), and
the map is a live, serializable, first-class object rather than an implicit
internal array.
Changes:
- New DiscreteMap C++ class with shared ownership; PyDiscreteMapObject now
holds shared_ptr<DiscreteMap>. UIEntity holds the same shared_ptr.
- New mcrfpy.Perspective IntEnum (UNKNOWN/DISCOVERED/VISIBLE), modelled on
PyInputState.
- entity.perspective_map: lazy-allocated on first access with a grid;
setter validates size against grid and raises ValueError on mismatch;
None clears (next access lazy-reallocates fresh).
- updateVisibility() now demotes 2->1 then promotes visible cells to 2.
- entity.at(x, y) returns grid.at(x, y) when VISIBLE, else None.
- Fog-of-war rendering in UIGridView and UIGrid reads the 3-state map.
- Removed: UIEntity::gridstate, ensureGridstate(), entity.gridstate getter,
UIGridPointState struct + PyUIGridPointStateType.
- Obsolete tests deleted (test_gridpointstate_point,
issue_265_gridpointstate_dangle); 4 new tests cover lazy allocation,
identity, serialization round-trip, size validation, and the
visible-subset-of-discovered invariant.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-17 23:04:27 -04:00
|
|
|
target is absolute - \f[V]loop\f[R]: If True, animation repeats from
|
|
|
|
|
start when it reaches the end (default False) - \f[V]callback\f[R]:
|
|
|
|
|
Optional callable invoked when animation completes (not called for
|
|
|
|
|
looping animations) - \f[V]conflict_mode\f[R]: `replace' (default),
|
2026-01-23 20:49:11 -05:00
|
|
|
`queue', or `error' if property already animating
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Returns:\f[R] Animation object for monitoring progress
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Raises:\f[R] ValueError: If property name is not valid for this
|
|
|
|
|
drawable type This is a convenience method that creates an Animation,
|
|
|
|
|
starts it, and adds it to the AnimationManager.
|
|
|
|
|
.SS \f[V]move(dx, dy) or (delta) -> None\f[R]
|
2025-10-30 21:20:50 -04:00
|
|
|
.PP
|
|
|
|
|
Move the element by a relative offset.
|
|
|
|
|
.PP
|
|
|
|
|
Note:
|
|
|
|
|
.PP
|
2026-01-23 20:49:11 -05:00
|
|
|
\f[B]Arguments:\f[R] - \f[V]dx\f[R]: Horizontal offset in pixels (or use
|
|
|
|
|
delta) - \f[V]dy\f[R]: Vertical offset in pixels (or use delta) -
|
|
|
|
|
\f[V]delta\f[R]: Offset as tuple, list, or Vector: (dx, dy)
|
|
|
|
|
.SS \f[V]realign() -> None\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Reapply alignment relative to parent, useful for responsive layouts.
|
|
|
|
|
.PP
|
|
|
|
|
Note: Call this to recalculate position after parent changes size.
|
|
|
|
|
For elements with align=None, this has no effect.
|
|
|
|
|
.SS \f[V]resize(width, height) or (size) -> None\f[R]
|
2025-10-30 21:20:50 -04:00
|
|
|
.PP
|
|
|
|
|
Resize the element to new dimensions.
|
|
|
|
|
.PP
|
|
|
|
|
Note:
|
|
|
|
|
.PP
|
2026-01-23 20:49:11 -05:00
|
|
|
\f[B]Arguments:\f[R] - \f[V]width\f[R]: New width in pixels (or use
|
|
|
|
|
size) - \f[V]height\f[R]: New height in pixels (or use size) -
|
|
|
|
|
\f[V]size\f[R]: Size as tuple, list, or Vector: (width, height)
|
2025-12-02 09:21:43 -05:00
|
|
|
.SS Circle
|
|
|
|
|
.PP
|
|
|
|
|
\f[I]Inherits from: Drawable\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Circle(radius=0, center=None, fill_color=None, outline_color=None,
|
|
|
|
|
outline=0, **kwargs)
|
|
|
|
|
.PP
|
|
|
|
|
A circle UI element for drawing filled or outlined circles.
|
|
|
|
|
.PP
|
|
|
|
|
Args: radius (float, optional): Circle radius in pixels.
|
|
|
|
|
Default: 0 center (tuple, optional): Center position as (x, y).
|
|
|
|
|
Default: (0, 0) fill_color (Color, optional): Fill color.
|
|
|
|
|
Default: White outline_color (Color, optional): Outline color.
|
|
|
|
|
Default: Transparent outline (float, optional): Outline thickness.
|
|
|
|
|
Default: 0 (no outline)
|
|
|
|
|
.PP
|
refactor: Rename click kwarg to on_click for API consistency (closes #126)
BREAKING CHANGE: Constructor keyword argument renamed from `click` to
`on_click` for all UIDrawable types (Frame, Caption, Sprite, Grid, Line,
Circle, Arc).
Before: Frame(pos=(0,0), size=(100,100), click=handler)
After: Frame(pos=(0,0), size=(100,100), on_click=handler)
The property name was already `on_click` - this makes the constructor
kwarg match, completing the callback naming standardization from #139.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-28 14:31:22 -05:00
|
|
|
Keyword Args: on_click (callable): Click handler.
|
2025-12-02 09:21:43 -05:00
|
|
|
Default: None visible (bool): Visibility state.
|
|
|
|
|
Default: True opacity (float): Opacity (0.0-1.0).
|
|
|
|
|
Default: 1.0 z_index (int): Rendering order.
|
|
|
|
|
Default: 0 name (str): Element name for finding.
|
2026-01-23 20:49:11 -05:00
|
|
|
Default: None align (Alignment): Alignment relative to parent.
|
|
|
|
|
Default: None margin (float): Margin from parent edge when aligned.
|
|
|
|
|
Default: 0 horiz_margin (float): Horizontal margin override.
|
|
|
|
|
Default: 0 (use margin) vert_margin (float): Vertical margin override.
|
|
|
|
|
Default: 0 (use margin)
|
2025-12-02 09:21:43 -05:00
|
|
|
.PP
|
|
|
|
|
Attributes: radius (float): Circle radius center (Vector): Center
|
|
|
|
|
position fill_color (Color): Fill color outline_color (Color): Outline
|
|
|
|
|
color outline (float): Outline thickness visible (bool): Visibility
|
|
|
|
|
state opacity (float): Opacity value z_index (int): Rendering order name
|
2026-01-23 20:49:11 -05:00
|
|
|
(str): Element name align (Alignment): Alignment relative to parent (or
|
|
|
|
|
None) margin (float): General margin for alignment horiz_margin (float):
|
|
|
|
|
Horizontal margin override vert_margin (float): Vertical margin override
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Properties:\f[R] - \f[V]align\f[R]: Alignment relative to parent
|
|
|
|
|
bounds (Alignment enum or None).
|
|
|
|
|
When set, position is automatically calculated when parent is assigned
|
|
|
|
|
or resized.
|
|
|
|
|
Set to None to disable alignment and use manual positioning.
|
F15: correct docstring accuracy from adversarial verify pass (#314)
Follow-up to the macro conversion: an adversarial verify pass (one agent per
file vs. the C++ implementation + stubs) found 62 content issues; the real
ones are fixed here.
Callbacks (centralized):
- on_click: receives (pos, MouseButton, InputState), not str (8 files).
- on_enter/on_exit/on_move (UIBase.h): hover passes only (pos) -- removed the
fictional button/action args.
- bounds/global_bounds (UIBase.h): mark (tuple, read-only).
Signatures / types:
- Grid.find_path: document heuristic + weight; get_dijkstra_map: document roots;
compute_fov: FOV | int = FOV.BASIC (not the C constant FOV_BASIC) + Returns;
at/is_in_fov: document (pos) and (x, y) call forms.
- get_metrics: document all 16 returned dict keys (was 8); bresenham: drop the
bogus '*' keyword-only separator.
- Nullable defaults typed correctly: BSP seed/size, ColorLayer draw_fov/
apply_perspective Color|None, Entity.visible_entities radius int=-1 (None is
rejected by the 'i' parser -> see #319).
- Type-token fixes: GridView.center -> Vector; GridView.texture -> (None,
read-only) (unimplemented, #318); GridPoint.grid_pos -> (tuple, read-only);
EntityCollection.find -> Entity | list[Entity] | None; extend RuntimeError;
UniformCollection.values -> list[float | tuple | None].
- automation: onScreen (x, y) form documented; scroll notes x is ignored (#317).
Also: correct stale AStarPath/DijkstraMap signatures in docs/api-audit-2026-04.md
(the bindings were right, the audit table was outdated). Rebaseline the API
snapshot golden and regenerate docs/stubs.
Code-level bugs surfaced by the pass are filed as #317, #318, #319.
Refs #314, #317, #318, #319
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 06:43:47 -04:00
|
|
|
- \f[V]bounds\f[R] \f[I](read-only)\f[R]: Axis-aligned bounding box
|
|
|
|
|
(tuple, read-only) as a (pos, size) pair of Vectors: (Vector(x, y),
|
|
|
|
|
Vector(width, height)).
|
F15: convert frozen binding docstrings to MCRF_* macros (#314)
Convert 289 raw PyMethodDef/PyGetSetDef docstring slots to MCRF_METHOD /
MCRF_PROPERTY across the 20 frozen (non-3D) binding files, bringing the
frozen surface to 100% macro compliance (check_frozen_docstrings.sh PASS).
Done via a one-agent-per-file workflow gated by validate_file_docstrings.sh
and per-wave build/doc-rebuild checks.
- Adds #include "McRFPy_Doc.h" where missing; fills the lone genuine doc
gap (UIGrid.at, which was MISSING a doc field in two arrays).
- McRFPy_Doc.h: comment documenting the MCRF_METHOD_DOC comma rule (the
trap that broke the GridLayers conversion mid-run).
- Rebaseline api_surface golden: property types now resolve to real types
instead of "Any" (e.g. grid_pos: Vector, on_cell_click: Callable | None),
and 11 properties correctly flip rw->ro now that their docstrings carry
"read-only" (collections, grid_size, hovered_cell, texture, view — all
verified against NULL setter slots).
- Regenerate docs/stubs/man page from the new docstrings.
Module-level functions use MCRF_METHOD(<name>, ...) (expands identically to
the intended MCRF_FUNCTION; the audit's compliance set is METHOD/PROPERTY).
Experimental 3D/Voxel bindings (src/3d/) remain exempt from the freeze.
Pre-existing failures unrelated to this change: test_animation_*,
test_constructor_comprehensive (reference the removed mcrfpy.Animation and
old constructor arity).
Refs #314
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 01:20:55 -04:00
|
|
|
- \f[V]center\f[R]: Center position of the circle (Vector).
|
|
|
|
|
- \f[V]fill_color\f[R]: Fill color of the circle (Color).
|
F15: correct docstring accuracy from adversarial verify pass (#314)
Follow-up to the macro conversion: an adversarial verify pass (one agent per
file vs. the C++ implementation + stubs) found 62 content issues; the real
ones are fixed here.
Callbacks (centralized):
- on_click: receives (pos, MouseButton, InputState), not str (8 files).
- on_enter/on_exit/on_move (UIBase.h): hover passes only (pos) -- removed the
fictional button/action args.
- bounds/global_bounds (UIBase.h): mark (tuple, read-only).
Signatures / types:
- Grid.find_path: document heuristic + weight; get_dijkstra_map: document roots;
compute_fov: FOV | int = FOV.BASIC (not the C constant FOV_BASIC) + Returns;
at/is_in_fov: document (pos) and (x, y) call forms.
- get_metrics: document all 16 returned dict keys (was 8); bresenham: drop the
bogus '*' keyword-only separator.
- Nullable defaults typed correctly: BSP seed/size, ColorLayer draw_fov/
apply_perspective Color|None, Entity.visible_entities radius int=-1 (None is
rejected by the 'i' parser -> see #319).
- Type-token fixes: GridView.center -> Vector; GridView.texture -> (None,
read-only) (unimplemented, #318); GridPoint.grid_pos -> (tuple, read-only);
EntityCollection.find -> Entity | list[Entity] | None; extend RuntimeError;
UniformCollection.values -> list[float | tuple | None].
- automation: onScreen (x, y) form documented; scroll notes x is ignored (#317).
Also: correct stale AStarPath/DijkstraMap signatures in docs/api-audit-2026-04.md
(the bindings were right, the audit table was outdated). Rebaseline the API
snapshot golden and regenerate docs/stubs.
Code-level bugs surfaced by the pass are filed as #317, #318, #319.
Refs #314, #317, #318, #319
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 06:43:47 -04:00
|
|
|
- \f[V]global_bounds\f[R] \f[I](read-only)\f[R]: Axis-aligned bounding
|
|
|
|
|
box in screen coordinates (tuple, read-only) as a (pos, size) pair of
|
|
|
|
|
Vectors: (Vector(x, y), Vector(width, height)).
|
2026-01-23 20:49:11 -05:00
|
|
|
- \f[V]global_position\f[R] \f[I](read-only)\f[R]: Global screen
|
|
|
|
|
position (read-only).
|
|
|
|
|
Calculates absolute position by walking up the parent chain.
|
F15: convert frozen binding docstrings to MCRF_* macros (#314)
Convert 289 raw PyMethodDef/PyGetSetDef docstring slots to MCRF_METHOD /
MCRF_PROPERTY across the 20 frozen (non-3D) binding files, bringing the
frozen surface to 100% macro compliance (check_frozen_docstrings.sh PASS).
Done via a one-agent-per-file workflow gated by validate_file_docstrings.sh
and per-wave build/doc-rebuild checks.
- Adds #include "McRFPy_Doc.h" where missing; fills the lone genuine doc
gap (UIGrid.at, which was MISSING a doc field in two arrays).
- McRFPy_Doc.h: comment documenting the MCRF_METHOD_DOC comma rule (the
trap that broke the GridLayers conversion mid-run).
- Rebaseline api_surface golden: property types now resolve to real types
instead of "Any" (e.g. grid_pos: Vector, on_cell_click: Callable | None),
and 11 properties correctly flip rw->ro now that their docstrings carry
"read-only" (collections, grid_size, hovered_cell, texture, view — all
verified against NULL setter slots).
- Regenerate docs/stubs/man page from the new docstrings.
Module-level functions use MCRF_METHOD(<name>, ...) (expands identically to
the intended MCRF_FUNCTION; the audit's compliance set is METHOD/PROPERTY).
Experimental 3D/Voxel bindings (src/3d/) remain exempt from the freeze.
Pre-existing failures unrelated to this change: test_animation_*,
test_constructor_comprehensive (reference the removed mcrfpy.Animation and
old constructor arity).
Refs #314
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 01:20:55 -04:00
|
|
|
- \f[V]grid_pos\f[R]: Position in grid tile coordinates (Vector).
|
|
|
|
|
Only meaningful when parent is a Grid.
|
|
|
|
|
- \f[V]grid_size\f[R]: Size in grid tile coordinates (Vector).
|
|
|
|
|
Only meaningful when parent is a Grid.
|
|
|
|
|
- \f[V]horiz_margin\f[R]: Horizontal margin override (float, 0 = use
|
|
|
|
|
general margin).
|
2026-01-23 20:49:11 -05:00
|
|
|
Invalid for vertically-centered alignments (TOP_CENTER, BOTTOM_CENTER,
|
|
|
|
|
CENTER).
|
|
|
|
|
- \f[V]hovered\f[R] \f[I](read-only)\f[R]: Whether mouse is currently
|
|
|
|
|
over this element (read-only).
|
|
|
|
|
Updated automatically by the engine during mouse movement.
|
|
|
|
|
- \f[V]margin\f[R]: General margin from edge when aligned (float).
|
|
|
|
|
Applied to both horizontal and vertical edges unless overridden.
|
|
|
|
|
Invalid for CENTER alignment (raises ValueError).
|
F15: convert frozen binding docstrings to MCRF_* macros (#314)
Convert 289 raw PyMethodDef/PyGetSetDef docstring slots to MCRF_METHOD /
MCRF_PROPERTY across the 20 frozen (non-3D) binding files, bringing the
frozen surface to 100% macro compliance (check_frozen_docstrings.sh PASS).
Done via a one-agent-per-file workflow gated by validate_file_docstrings.sh
and per-wave build/doc-rebuild checks.
- Adds #include "McRFPy_Doc.h" where missing; fills the lone genuine doc
gap (UIGrid.at, which was MISSING a doc field in two arrays).
- McRFPy_Doc.h: comment documenting the MCRF_METHOD_DOC comma rule (the
trap that broke the GridLayers conversion mid-run).
- Rebaseline api_surface golden: property types now resolve to real types
instead of "Any" (e.g. grid_pos: Vector, on_cell_click: Callable | None),
and 11 properties correctly flip rw->ro now that their docstrings carry
"read-only" (collections, grid_size, hovered_cell, texture, view — all
verified against NULL setter slots).
- Regenerate docs/stubs/man page from the new docstrings.
Module-level functions use MCRF_METHOD(<name>, ...) (expands identically to
the intended MCRF_FUNCTION; the audit's compliance set is METHOD/PROPERTY).
Experimental 3D/Voxel bindings (src/3d/) remain exempt from the freeze.
Pre-existing failures unrelated to this change: test_animation_*,
test_constructor_comprehensive (reference the removed mcrfpy.Animation and
old constructor arity).
Refs #314
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 01:20:55 -04:00
|
|
|
- \f[V]name\f[R]: Name for finding this element (str).
|
|
|
|
|
- \f[V]on_click\f[R]: Callable executed when circle is clicked (Callable
|
|
|
|
|
| None).
|
F15: correct docstring accuracy from adversarial verify pass (#314)
Follow-up to the macro conversion: an adversarial verify pass (one agent per
file vs. the C++ implementation + stubs) found 62 content issues; the real
ones are fixed here.
Callbacks (centralized):
- on_click: receives (pos, MouseButton, InputState), not str (8 files).
- on_enter/on_exit/on_move (UIBase.h): hover passes only (pos) -- removed the
fictional button/action args.
- bounds/global_bounds (UIBase.h): mark (tuple, read-only).
Signatures / types:
- Grid.find_path: document heuristic + weight; get_dijkstra_map: document roots;
compute_fov: FOV | int = FOV.BASIC (not the C constant FOV_BASIC) + Returns;
at/is_in_fov: document (pos) and (x, y) call forms.
- get_metrics: document all 16 returned dict keys (was 8); bresenham: drop the
bogus '*' keyword-only separator.
- Nullable defaults typed correctly: BSP seed/size, ColorLayer draw_fov/
apply_perspective Color|None, Entity.visible_entities radius int=-1 (None is
rejected by the 'i' parser -> see #319).
- Type-token fixes: GridView.center -> Vector; GridView.texture -> (None,
read-only) (unimplemented, #318); GridPoint.grid_pos -> (tuple, read-only);
EntityCollection.find -> Entity | list[Entity] | None; extend RuntimeError;
UniformCollection.values -> list[float | tuple | None].
- automation: onScreen (x, y) form documented; scroll notes x is ignored (#317).
Also: correct stale AStarPath/DijkstraMap signatures in docs/api-audit-2026-04.md
(the bindings were right, the audit table was outdated). Rebaseline the API
snapshot golden and regenerate docs/stubs.
Code-level bugs surfaced by the pass are filed as #317, #318, #319.
Refs #314, #317, #318, #319
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 06:43:47 -04:00
|
|
|
Function receives (pos: Vector, button: MouseButton, action:
|
|
|
|
|
InputState).
|
2026-01-23 20:49:11 -05:00
|
|
|
- \f[V]on_enter\f[R]: Callback for mouse enter events.
|
F15: correct docstring accuracy from adversarial verify pass (#314)
Follow-up to the macro conversion: an adversarial verify pass (one agent per
file vs. the C++ implementation + stubs) found 62 content issues; the real
ones are fixed here.
Callbacks (centralized):
- on_click: receives (pos, MouseButton, InputState), not str (8 files).
- on_enter/on_exit/on_move (UIBase.h): hover passes only (pos) -- removed the
fictional button/action args.
- bounds/global_bounds (UIBase.h): mark (tuple, read-only).
Signatures / types:
- Grid.find_path: document heuristic + weight; get_dijkstra_map: document roots;
compute_fov: FOV | int = FOV.BASIC (not the C constant FOV_BASIC) + Returns;
at/is_in_fov: document (pos) and (x, y) call forms.
- get_metrics: document all 16 returned dict keys (was 8); bresenham: drop the
bogus '*' keyword-only separator.
- Nullable defaults typed correctly: BSP seed/size, ColorLayer draw_fov/
apply_perspective Color|None, Entity.visible_entities radius int=-1 (None is
rejected by the 'i' parser -> see #319).
- Type-token fixes: GridView.center -> Vector; GridView.texture -> (None,
read-only) (unimplemented, #318); GridPoint.grid_pos -> (tuple, read-only);
EntityCollection.find -> Entity | list[Entity] | None; extend RuntimeError;
UniformCollection.values -> list[float | tuple | None].
- automation: onScreen (x, y) form documented; scroll notes x is ignored (#317).
Also: correct stale AStarPath/DijkstraMap signatures in docs/api-audit-2026-04.md
(the bindings were right, the audit table was outdated). Rebaseline the API
snapshot golden and regenerate docs/stubs.
Code-level bugs surfaced by the pass are filed as #317, #318, #319.
Refs #314, #317, #318, #319
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 06:43:47 -04:00
|
|
|
Called with (pos: Vector) when mouse enters this element\[cq]s bounds.
|
2026-01-23 20:49:11 -05:00
|
|
|
- \f[V]on_exit\f[R]: Callback for mouse exit events.
|
F15: correct docstring accuracy from adversarial verify pass (#314)
Follow-up to the macro conversion: an adversarial verify pass (one agent per
file vs. the C++ implementation + stubs) found 62 content issues; the real
ones are fixed here.
Callbacks (centralized):
- on_click: receives (pos, MouseButton, InputState), not str (8 files).
- on_enter/on_exit/on_move (UIBase.h): hover passes only (pos) -- removed the
fictional button/action args.
- bounds/global_bounds (UIBase.h): mark (tuple, read-only).
Signatures / types:
- Grid.find_path: document heuristic + weight; get_dijkstra_map: document roots;
compute_fov: FOV | int = FOV.BASIC (not the C constant FOV_BASIC) + Returns;
at/is_in_fov: document (pos) and (x, y) call forms.
- get_metrics: document all 16 returned dict keys (was 8); bresenham: drop the
bogus '*' keyword-only separator.
- Nullable defaults typed correctly: BSP seed/size, ColorLayer draw_fov/
apply_perspective Color|None, Entity.visible_entities radius int=-1 (None is
rejected by the 'i' parser -> see #319).
- Type-token fixes: GridView.center -> Vector; GridView.texture -> (None,
read-only) (unimplemented, #318); GridPoint.grid_pos -> (tuple, read-only);
EntityCollection.find -> Entity | list[Entity] | None; extend RuntimeError;
UniformCollection.values -> list[float | tuple | None].
- automation: onScreen (x, y) form documented; scroll notes x is ignored (#317).
Also: correct stale AStarPath/DijkstraMap signatures in docs/api-audit-2026-04.md
(the bindings were right, the audit table was outdated). Rebaseline the API
snapshot golden and regenerate docs/stubs.
Code-level bugs surfaced by the pass are filed as #317, #318, #319.
Refs #314, #317, #318, #319
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 06:43:47 -04:00
|
|
|
Called with (pos: Vector) when mouse leaves this element\[cq]s bounds.
|
2026-01-23 20:49:11 -05:00
|
|
|
- \f[V]on_move\f[R]: Callback for mouse movement within bounds.
|
F15: correct docstring accuracy from adversarial verify pass (#314)
Follow-up to the macro conversion: an adversarial verify pass (one agent per
file vs. the C++ implementation + stubs) found 62 content issues; the real
ones are fixed here.
Callbacks (centralized):
- on_click: receives (pos, MouseButton, InputState), not str (8 files).
- on_enter/on_exit/on_move (UIBase.h): hover passes only (pos) -- removed the
fictional button/action args.
- bounds/global_bounds (UIBase.h): mark (tuple, read-only).
Signatures / types:
- Grid.find_path: document heuristic + weight; get_dijkstra_map: document roots;
compute_fov: FOV | int = FOV.BASIC (not the C constant FOV_BASIC) + Returns;
at/is_in_fov: document (pos) and (x, y) call forms.
- get_metrics: document all 16 returned dict keys (was 8); bresenham: drop the
bogus '*' keyword-only separator.
- Nullable defaults typed correctly: BSP seed/size, ColorLayer draw_fov/
apply_perspective Color|None, Entity.visible_entities radius int=-1 (None is
rejected by the 'i' parser -> see #319).
- Type-token fixes: GridView.center -> Vector; GridView.texture -> (None,
read-only) (unimplemented, #318); GridPoint.grid_pos -> (tuple, read-only);
EntityCollection.find -> Entity | list[Entity] | None; extend RuntimeError;
UniformCollection.values -> list[float | tuple | None].
- automation: onScreen (x, y) form documented; scroll notes x is ignored (#317).
Also: correct stale AStarPath/DijkstraMap signatures in docs/api-audit-2026-04.md
(the bindings were right, the audit table was outdated). Rebaseline the API
snapshot golden and regenerate docs/stubs.
Code-level bugs surfaced by the pass are filed as #317, #318, #319.
Refs #314, #317, #318, #319
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 06:43:47 -04:00
|
|
|
Called with (pos: Vector) for each mouse movement while inside.
|
2026-01-23 20:49:11 -05:00
|
|
|
Performance note: Called frequently during movement - keep handlers
|
|
|
|
|
fast.
|
|
|
|
|
- \f[V]opacity\f[R]: Opacity level (0.0 = transparent, 1.0 = opaque).
|
|
|
|
|
Automatically clamped to valid range [0.0, 1.0].
|
Update documentation for API changes #229, #230, #184
CLAUDE.md updates:
- Fix Python version 3.12 -> 3.14
- Update keypressScene -> scene.on_key pattern
- Add API examples for new callback signatures
- Document animation callbacks (target, prop, value)
- Document hover callbacks (position-only)
- Document enum types (Key, MouseButton, InputState)
stubs/mcrfpy.pyi updates:
- Add Key, MouseButton, InputState, Easing enum classes
- Fix Drawable hover callback signatures per #230
- Fix Grid cell callback signatures per #230
- Fix Scene.on_key signature to use enums per #184
- Update Animation class with correct callback signature per #229
- Add deprecation notes to keypressScene, setTimer, delTimer
Regenerated docs:
- API_REFERENCE_DYNAMIC.md
- api_reference_dynamic.html
- mcrfpy.3 man page
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-28 19:20:04 -05:00
|
|
|
- \f[V]origin\f[R]: Transform origin as Vector (pivot point for
|
|
|
|
|
rotation).
|
|
|
|
|
Default (0,0) is top-left; set to (w/2, h/2) to rotate around center.
|
F15: convert frozen binding docstrings to MCRF_* macros (#314)
Convert 289 raw PyMethodDef/PyGetSetDef docstring slots to MCRF_METHOD /
MCRF_PROPERTY across the 20 frozen (non-3D) binding files, bringing the
frozen surface to 100% macro compliance (check_frozen_docstrings.sh PASS).
Done via a one-agent-per-file workflow gated by validate_file_docstrings.sh
and per-wave build/doc-rebuild checks.
- Adds #include "McRFPy_Doc.h" where missing; fills the lone genuine doc
gap (UIGrid.at, which was MISSING a doc field in two arrays).
- McRFPy_Doc.h: comment documenting the MCRF_METHOD_DOC comma rule (the
trap that broke the GridLayers conversion mid-run).
- Rebaseline api_surface golden: property types now resolve to real types
instead of "Any" (e.g. grid_pos: Vector, on_cell_click: Callable | None),
and 11 properties correctly flip rw->ro now that their docstrings carry
"read-only" (collections, grid_size, hovered_cell, texture, view — all
verified against NULL setter slots).
- Regenerate docs/stubs/man page from the new docstrings.
Module-level functions use MCRF_METHOD(<name>, ...) (expands identically to
the intended MCRF_FUNCTION; the audit's compliance set is METHOD/PROPERTY).
Experimental 3D/Voxel bindings (src/3d/) remain exempt from the freeze.
Pre-existing failures unrelated to this change: test_animation_*,
test_constructor_comprehensive (reference the removed mcrfpy.Animation and
old constructor arity).
Refs #314
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 01:20:55 -04:00
|
|
|
- \f[V]outline\f[R]: Outline thickness in pixels (float).
|
|
|
|
|
Use 0 for no outline.
|
|
|
|
|
- \f[V]outline_color\f[R]: Outline color of the circle (Color).
|
|
|
|
|
- \f[V]parent\f[R]: Parent drawable.
|
2026-01-23 20:49:11 -05:00
|
|
|
Get: Returns the parent Frame/Grid if nested, or None if at scene level.
|
|
|
|
|
Set: Assign a Frame/Grid to reparent, or None to remove from parent.
|
F15: convert frozen binding docstrings to MCRF_* macros (#314)
Convert 289 raw PyMethodDef/PyGetSetDef docstring slots to MCRF_METHOD /
MCRF_PROPERTY across the 20 frozen (non-3D) binding files, bringing the
frozen surface to 100% macro compliance (check_frozen_docstrings.sh PASS).
Done via a one-agent-per-file workflow gated by validate_file_docstrings.sh
and per-wave build/doc-rebuild checks.
- Adds #include "McRFPy_Doc.h" where missing; fills the lone genuine doc
gap (UIGrid.at, which was MISSING a doc field in two arrays).
- McRFPy_Doc.h: comment documenting the MCRF_METHOD_DOC comma rule (the
trap that broke the GridLayers conversion mid-run).
- Rebaseline api_surface golden: property types now resolve to real types
instead of "Any" (e.g. grid_pos: Vector, on_cell_click: Callable | None),
and 11 properties correctly flip rw->ro now that their docstrings carry
"read-only" (collections, grid_size, hovered_cell, texture, view — all
verified against NULL setter slots).
- Regenerate docs/stubs/man page from the new docstrings.
Module-level functions use MCRF_METHOD(<name>, ...) (expands identically to
the intended MCRF_FUNCTION; the audit's compliance set is METHOD/PROPERTY).
Experimental 3D/Voxel bindings (src/3d/) remain exempt from the freeze.
Pre-existing failures unrelated to this change: test_animation_*,
test_constructor_comprehensive (reference the removed mcrfpy.Animation and
old constructor arity).
Refs #314
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 01:20:55 -04:00
|
|
|
- \f[V]pos\f[R]: Position as a Vector (same as center) (Vector).
|
|
|
|
|
- \f[V]radius\f[R]: Circle radius in pixels (float).
|
|
|
|
|
- \f[V]rotate_with_camera\f[R]: Whether to rotate visually with parent
|
Update documentation for API changes #229, #230, #184
CLAUDE.md updates:
- Fix Python version 3.12 -> 3.14
- Update keypressScene -> scene.on_key pattern
- Add API examples for new callback signatures
- Document animation callbacks (target, prop, value)
- Document hover callbacks (position-only)
- Document enum types (Key, MouseButton, InputState)
stubs/mcrfpy.pyi updates:
- Add Key, MouseButton, InputState, Easing enum classes
- Fix Drawable hover callback signatures per #230
- Fix Grid cell callback signatures per #230
- Fix Scene.on_key signature to use enums per #184
- Update Animation class with correct callback signature per #229
- Add deprecation notes to keypressScene, setTimer, delTimer
Regenerated docs:
- API_REFERENCE_DYNAMIC.md
- api_reference_dynamic.html
- mcrfpy.3 man page
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-28 19:20:04 -05:00
|
|
|
Grid\[cq]s camera_rotation (bool).
|
|
|
|
|
False (default): stay screen-aligned.
|
|
|
|
|
True: tilt with camera.
|
|
|
|
|
Only affects children of UIGrid; ignored for other parents.
|
|
|
|
|
- \f[V]rotation\f[R]: Rotation angle in degrees (clockwise around
|
|
|
|
|
origin).
|
|
|
|
|
Animatable property.
|
|
|
|
|
- \f[V]vert_margin\f[R]: Vertical margin override (float, 0 = use
|
|
|
|
|
general margin).
|
2026-01-23 20:49:11 -05:00
|
|
|
Invalid for horizontally-centered alignments (CENTER_LEFT, CENTER_RIGHT,
|
|
|
|
|
CENTER).
|
|
|
|
|
- \f[V]visible\f[R]: Whether the object is visible (bool).
|
|
|
|
|
Invisible objects are not rendered or clickable.
|
F15: convert frozen binding docstrings to MCRF_* macros (#314)
Convert 289 raw PyMethodDef/PyGetSetDef docstring slots to MCRF_METHOD /
MCRF_PROPERTY across the 20 frozen (non-3D) binding files, bringing the
frozen surface to 100% macro compliance (check_frozen_docstrings.sh PASS).
Done via a one-agent-per-file workflow gated by validate_file_docstrings.sh
and per-wave build/doc-rebuild checks.
- Adds #include "McRFPy_Doc.h" where missing; fills the lone genuine doc
gap (UIGrid.at, which was MISSING a doc field in two arrays).
- McRFPy_Doc.h: comment documenting the MCRF_METHOD_DOC comma rule (the
trap that broke the GridLayers conversion mid-run).
- Rebaseline api_surface golden: property types now resolve to real types
instead of "Any" (e.g. grid_pos: Vector, on_cell_click: Callable | None),
and 11 properties correctly flip rw->ro now that their docstrings carry
"read-only" (collections, grid_size, hovered_cell, texture, view — all
verified against NULL setter slots).
- Regenerate docs/stubs/man page from the new docstrings.
Module-level functions use MCRF_METHOD(<name>, ...) (expands identically to
the intended MCRF_FUNCTION; the audit's compliance set is METHOD/PROPERTY).
Experimental 3D/Voxel bindings (src/3d/) remain exempt from the freeze.
Pre-existing failures unrelated to this change: test_animation_*,
test_constructor_comprehensive (reference the removed mcrfpy.Animation and
old constructor arity).
Refs #314
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 01:20:55 -04:00
|
|
|
- \f[V]z_index\f[R]: Z-order for rendering (int).
|
|
|
|
|
Lower values are rendered first.
|
2025-12-02 09:21:43 -05:00
|
|
|
.PP
|
|
|
|
|
\f[B]Methods:\f[R]
|
Replace UIEntity gridstate with DiscreteMap perspective_map; closes #294
Per-entity FOV memory moves from std::vector<UIGridPointState> (two-bool
visible/discovered pairs) to a 3-state DiscreteMap (0=UNKNOWN, 1=DISCOVERED,
2=VISIBLE), exposed as entity.perspective_map. The invariant
visible-subset-of-discovered becomes structural (single value per cell), and
the map is a live, serializable, first-class object rather than an implicit
internal array.
Changes:
- New DiscreteMap C++ class with shared ownership; PyDiscreteMapObject now
holds shared_ptr<DiscreteMap>. UIEntity holds the same shared_ptr.
- New mcrfpy.Perspective IntEnum (UNKNOWN/DISCOVERED/VISIBLE), modelled on
PyInputState.
- entity.perspective_map: lazy-allocated on first access with a grid;
setter validates size against grid and raises ValueError on mismatch;
None clears (next access lazy-reallocates fresh).
- updateVisibility() now demotes 2->1 then promotes visible cells to 2.
- entity.at(x, y) returns grid.at(x, y) when VISIBLE, else None.
- Fog-of-war rendering in UIGridView and UIGrid reads the 3-state map.
- Removed: UIEntity::gridstate, ensureGridstate(), entity.gridstate getter,
UIGridPointState struct + PyUIGridPointStateType.
- Obsolete tests deleted (test_gridpointstate_point,
issue_265_gridpointstate_dangle); 4 new tests cover lazy allocation,
identity, serialization round-trip, size validation, and the
visible-subset-of-discovered invariant.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-17 23:04:27 -04:00
|
|
|
.SS \f[V]animate(property: str, target: Any, duration: float, easing=None, delta=False, loop=False, callback=None, conflict_mode=\[aq]replace\[aq]) -> Animation\f[R]
|
2025-12-02 09:21:43 -05:00
|
|
|
.PP
|
2026-01-23 20:49:11 -05:00
|
|
|
Create and start an animation on this drawable\[cq]s property.
|
2025-12-02 09:21:43 -05:00
|
|
|
.PP
|
|
|
|
|
Note:
|
|
|
|
|
.PP
|
2026-01-23 20:49:11 -05:00
|
|
|
\f[B]Arguments:\f[R] - \f[V]property\f[R]: Name of the property to
|
|
|
|
|
animate (e.g., `x', `fill_color', `opacity') - \f[V]target\f[R]: Target
|
|
|
|
|
value - type depends on property (float, tuple for color/vector, etc.)
|
|
|
|
|
- \f[V]duration\f[R]: Animation duration in seconds - \f[V]easing\f[R]:
|
|
|
|
|
Easing function: Easing enum value, string name, or None for linear -
|
|
|
|
|
\f[V]delta\f[R]: If True, target is relative to current value; if False,
|
Replace UIEntity gridstate with DiscreteMap perspective_map; closes #294
Per-entity FOV memory moves from std::vector<UIGridPointState> (two-bool
visible/discovered pairs) to a 3-state DiscreteMap (0=UNKNOWN, 1=DISCOVERED,
2=VISIBLE), exposed as entity.perspective_map. The invariant
visible-subset-of-discovered becomes structural (single value per cell), and
the map is a live, serializable, first-class object rather than an implicit
internal array.
Changes:
- New DiscreteMap C++ class with shared ownership; PyDiscreteMapObject now
holds shared_ptr<DiscreteMap>. UIEntity holds the same shared_ptr.
- New mcrfpy.Perspective IntEnum (UNKNOWN/DISCOVERED/VISIBLE), modelled on
PyInputState.
- entity.perspective_map: lazy-allocated on first access with a grid;
setter validates size against grid and raises ValueError on mismatch;
None clears (next access lazy-reallocates fresh).
- updateVisibility() now demotes 2->1 then promotes visible cells to 2.
- entity.at(x, y) returns grid.at(x, y) when VISIBLE, else None.
- Fog-of-war rendering in UIGridView and UIGrid reads the 3-state map.
- Removed: UIEntity::gridstate, ensureGridstate(), entity.gridstate getter,
UIGridPointState struct + PyUIGridPointStateType.
- Obsolete tests deleted (test_gridpointstate_point,
issue_265_gridpointstate_dangle); 4 new tests cover lazy allocation,
identity, serialization round-trip, size validation, and the
visible-subset-of-discovered invariant.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-17 23:04:27 -04:00
|
|
|
target is absolute - \f[V]loop\f[R]: If True, animation repeats from
|
|
|
|
|
start when it reaches the end (default False) - \f[V]callback\f[R]:
|
|
|
|
|
Optional callable invoked when animation completes (not called for
|
|
|
|
|
looping animations) - \f[V]conflict_mode\f[R]: `replace' (default),
|
2026-01-23 20:49:11 -05:00
|
|
|
`queue', or `error' if property already animating
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Returns:\f[R] Animation object for monitoring progress
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Raises:\f[R] ValueError: If property name is not valid for this
|
|
|
|
|
drawable type This is a convenience method that creates an Animation,
|
|
|
|
|
starts it, and adds it to the AnimationManager.
|
|
|
|
|
.SS \f[V]move(dx, dy) or (delta) -> None\f[R]
|
2025-12-02 09:21:43 -05:00
|
|
|
.PP
|
|
|
|
|
Move the element by a relative offset.
|
|
|
|
|
.PP
|
|
|
|
|
Note:
|
|
|
|
|
.PP
|
2026-01-23 20:49:11 -05:00
|
|
|
\f[B]Arguments:\f[R] - \f[V]dx\f[R]: Horizontal offset in pixels (or use
|
|
|
|
|
delta) - \f[V]dy\f[R]: Vertical offset in pixels (or use delta) -
|
|
|
|
|
\f[V]delta\f[R]: Offset as tuple, list, or Vector: (dx, dy)
|
|
|
|
|
.SS \f[V]realign() -> None\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Reapply alignment relative to parent, useful for responsive layouts.
|
|
|
|
|
.PP
|
|
|
|
|
Note: Call this to recalculate position after parent changes size.
|
|
|
|
|
For elements with align=None, this has no effect.
|
|
|
|
|
.SS \f[V]resize(width, height) or (size) -> None\f[R]
|
2025-12-02 09:21:43 -05:00
|
|
|
.PP
|
|
|
|
|
Resize the element to new dimensions.
|
|
|
|
|
.PP
|
|
|
|
|
Note:
|
|
|
|
|
.PP
|
2026-01-23 20:49:11 -05:00
|
|
|
\f[B]Arguments:\f[R] - \f[V]width\f[R]: New width in pixels (or use
|
|
|
|
|
size) - \f[V]height\f[R]: New height in pixels (or use size) -
|
|
|
|
|
\f[V]size\f[R]: Size as tuple, list, or Vector: (width, height)
|
2025-10-30 21:20:50 -04:00
|
|
|
.SS Color
|
|
|
|
|
.PP
|
2026-01-23 20:49:11 -05:00
|
|
|
Color(r: int = 0, g: int = 0, b: int = 0, a: int = 255)
|
|
|
|
|
.PP
|
|
|
|
|
RGBA color representation.
|
|
|
|
|
.PP
|
|
|
|
|
Args: r: Red component (0-255) g: Green component (0-255) b: Blue
|
|
|
|
|
component (0-255) a: Alpha component (0-255, default 255 = opaque)
|
|
|
|
|
.PP
|
|
|
|
|
Note: When accessing colors from UI elements (e.g., frame.fill_color),
|
|
|
|
|
you receive a COPY of the color.
|
|
|
|
|
Modifying it doesn\[cq]t affect the original.
|
|
|
|
|
To change a component:
|
|
|
|
|
.IP
|
|
|
|
|
.nf
|
|
|
|
|
\f[C]
|
|
|
|
|
# This does NOT work:
|
|
|
|
|
frame.fill_color.r = 255 # Modifies a temporary copy
|
|
|
|
|
|
|
|
|
|
# Do this instead:
|
|
|
|
|
c = frame.fill_color
|
|
|
|
|
c.r = 255
|
|
|
|
|
frame.fill_color = c
|
|
|
|
|
|
|
|
|
|
# Or use Animation for sub-properties:
|
|
|
|
|
anim = mcrfpy.Animation(\[aq]fill_color.r\[aq], 255, 0.5, \[aq]linear\[aq])
|
|
|
|
|
anim.start(frame)
|
|
|
|
|
\f[R]
|
|
|
|
|
.fi
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Properties:\f[R] - \f[V]a\f[R]: Alpha component (0-255, where
|
|
|
|
|
0=transparent, 255=opaque).
|
|
|
|
|
Automatically clamped to valid range.
|
|
|
|
|
- \f[V]b\f[R]: Blue component (0-255).
|
|
|
|
|
Automatically clamped to valid range.
|
|
|
|
|
- \f[V]g\f[R]: Green component (0-255).
|
|
|
|
|
Automatically clamped to valid range.
|
|
|
|
|
- \f[V]r\f[R]: Red component (0-255).
|
|
|
|
|
Automatically clamped to valid range.
|
2025-10-30 21:20:50 -04:00
|
|
|
.PP
|
|
|
|
|
\f[B]Methods:\f[R]
|
|
|
|
|
.SS \f[V]from_hex(hex_string: str) -> Color\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Create a Color from a hexadecimal string.
|
|
|
|
|
.PP
|
|
|
|
|
Note:
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Arguments:\f[R] - \f[V]hex_string\f[R]: Hex color string (e.g.,
|
|
|
|
|
`#FF0000', `FF0000', `#AABBCCDD' for RGBA)
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Returns:\f[R] Color: New Color object with values from hex string
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Raises:\f[R] ValueError: If hex string is not 6 or 8 characters
|
|
|
|
|
(RGB or RGBA) This is a class method.
|
|
|
|
|
Call as Color.from_hex(`#FF0000')
|
|
|
|
|
.SS \f[V]lerp(other: Color, t: float) -> Color\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Linearly interpolate between this color and another.
|
|
|
|
|
.PP
|
|
|
|
|
Note:
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Arguments:\f[R] - \f[V]other\f[R]: The target Color to interpolate
|
|
|
|
|
towards - \f[V]t\f[R]: Interpolation factor (0.0 = this color, 1.0 =
|
|
|
|
|
other color).
|
|
|
|
|
Automatically clamped to [0.0, 1.0]
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Returns:\f[R] Color: New Color representing the interpolated value
|
|
|
|
|
All components (r, g, b, a) are interpolated independently
|
|
|
|
|
.SS \f[V]to_hex() -> str\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Convert this Color to a hexadecimal string.
|
|
|
|
|
.PP
|
|
|
|
|
Note:
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Returns:\f[R] str: Hex string in format `#RRGGBB' or `#RRGGBBAA'
|
|
|
|
|
(if alpha < 255) Alpha component is only included if not fully opaque (<
|
|
|
|
|
255)
|
2025-12-02 09:21:43 -05:00
|
|
|
.SS ColorLayer
|
|
|
|
|
.PP
|
Replace UIEntity gridstate with DiscreteMap perspective_map; closes #294
Per-entity FOV memory moves from std::vector<UIGridPointState> (two-bool
visible/discovered pairs) to a 3-state DiscreteMap (0=UNKNOWN, 1=DISCOVERED,
2=VISIBLE), exposed as entity.perspective_map. The invariant
visible-subset-of-discovered becomes structural (single value per cell), and
the map is a live, serializable, first-class object rather than an implicit
internal array.
Changes:
- New DiscreteMap C++ class with shared ownership; PyDiscreteMapObject now
holds shared_ptr<DiscreteMap>. UIEntity holds the same shared_ptr.
- New mcrfpy.Perspective IntEnum (UNKNOWN/DISCOVERED/VISIBLE), modelled on
PyInputState.
- entity.perspective_map: lazy-allocated on first access with a grid;
setter validates size against grid and raises ValueError on mismatch;
None clears (next access lazy-reallocates fresh).
- updateVisibility() now demotes 2->1 then promotes visible cells to 2.
- entity.at(x, y) returns grid.at(x, y) when VISIBLE, else None.
- Fog-of-war rendering in UIGridView and UIGrid reads the 3-state map.
- Removed: UIEntity::gridstate, ensureGridstate(), entity.gridstate getter,
UIGridPointState struct + PyUIGridPointStateType.
- Obsolete tests deleted (test_gridpointstate_point,
issue_265_gridpointstate_dangle); 4 new tests cover lazy allocation,
identity, serialization round-trip, size validation, and the
visible-subset-of-discovered invariant.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-17 23:04:27 -04:00
|
|
|
ColorLayer(z_index=-1, name=None, grid_size=None)
|
2025-12-02 09:21:43 -05:00
|
|
|
.PP
|
2026-01-23 20:49:11 -05:00
|
|
|
A grid layer that stores RGBA colors per cell for background/overlay
|
|
|
|
|
effects.
|
|
|
|
|
.PP
|
Replace UIEntity gridstate with DiscreteMap perspective_map; closes #294
Per-entity FOV memory moves from std::vector<UIGridPointState> (two-bool
visible/discovered pairs) to a 3-state DiscreteMap (0=UNKNOWN, 1=DISCOVERED,
2=VISIBLE), exposed as entity.perspective_map. The invariant
visible-subset-of-discovered becomes structural (single value per cell), and
the map is a live, serializable, first-class object rather than an implicit
internal array.
Changes:
- New DiscreteMap C++ class with shared ownership; PyDiscreteMapObject now
holds shared_ptr<DiscreteMap>. UIEntity holds the same shared_ptr.
- New mcrfpy.Perspective IntEnum (UNKNOWN/DISCOVERED/VISIBLE), modelled on
PyInputState.
- entity.perspective_map: lazy-allocated on first access with a grid;
setter validates size against grid and raises ValueError on mismatch;
None clears (next access lazy-reallocates fresh).
- updateVisibility() now demotes 2->1 then promotes visible cells to 2.
- entity.at(x, y) returns grid.at(x, y) when VISIBLE, else None.
- Fog-of-war rendering in UIGridView and UIGrid reads the 3-state map.
- Removed: UIEntity::gridstate, ensureGridstate(), entity.gridstate getter,
UIGridPointState struct + PyUIGridPointStateType.
- Obsolete tests deleted (test_gridpointstate_point,
issue_265_gridpointstate_dangle); 4 new tests cover lazy allocation,
identity, serialization round-trip, size validation, and the
visible-subset-of-discovered invariant.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-17 23:04:27 -04:00
|
|
|
ColorLayers can be created standalone and attached to a Grid via
|
|
|
|
|
add_layer() or passed to the Grid constructor\[cq]s layers parameter.
|
|
|
|
|
Layers with size (0, 0) automatically resize to match the Grid when
|
|
|
|
|
attached.
|
2026-01-23 20:49:11 -05:00
|
|
|
.PP
|
|
|
|
|
Args: z_index (int): Render order relative to entities.
|
|
|
|
|
Negative values render below entities (as backgrounds), positive values
|
|
|
|
|
render above entities (as overlays).
|
Replace UIEntity gridstate with DiscreteMap perspective_map; closes #294
Per-entity FOV memory moves from std::vector<UIGridPointState> (two-bool
visible/discovered pairs) to a 3-state DiscreteMap (0=UNKNOWN, 1=DISCOVERED,
2=VISIBLE), exposed as entity.perspective_map. The invariant
visible-subset-of-discovered becomes structural (single value per cell), and
the map is a live, serializable, first-class object rather than an implicit
internal array.
Changes:
- New DiscreteMap C++ class with shared ownership; PyDiscreteMapObject now
holds shared_ptr<DiscreteMap>. UIEntity holds the same shared_ptr.
- New mcrfpy.Perspective IntEnum (UNKNOWN/DISCOVERED/VISIBLE), modelled on
PyInputState.
- entity.perspective_map: lazy-allocated on first access with a grid;
setter validates size against grid and raises ValueError on mismatch;
None clears (next access lazy-reallocates fresh).
- updateVisibility() now demotes 2->1 then promotes visible cells to 2.
- entity.at(x, y) returns grid.at(x, y) when VISIBLE, else None.
- Fog-of-war rendering in UIGridView and UIGrid reads the 3-state map.
- Removed: UIEntity::gridstate, ensureGridstate(), entity.gridstate getter,
UIGridPointState struct + PyUIGridPointStateType.
- Obsolete tests deleted (test_gridpointstate_point,
issue_265_gridpointstate_dangle); 4 new tests cover lazy allocation,
identity, serialization round-trip, size validation, and the
visible-subset-of-discovered invariant.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-17 23:04:27 -04:00
|
|
|
Default: -1 (background) name (str): Layer name for Grid.layer(name)
|
|
|
|
|
lookup.
|
|
|
|
|
Default: None grid_size (tuple): Dimensions as (width, height).
|
|
|
|
|
If None or (0, 0), the layer will auto-resize when attached to a Grid.
|
2026-01-23 20:49:11 -05:00
|
|
|
Default: None
|
2025-12-02 09:21:43 -05:00
|
|
|
.PP
|
2026-01-23 20:49:11 -05:00
|
|
|
Attributes: z_index (int): Layer z-order relative to entities
|
Replace UIEntity gridstate with DiscreteMap perspective_map; closes #294
Per-entity FOV memory moves from std::vector<UIGridPointState> (two-bool
visible/discovered pairs) to a 3-state DiscreteMap (0=UNKNOWN, 1=DISCOVERED,
2=VISIBLE), exposed as entity.perspective_map. The invariant
visible-subset-of-discovered becomes structural (single value per cell), and
the map is a live, serializable, first-class object rather than an implicit
internal array.
Changes:
- New DiscreteMap C++ class with shared ownership; PyDiscreteMapObject now
holds shared_ptr<DiscreteMap>. UIEntity holds the same shared_ptr.
- New mcrfpy.Perspective IntEnum (UNKNOWN/DISCOVERED/VISIBLE), modelled on
PyInputState.
- entity.perspective_map: lazy-allocated on first access with a grid;
setter validates size against grid and raises ValueError on mismatch;
None clears (next access lazy-reallocates fresh).
- updateVisibility() now demotes 2->1 then promotes visible cells to 2.
- entity.at(x, y) returns grid.at(x, y) when VISIBLE, else None.
- Fog-of-war rendering in UIGridView and UIGrid reads the 3-state map.
- Removed: UIEntity::gridstate, ensureGridstate(), entity.gridstate getter,
UIGridPointState struct + PyUIGridPointStateType.
- Obsolete tests deleted (test_gridpointstate_point,
issue_265_gridpointstate_dangle); 4 new tests cover lazy allocation,
identity, serialization round-trip, size validation, and the
visible-subset-of-discovered invariant.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-17 23:04:27 -04:00
|
|
|
(read/write) name (str): Layer name for lookup (read-only) visible
|
|
|
|
|
(bool): Whether layer is rendered (read/write) grid_size (tuple): Layer
|
|
|
|
|
dimensions as (width, height) (read-only) grid (Grid): Parent Grid or
|
|
|
|
|
None.
|
|
|
|
|
Setting manages layer association.
|
2026-01-23 20:49:11 -05:00
|
|
|
.PP
|
|
|
|
|
Methods: at(x, y) -> Color: Get the color at cell position (x, y) set(x,
|
|
|
|
|
y, color): Set the color at cell position (x, y) fill(color): Fill the
|
|
|
|
|
entire layer with a single color fill_rect(x, y, w, h, color): Fill a
|
|
|
|
|
rectangular region with a color draw_fov(\&...): Draw FOV-based
|
|
|
|
|
visibility colors apply_perspective(entity, \&...): Bind layer to entity
|
|
|
|
|
for automatic FOV updates
|
|
|
|
|
.PP
|
Replace UIEntity gridstate with DiscreteMap perspective_map; closes #294
Per-entity FOV memory moves from std::vector<UIGridPointState> (two-bool
visible/discovered pairs) to a 3-state DiscreteMap (0=UNKNOWN, 1=DISCOVERED,
2=VISIBLE), exposed as entity.perspective_map. The invariant
visible-subset-of-discovered becomes structural (single value per cell), and
the map is a live, serializable, first-class object rather than an implicit
internal array.
Changes:
- New DiscreteMap C++ class with shared ownership; PyDiscreteMapObject now
holds shared_ptr<DiscreteMap>. UIEntity holds the same shared_ptr.
- New mcrfpy.Perspective IntEnum (UNKNOWN/DISCOVERED/VISIBLE), modelled on
PyInputState.
- entity.perspective_map: lazy-allocated on first access with a grid;
setter validates size against grid and raises ValueError on mismatch;
None clears (next access lazy-reallocates fresh).
- updateVisibility() now demotes 2->1 then promotes visible cells to 2.
- entity.at(x, y) returns grid.at(x, y) when VISIBLE, else None.
- Fog-of-war rendering in UIGridView and UIGrid reads the 3-state map.
- Removed: UIEntity::gridstate, ensureGridstate(), entity.gridstate getter,
UIGridPointState struct + PyUIGridPointStateType.
- Obsolete tests deleted (test_gridpointstate_point,
issue_265_gridpointstate_dangle); 4 new tests cover lazy allocation,
identity, serialization round-trip, size validation, and the
visible-subset-of-discovered invariant.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-17 23:04:27 -04:00
|
|
|
Example: fog = mcrfpy.ColorLayer(z_index=-1, name=`fog') grid =
|
|
|
|
|
mcrfpy.Grid(grid_size=(20, 15), layers=[fog]) fog.fill(mcrfpy.Color(40,
|
|
|
|
|
40, 40)) # Dark gray background grid.layer(`fog').set(5, 5,
|
|
|
|
|
mcrfpy.Color(255, 0, 0, 128))
|
2026-01-23 20:49:11 -05:00
|
|
|
.PP
|
F15: convert frozen binding docstrings to MCRF_* macros (#314)
Convert 289 raw PyMethodDef/PyGetSetDef docstring slots to MCRF_METHOD /
MCRF_PROPERTY across the 20 frozen (non-3D) binding files, bringing the
frozen surface to 100% macro compliance (check_frozen_docstrings.sh PASS).
Done via a one-agent-per-file workflow gated by validate_file_docstrings.sh
and per-wave build/doc-rebuild checks.
- Adds #include "McRFPy_Doc.h" where missing; fills the lone genuine doc
gap (UIGrid.at, which was MISSING a doc field in two arrays).
- McRFPy_Doc.h: comment documenting the MCRF_METHOD_DOC comma rule (the
trap that broke the GridLayers conversion mid-run).
- Rebaseline api_surface golden: property types now resolve to real types
instead of "Any" (e.g. grid_pos: Vector, on_cell_click: Callable | None),
and 11 properties correctly flip rw->ro now that their docstrings carry
"read-only" (collections, grid_size, hovered_cell, texture, view — all
verified against NULL setter slots).
- Regenerate docs/stubs/man page from the new docstrings.
Module-level functions use MCRF_METHOD(<name>, ...) (expands identically to
the intended MCRF_FUNCTION; the audit's compliance set is METHOD/PROPERTY).
Experimental 3D/Voxel bindings (src/3d/) remain exempt from the freeze.
Pre-existing failures unrelated to this change: test_animation_*,
test_constructor_comprehensive (reference the removed mcrfpy.Animation and
old constructor arity).
Refs #314
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 01:20:55 -04:00
|
|
|
\f[B]Properties:\f[R] - \f[V]grid\f[R]: Parent Grid or None (Grid |
|
|
|
|
|
None).
|
Replace UIEntity gridstate with DiscreteMap perspective_map; closes #294
Per-entity FOV memory moves from std::vector<UIGridPointState> (two-bool
visible/discovered pairs) to a 3-state DiscreteMap (0=UNKNOWN, 1=DISCOVERED,
2=VISIBLE), exposed as entity.perspective_map. The invariant
visible-subset-of-discovered becomes structural (single value per cell), and
the map is a live, serializable, first-class object rather than an implicit
internal array.
Changes:
- New DiscreteMap C++ class with shared ownership; PyDiscreteMapObject now
holds shared_ptr<DiscreteMap>. UIEntity holds the same shared_ptr.
- New mcrfpy.Perspective IntEnum (UNKNOWN/DISCOVERED/VISIBLE), modelled on
PyInputState.
- entity.perspective_map: lazy-allocated on first access with a grid;
setter validates size against grid and raises ValueError on mismatch;
None clears (next access lazy-reallocates fresh).
- updateVisibility() now demotes 2->1 then promotes visible cells to 2.
- entity.at(x, y) returns grid.at(x, y) when VISIBLE, else None.
- Fog-of-war rendering in UIGridView and UIGrid reads the 3-state map.
- Removed: UIEntity::gridstate, ensureGridstate(), entity.gridstate getter,
UIGridPointState struct + PyUIGridPointStateType.
- Obsolete tests deleted (test_gridpointstate_point,
issue_265_gridpointstate_dangle); 4 new tests cover lazy allocation,
identity, serialization round-trip, size validation, and the
visible-subset-of-discovered invariant.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-17 23:04:27 -04:00
|
|
|
Setting manages layer association and handles lazy allocation.
|
F15: convert frozen binding docstrings to MCRF_* macros (#314)
Convert 289 raw PyMethodDef/PyGetSetDef docstring slots to MCRF_METHOD /
MCRF_PROPERTY across the 20 frozen (non-3D) binding files, bringing the
frozen surface to 100% macro compliance (check_frozen_docstrings.sh PASS).
Done via a one-agent-per-file workflow gated by validate_file_docstrings.sh
and per-wave build/doc-rebuild checks.
- Adds #include "McRFPy_Doc.h" where missing; fills the lone genuine doc
gap (UIGrid.at, which was MISSING a doc field in two arrays).
- McRFPy_Doc.h: comment documenting the MCRF_METHOD_DOC comma rule (the
trap that broke the GridLayers conversion mid-run).
- Rebaseline api_surface golden: property types now resolve to real types
instead of "Any" (e.g. grid_pos: Vector, on_cell_click: Callable | None),
and 11 properties correctly flip rw->ro now that their docstrings carry
"read-only" (collections, grid_size, hovered_cell, texture, view — all
verified against NULL setter slots).
- Regenerate docs/stubs/man page from the new docstrings.
Module-level functions use MCRF_METHOD(<name>, ...) (expands identically to
the intended MCRF_FUNCTION; the audit's compliance set is METHOD/PROPERTY).
Experimental 3D/Voxel bindings (src/3d/) remain exempt from the freeze.
Pre-existing failures unrelated to this change: test_animation_*,
test_constructor_comprehensive (reference the removed mcrfpy.Animation and
old constructor arity).
Refs #314
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 01:20:55 -04:00
|
|
|
- \f[V]grid_size\f[R] \f[I](read-only)\f[R]: Layer dimensions as (width,
|
|
|
|
|
height) tuple (tuple, read-only).
|
Replace UIEntity gridstate with DiscreteMap perspective_map; closes #294
Per-entity FOV memory moves from std::vector<UIGridPointState> (two-bool
visible/discovered pairs) to a 3-state DiscreteMap (0=UNKNOWN, 1=DISCOVERED,
2=VISIBLE), exposed as entity.perspective_map. The invariant
visible-subset-of-discovered becomes structural (single value per cell), and
the map is a live, serializable, first-class object rather than an implicit
internal array.
Changes:
- New DiscreteMap C++ class with shared ownership; PyDiscreteMapObject now
holds shared_ptr<DiscreteMap>. UIEntity holds the same shared_ptr.
- New mcrfpy.Perspective IntEnum (UNKNOWN/DISCOVERED/VISIBLE), modelled on
PyInputState.
- entity.perspective_map: lazy-allocated on first access with a grid;
setter validates size against grid and raises ValueError on mismatch;
None clears (next access lazy-reallocates fresh).
- updateVisibility() now demotes 2->1 then promotes visible cells to 2.
- entity.at(x, y) returns grid.at(x, y) when VISIBLE, else None.
- Fog-of-war rendering in UIGridView and UIGrid reads the 3-state map.
- Removed: UIEntity::gridstate, ensureGridstate(), entity.gridstate getter,
UIGridPointState struct + PyUIGridPointStateType.
- Obsolete tests deleted (test_gridpointstate_point,
issue_265_gridpointstate_dangle); 4 new tests cover lazy allocation,
identity, serialization round-trip, size validation, and the
visible-subset-of-discovered invariant.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-17 23:04:27 -04:00
|
|
|
- \f[V]name\f[R] \f[I](read-only)\f[R]: Layer name (str, read-only).
|
|
|
|
|
Used for Grid.layer(name) lookup.
|
F15: convert frozen binding docstrings to MCRF_* macros (#314)
Convert 289 raw PyMethodDef/PyGetSetDef docstring slots to MCRF_METHOD /
MCRF_PROPERTY across the 20 frozen (non-3D) binding files, bringing the
frozen surface to 100% macro compliance (check_frozen_docstrings.sh PASS).
Done via a one-agent-per-file workflow gated by validate_file_docstrings.sh
and per-wave build/doc-rebuild checks.
- Adds #include "McRFPy_Doc.h" where missing; fills the lone genuine doc
gap (UIGrid.at, which was MISSING a doc field in two arrays).
- McRFPy_Doc.h: comment documenting the MCRF_METHOD_DOC comma rule (the
trap that broke the GridLayers conversion mid-run).
- Rebaseline api_surface golden: property types now resolve to real types
instead of "Any" (e.g. grid_pos: Vector, on_cell_click: Callable | None),
and 11 properties correctly flip rw->ro now that their docstrings carry
"read-only" (collections, grid_size, hovered_cell, texture, view — all
verified against NULL setter slots).
- Regenerate docs/stubs/man page from the new docstrings.
Module-level functions use MCRF_METHOD(<name>, ...) (expands identically to
the intended MCRF_FUNCTION; the audit's compliance set is METHOD/PROPERTY).
Experimental 3D/Voxel bindings (src/3d/) remain exempt from the freeze.
Pre-existing failures unrelated to this change: test_animation_*,
test_constructor_comprehensive (reference the removed mcrfpy.Animation and
old constructor arity).
Refs #314
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 01:20:55 -04:00
|
|
|
- \f[V]visible\f[R]: Whether the layer is rendered (bool).
|
|
|
|
|
- \f[V]z_index\f[R]: Layer z-order (int).
|
2026-01-23 20:49:11 -05:00
|
|
|
Negative values render below entities.
|
2025-12-02 09:21:43 -05:00
|
|
|
.PP
|
2026-01-23 20:49:11 -05:00
|
|
|
\f[B]Methods:\f[R]
|
F15: convert frozen binding docstrings to MCRF_* macros (#314)
Convert 289 raw PyMethodDef/PyGetSetDef docstring slots to MCRF_METHOD /
MCRF_PROPERTY across the 20 frozen (non-3D) binding files, bringing the
frozen surface to 100% macro compliance (check_frozen_docstrings.sh PASS).
Done via a one-agent-per-file workflow gated by validate_file_docstrings.sh
and per-wave build/doc-rebuild checks.
- Adds #include "McRFPy_Doc.h" where missing; fills the lone genuine doc
gap (UIGrid.at, which was MISSING a doc field in two arrays).
- McRFPy_Doc.h: comment documenting the MCRF_METHOD_DOC comma rule (the
trap that broke the GridLayers conversion mid-run).
- Rebaseline api_surface golden: property types now resolve to real types
instead of "Any" (e.g. grid_pos: Vector, on_cell_click: Callable | None),
and 11 properties correctly flip rw->ro now that their docstrings carry
"read-only" (collections, grid_size, hovered_cell, texture, view — all
verified against NULL setter slots).
- Regenerate docs/stubs/man page from the new docstrings.
Module-level functions use MCRF_METHOD(<name>, ...) (expands identically to
the intended MCRF_FUNCTION; the audit's compliance set is METHOD/PROPERTY).
Experimental 3D/Voxel bindings (src/3d/) remain exempt from the freeze.
Pre-existing failures unrelated to this change: test_animation_*,
test_constructor_comprehensive (reference the removed mcrfpy.Animation and
old constructor arity).
Refs #314
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 01:20:55 -04:00
|
|
|
.SS \f[V]apply_gradient(source: HeightMap, range: tuple, color_low: Color, color_high: Color) -> ColorLayer\f[R]
|
2025-12-02 09:21:43 -05:00
|
|
|
.PP
|
F15: convert frozen binding docstrings to MCRF_* macros (#314)
Convert 289 raw PyMethodDef/PyGetSetDef docstring slots to MCRF_METHOD /
MCRF_PROPERTY across the 20 frozen (non-3D) binding files, bringing the
frozen surface to 100% macro compliance (check_frozen_docstrings.sh PASS).
Done via a one-agent-per-file workflow gated by validate_file_docstrings.sh
and per-wave build/doc-rebuild checks.
- Adds #include "McRFPy_Doc.h" where missing; fills the lone genuine doc
gap (UIGrid.at, which was MISSING a doc field in two arrays).
- McRFPy_Doc.h: comment documenting the MCRF_METHOD_DOC comma rule (the
trap that broke the GridLayers conversion mid-run).
- Rebaseline api_surface golden: property types now resolve to real types
instead of "Any" (e.g. grid_pos: Vector, on_cell_click: Callable | None),
and 11 properties correctly flip rw->ro now that their docstrings carry
"read-only" (collections, grid_size, hovered_cell, texture, view — all
verified against NULL setter slots).
- Regenerate docs/stubs/man page from the new docstrings.
Module-level functions use MCRF_METHOD(<name>, ...) (expands identically to
the intended MCRF_FUNCTION; the audit's compliance set is METHOD/PROPERTY).
Experimental 3D/Voxel bindings (src/3d/) remain exempt from the freeze.
Pre-existing failures unrelated to this change: test_animation_*,
test_constructor_comprehensive (reference the removed mcrfpy.Animation and
old constructor arity).
Refs #314
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 01:20:55 -04:00
|
|
|
Interpolate between two colors based on HeightMap value within a range.
|
|
|
|
|
Uses the original heightmap value for smooth transitions.
|
2025-12-02 09:21:43 -05:00
|
|
|
.PP
|
F15: convert frozen binding docstrings to MCRF_* macros (#314)
Convert 289 raw PyMethodDef/PyGetSetDef docstring slots to MCRF_METHOD /
MCRF_PROPERTY across the 20 frozen (non-3D) binding files, bringing the
frozen surface to 100% macro compliance (check_frozen_docstrings.sh PASS).
Done via a one-agent-per-file workflow gated by validate_file_docstrings.sh
and per-wave build/doc-rebuild checks.
- Adds #include "McRFPy_Doc.h" where missing; fills the lone genuine doc
gap (UIGrid.at, which was MISSING a doc field in two arrays).
- McRFPy_Doc.h: comment documenting the MCRF_METHOD_DOC comma rule (the
trap that broke the GridLayers conversion mid-run).
- Rebaseline api_surface golden: property types now resolve to real types
instead of "Any" (e.g. grid_pos: Vector, on_cell_click: Callable | None),
and 11 properties correctly flip rw->ro now that their docstrings carry
"read-only" (collections, grid_size, hovered_cell, texture, view — all
verified against NULL setter slots).
- Regenerate docs/stubs/man page from the new docstrings.
Module-level functions use MCRF_METHOD(<name>, ...) (expands identically to
the intended MCRF_FUNCTION; the audit's compliance set is METHOD/PROPERTY).
Experimental 3D/Voxel bindings (src/3d/) remain exempt from the freeze.
Pre-existing failures unrelated to this change: test_animation_*,
test_constructor_comprehensive (reference the removed mcrfpy.Animation and
old constructor arity).
Refs #314
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 01:20:55 -04:00
|
|
|
\f[B]Arguments:\f[R] - \f[V]source\f[R]: Source heightmap (must match
|
|
|
|
|
layer dimensions) - \f[V]range\f[R]: Value range as (min, max) inclusive
|
|
|
|
|
- \f[V]color_low\f[R]: Color at range minimum - \f[V]color_high\f[R]:
|
|
|
|
|
Color at range maximum
|
2026-01-23 20:49:11 -05:00
|
|
|
.PP
|
F15: convert frozen binding docstrings to MCRF_* macros (#314)
Convert 289 raw PyMethodDef/PyGetSetDef docstring slots to MCRF_METHOD /
MCRF_PROPERTY across the 20 frozen (non-3D) binding files, bringing the
frozen surface to 100% macro compliance (check_frozen_docstrings.sh PASS).
Done via a one-agent-per-file workflow gated by validate_file_docstrings.sh
and per-wave build/doc-rebuild checks.
- Adds #include "McRFPy_Doc.h" where missing; fills the lone genuine doc
gap (UIGrid.at, which was MISSING a doc field in two arrays).
- McRFPy_Doc.h: comment documenting the MCRF_METHOD_DOC comma rule (the
trap that broke the GridLayers conversion mid-run).
- Rebaseline api_surface golden: property types now resolve to real types
instead of "Any" (e.g. grid_pos: Vector, on_cell_click: Callable | None),
and 11 properties correctly flip rw->ro now that their docstrings carry
"read-only" (collections, grid_size, hovered_cell, texture, view — all
verified against NULL setter slots).
- Regenerate docs/stubs/man page from the new docstrings.
Module-level functions use MCRF_METHOD(<name>, ...) (expands identically to
the intended MCRF_FUNCTION; the audit's compliance set is METHOD/PROPERTY).
Experimental 3D/Voxel bindings (src/3d/) remain exempt from the freeze.
Pre-existing failures unrelated to this change: test_animation_*,
test_constructor_comprehensive (reference the removed mcrfpy.Animation and
old constructor arity).
Refs #314
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 01:20:55 -04:00
|
|
|
\f[B]Returns:\f[R] self for method chaining
|
F15: correct docstring accuracy from adversarial verify pass (#314)
Follow-up to the macro conversion: an adversarial verify pass (one agent per
file vs. the C++ implementation + stubs) found 62 content issues; the real
ones are fixed here.
Callbacks (centralized):
- on_click: receives (pos, MouseButton, InputState), not str (8 files).
- on_enter/on_exit/on_move (UIBase.h): hover passes only (pos) -- removed the
fictional button/action args.
- bounds/global_bounds (UIBase.h): mark (tuple, read-only).
Signatures / types:
- Grid.find_path: document heuristic + weight; get_dijkstra_map: document roots;
compute_fov: FOV | int = FOV.BASIC (not the C constant FOV_BASIC) + Returns;
at/is_in_fov: document (pos) and (x, y) call forms.
- get_metrics: document all 16 returned dict keys (was 8); bresenham: drop the
bogus '*' keyword-only separator.
- Nullable defaults typed correctly: BSP seed/size, ColorLayer draw_fov/
apply_perspective Color|None, Entity.visible_entities radius int=-1 (None is
rejected by the 'i' parser -> see #319).
- Type-token fixes: GridView.center -> Vector; GridView.texture -> (None,
read-only) (unimplemented, #318); GridPoint.grid_pos -> (tuple, read-only);
EntityCollection.find -> Entity | list[Entity] | None; extend RuntimeError;
UniformCollection.values -> list[float | tuple | None].
- automation: onScreen (x, y) form documented; scroll notes x is ignored (#317).
Also: correct stale AStarPath/DijkstraMap signatures in docs/api-audit-2026-04.md
(the bindings were right, the audit table was outdated). Rebaseline the API
snapshot golden and regenerate docs/stubs.
Code-level bugs surfaced by the pass are filed as #317, #318, #319.
Refs #314, #317, #318, #319
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 06:43:47 -04:00
|
|
|
.SS \f[V]apply_perspective(entity: Entity, visible: Color | None = None, discovered: Color | None = None, unknown: Color | None = None) -> None\f[R]
|
refactor: Rename click kwarg to on_click for API consistency (closes #126)
BREAKING CHANGE: Constructor keyword argument renamed from `click` to
`on_click` for all UIDrawable types (Frame, Caption, Sprite, Grid, Line,
Circle, Arc).
Before: Frame(pos=(0,0), size=(100,100), click=handler)
After: Frame(pos=(0,0), size=(100,100), on_click=handler)
The property name was already `on_click` - this makes the constructor
kwarg match, completing the callback naming standardization from #139.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-28 14:31:22 -05:00
|
|
|
.PP
|
|
|
|
|
Bind this layer to an entity for automatic FOV updates.
|
F15: convert frozen binding docstrings to MCRF_* macros (#314)
Convert 289 raw PyMethodDef/PyGetSetDef docstring slots to MCRF_METHOD /
MCRF_PROPERTY across the 20 frozen (non-3D) binding files, bringing the
frozen surface to 100% macro compliance (check_frozen_docstrings.sh PASS).
Done via a one-agent-per-file workflow gated by validate_file_docstrings.sh
and per-wave build/doc-rebuild checks.
- Adds #include "McRFPy_Doc.h" where missing; fills the lone genuine doc
gap (UIGrid.at, which was MISSING a doc field in two arrays).
- McRFPy_Doc.h: comment documenting the MCRF_METHOD_DOC comma rule (the
trap that broke the GridLayers conversion mid-run).
- Rebaseline api_surface golden: property types now resolve to real types
instead of "Any" (e.g. grid_pos: Vector, on_cell_click: Callable | None),
and 11 properties correctly flip rw->ro now that their docstrings carry
"read-only" (collections, grid_size, hovered_cell, texture, view — all
verified against NULL setter slots).
- Regenerate docs/stubs/man page from the new docstrings.
Module-level functions use MCRF_METHOD(<name>, ...) (expands identically to
the intended MCRF_FUNCTION; the audit's compliance set is METHOD/PROPERTY).
Experimental 3D/Voxel bindings (src/3d/) remain exempt from the freeze.
Pre-existing failures unrelated to this change: test_animation_*,
test_constructor_comprehensive (reference the removed mcrfpy.Animation and
old constructor arity).
Refs #314
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 01:20:55 -04:00
|
|
|
After binding, call update_perspective() when the entity moves.
|
2026-01-23 20:49:11 -05:00
|
|
|
.PP
|
F15: convert frozen binding docstrings to MCRF_* macros (#314)
Convert 289 raw PyMethodDef/PyGetSetDef docstring slots to MCRF_METHOD /
MCRF_PROPERTY across the 20 frozen (non-3D) binding files, bringing the
frozen surface to 100% macro compliance (check_frozen_docstrings.sh PASS).
Done via a one-agent-per-file workflow gated by validate_file_docstrings.sh
and per-wave build/doc-rebuild checks.
- Adds #include "McRFPy_Doc.h" where missing; fills the lone genuine doc
gap (UIGrid.at, which was MISSING a doc field in two arrays).
- McRFPy_Doc.h: comment documenting the MCRF_METHOD_DOC comma rule (the
trap that broke the GridLayers conversion mid-run).
- Rebaseline api_surface golden: property types now resolve to real types
instead of "Any" (e.g. grid_pos: Vector, on_cell_click: Callable | None),
and 11 properties correctly flip rw->ro now that their docstrings carry
"read-only" (collections, grid_size, hovered_cell, texture, view — all
verified against NULL setter slots).
- Regenerate docs/stubs/man page from the new docstrings.
Module-level functions use MCRF_METHOD(<name>, ...) (expands identically to
the intended MCRF_FUNCTION; the audit's compliance set is METHOD/PROPERTY).
Experimental 3D/Voxel bindings (src/3d/) remain exempt from the freeze.
Pre-existing failures unrelated to this change: test_animation_*,
test_constructor_comprehensive (reference the removed mcrfpy.Animation and
old constructor arity).
Refs #314
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 01:20:55 -04:00
|
|
|
\f[B]Arguments:\f[R] - \f[V]entity\f[R]: The entity whose perspective to
|
|
|
|
|
track - \f[V]visible\f[R]: Color for currently visible cells -
|
|
|
|
|
\f[V]discovered\f[R]: Color for previously seen cells -
|
|
|
|
|
\f[V]unknown\f[R]: Color for never-seen cells
|
|
|
|
|
.SS \f[V]apply_ranges(source: HeightMap, ranges: list) -> ColorLayer\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Apply multiple color assignments from a HeightMap in a single pass.
|
|
|
|
|
Later ranges override earlier ones if overlapping.
|
2026-01-23 20:49:11 -05:00
|
|
|
.PP
|
|
|
|
|
Note:
|
|
|
|
|
.PP
|
F15: convert frozen binding docstrings to MCRF_* macros (#314)
Convert 289 raw PyMethodDef/PyGetSetDef docstring slots to MCRF_METHOD /
MCRF_PROPERTY across the 20 frozen (non-3D) binding files, bringing the
frozen surface to 100% macro compliance (check_frozen_docstrings.sh PASS).
Done via a one-agent-per-file workflow gated by validate_file_docstrings.sh
and per-wave build/doc-rebuild checks.
- Adds #include "McRFPy_Doc.h" where missing; fills the lone genuine doc
gap (UIGrid.at, which was MISSING a doc field in two arrays).
- McRFPy_Doc.h: comment documenting the MCRF_METHOD_DOC comma rule (the
trap that broke the GridLayers conversion mid-run).
- Rebaseline api_surface golden: property types now resolve to real types
instead of "Any" (e.g. grid_pos: Vector, on_cell_click: Callable | None),
and 11 properties correctly flip rw->ro now that their docstrings carry
"read-only" (collections, grid_size, hovered_cell, texture, view — all
verified against NULL setter slots).
- Regenerate docs/stubs/man page from the new docstrings.
Module-level functions use MCRF_METHOD(<name>, ...) (expands identically to
the intended MCRF_FUNCTION; the audit's compliance set is METHOD/PROPERTY).
Experimental 3D/Voxel bindings (src/3d/) remain exempt from the freeze.
Pre-existing failures unrelated to this change: test_animation_*,
test_constructor_comprehensive (reference the removed mcrfpy.Animation and
old constructor arity).
Refs #314
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 01:20:55 -04:00
|
|
|
\f[B]Arguments:\f[R] - \f[V]source\f[R]: Source heightmap (must match
|
|
|
|
|
layer dimensions) - \f[V]ranges\f[R]: List of range specs: ((min, max),
|
|
|
|
|
color) for fixed or ((min, max), (color_low, color_high)) for gradient
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Returns:\f[R] self for method chaining Cells not matching any range
|
|
|
|
|
are left unchanged.
|
|
|
|
|
.SS \f[V]apply_threshold(source: HeightMap, range: tuple, color: Color) -> ColorLayer\f[R]
|
2026-01-23 20:49:11 -05:00
|
|
|
.PP
|
F15: convert frozen binding docstrings to MCRF_* macros (#314)
Convert 289 raw PyMethodDef/PyGetSetDef docstring slots to MCRF_METHOD /
MCRF_PROPERTY across the 20 frozen (non-3D) binding files, bringing the
frozen surface to 100% macro compliance (check_frozen_docstrings.sh PASS).
Done via a one-agent-per-file workflow gated by validate_file_docstrings.sh
and per-wave build/doc-rebuild checks.
- Adds #include "McRFPy_Doc.h" where missing; fills the lone genuine doc
gap (UIGrid.at, which was MISSING a doc field in two arrays).
- McRFPy_Doc.h: comment documenting the MCRF_METHOD_DOC comma rule (the
trap that broke the GridLayers conversion mid-run).
- Rebaseline api_surface golden: property types now resolve to real types
instead of "Any" (e.g. grid_pos: Vector, on_cell_click: Callable | None),
and 11 properties correctly flip rw->ro now that their docstrings carry
"read-only" (collections, grid_size, hovered_cell, texture, view — all
verified against NULL setter slots).
- Regenerate docs/stubs/man page from the new docstrings.
Module-level functions use MCRF_METHOD(<name>, ...) (expands identically to
the intended MCRF_FUNCTION; the audit's compliance set is METHOD/PROPERTY).
Experimental 3D/Voxel bindings (src/3d/) remain exempt from the freeze.
Pre-existing failures unrelated to this change: test_animation_*,
test_constructor_comprehensive (reference the removed mcrfpy.Animation and
old constructor arity).
Refs #314
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 01:20:55 -04:00
|
|
|
Set a fixed color for cells where the HeightMap value falls within a
|
|
|
|
|
range.
|
2026-01-23 20:49:11 -05:00
|
|
|
.PP
|
F15: convert frozen binding docstrings to MCRF_* macros (#314)
Convert 289 raw PyMethodDef/PyGetSetDef docstring slots to MCRF_METHOD /
MCRF_PROPERTY across the 20 frozen (non-3D) binding files, bringing the
frozen surface to 100% macro compliance (check_frozen_docstrings.sh PASS).
Done via a one-agent-per-file workflow gated by validate_file_docstrings.sh
and per-wave build/doc-rebuild checks.
- Adds #include "McRFPy_Doc.h" where missing; fills the lone genuine doc
gap (UIGrid.at, which was MISSING a doc field in two arrays).
- McRFPy_Doc.h: comment documenting the MCRF_METHOD_DOC comma rule (the
trap that broke the GridLayers conversion mid-run).
- Rebaseline api_surface golden: property types now resolve to real types
instead of "Any" (e.g. grid_pos: Vector, on_cell_click: Callable | None),
and 11 properties correctly flip rw->ro now that their docstrings carry
"read-only" (collections, grid_size, hovered_cell, texture, view — all
verified against NULL setter slots).
- Regenerate docs/stubs/man page from the new docstrings.
Module-level functions use MCRF_METHOD(<name>, ...) (expands identically to
the intended MCRF_FUNCTION; the audit's compliance set is METHOD/PROPERTY).
Experimental 3D/Voxel bindings (src/3d/) remain exempt from the freeze.
Pre-existing failures unrelated to this change: test_animation_*,
test_constructor_comprehensive (reference the removed mcrfpy.Animation and
old constructor arity).
Refs #314
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 01:20:55 -04:00
|
|
|
\f[B]Arguments:\f[R] - \f[V]source\f[R]: Source heightmap (must match
|
|
|
|
|
layer dimensions) - \f[V]range\f[R]: Value range as (min, max) inclusive
|
|
|
|
|
- \f[V]color\f[R]: Color or (r, g, b[, a]) tuple to set for cells in
|
|
|
|
|
range
|
2026-01-23 20:49:11 -05:00
|
|
|
.PP
|
|
|
|
|
\f[B]Returns:\f[R] self for method chaining
|
F15: correct docstring accuracy from adversarial verify pass (#314)
Follow-up to the macro conversion: an adversarial verify pass (one agent per
file vs. the C++ implementation + stubs) found 62 content issues; the real
ones are fixed here.
Callbacks (centralized):
- on_click: receives (pos, MouseButton, InputState), not str (8 files).
- on_enter/on_exit/on_move (UIBase.h): hover passes only (pos) -- removed the
fictional button/action args.
- bounds/global_bounds (UIBase.h): mark (tuple, read-only).
Signatures / types:
- Grid.find_path: document heuristic + weight; get_dijkstra_map: document roots;
compute_fov: FOV | int = FOV.BASIC (not the C constant FOV_BASIC) + Returns;
at/is_in_fov: document (pos) and (x, y) call forms.
- get_metrics: document all 16 returned dict keys (was 8); bresenham: drop the
bogus '*' keyword-only separator.
- Nullable defaults typed correctly: BSP seed/size, ColorLayer draw_fov/
apply_perspective Color|None, Entity.visible_entities radius int=-1 (None is
rejected by the 'i' parser -> see #319).
- Type-token fixes: GridView.center -> Vector; GridView.texture -> (None,
read-only) (unimplemented, #318); GridPoint.grid_pos -> (tuple, read-only);
EntityCollection.find -> Entity | list[Entity] | None; extend RuntimeError;
UniformCollection.values -> list[float | tuple | None].
- automation: onScreen (x, y) form documented; scroll notes x is ignored (#317).
Also: correct stale AStarPath/DijkstraMap signatures in docs/api-audit-2026-04.md
(the bindings were right, the audit table was outdated). Rebaseline the API
snapshot golden and regenerate docs/stubs.
Code-level bugs surfaced by the pass are filed as #317, #318, #319.
Refs #314, #317, #318, #319
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 06:43:47 -04:00
|
|
|
.SS \f[V]at(pos: tuple | Vector) or (x: int, y: int) -> Color\f[R]
|
2025-12-02 09:21:43 -05:00
|
|
|
.PP
|
F15: convert frozen binding docstrings to MCRF_* macros (#314)
Convert 289 raw PyMethodDef/PyGetSetDef docstring slots to MCRF_METHOD /
MCRF_PROPERTY across the 20 frozen (non-3D) binding files, bringing the
frozen surface to 100% macro compliance (check_frozen_docstrings.sh PASS).
Done via a one-agent-per-file workflow gated by validate_file_docstrings.sh
and per-wave build/doc-rebuild checks.
- Adds #include "McRFPy_Doc.h" where missing; fills the lone genuine doc
gap (UIGrid.at, which was MISSING a doc field in two arrays).
- McRFPy_Doc.h: comment documenting the MCRF_METHOD_DOC comma rule (the
trap that broke the GridLayers conversion mid-run).
- Rebaseline api_surface golden: property types now resolve to real types
instead of "Any" (e.g. grid_pos: Vector, on_cell_click: Callable | None),
and 11 properties correctly flip rw->ro now that their docstrings carry
"read-only" (collections, grid_size, hovered_cell, texture, view — all
verified against NULL setter slots).
- Regenerate docs/stubs/man page from the new docstrings.
Module-level functions use MCRF_METHOD(<name>, ...) (expands identically to
the intended MCRF_FUNCTION; the audit's compliance set is METHOD/PROPERTY).
Experimental 3D/Voxel bindings (src/3d/) remain exempt from the freeze.
Pre-existing failures unrelated to this change: test_animation_*,
test_constructor_comprehensive (reference the removed mcrfpy.Animation and
old constructor arity).
Refs #314
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 01:20:55 -04:00
|
|
|
Get the color at a cell position.
|
2026-01-23 20:49:11 -05:00
|
|
|
.PP
|
|
|
|
|
\f[B]Arguments:\f[R] - \f[V]pos\f[R]: Position as (x, y) tuple, list, or
|
F15: convert frozen binding docstrings to MCRF_* macros (#314)
Convert 289 raw PyMethodDef/PyGetSetDef docstring slots to MCRF_METHOD /
MCRF_PROPERTY across the 20 frozen (non-3D) binding files, bringing the
frozen surface to 100% macro compliance (check_frozen_docstrings.sh PASS).
Done via a one-agent-per-file workflow gated by validate_file_docstrings.sh
and per-wave build/doc-rebuild checks.
- Adds #include "McRFPy_Doc.h" where missing; fills the lone genuine doc
gap (UIGrid.at, which was MISSING a doc field in two arrays).
- McRFPy_Doc.h: comment documenting the MCRF_METHOD_DOC comma rule (the
trap that broke the GridLayers conversion mid-run).
- Rebaseline api_surface golden: property types now resolve to real types
instead of "Any" (e.g. grid_pos: Vector, on_cell_click: Callable | None),
and 11 properties correctly flip rw->ro now that their docstrings carry
"read-only" (collections, grid_size, hovered_cell, texture, view — all
verified against NULL setter slots).
- Regenerate docs/stubs/man page from the new docstrings.
Module-level functions use MCRF_METHOD(<name>, ...) (expands identically to
the intended MCRF_FUNCTION; the audit's compliance set is METHOD/PROPERTY).
Experimental 3D/Voxel bindings (src/3d/) remain exempt from the freeze.
Pre-existing failures unrelated to this change: test_animation_*,
test_constructor_comprehensive (reference the removed mcrfpy.Animation and
old constructor arity).
Refs #314
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 01:20:55 -04:00
|
|
|
Vector; or pass x and y separately
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Returns:\f[R] Color at the specified cell
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Raises:\f[R] IndexError: If coordinates are out of bounds
|
|
|
|
|
.SS \f[V]clear_perspective() -> None\f[R]
|
refactor: Rename click kwarg to on_click for API consistency (closes #126)
BREAKING CHANGE: Constructor keyword argument renamed from `click` to
`on_click` for all UIDrawable types (Frame, Caption, Sprite, Grid, Line,
Circle, Arc).
Before: Frame(pos=(0,0), size=(100,100), click=handler)
After: Frame(pos=(0,0), size=(100,100), on_click=handler)
The property name was already `on_click` - this makes the constructor
kwarg match, completing the callback naming standardization from #139.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-28 14:31:22 -05:00
|
|
|
.PP
|
|
|
|
|
Remove the perspective binding from this layer.
|
F15: correct docstring accuracy from adversarial verify pass (#314)
Follow-up to the macro conversion: an adversarial verify pass (one agent per
file vs. the C++ implementation + stubs) found 62 content issues; the real
ones are fixed here.
Callbacks (centralized):
- on_click: receives (pos, MouseButton, InputState), not str (8 files).
- on_enter/on_exit/on_move (UIBase.h): hover passes only (pos) -- removed the
fictional button/action args.
- bounds/global_bounds (UIBase.h): mark (tuple, read-only).
Signatures / types:
- Grid.find_path: document heuristic + weight; get_dijkstra_map: document roots;
compute_fov: FOV | int = FOV.BASIC (not the C constant FOV_BASIC) + Returns;
at/is_in_fov: document (pos) and (x, y) call forms.
- get_metrics: document all 16 returned dict keys (was 8); bresenham: drop the
bogus '*' keyword-only separator.
- Nullable defaults typed correctly: BSP seed/size, ColorLayer draw_fov/
apply_perspective Color|None, Entity.visible_entities radius int=-1 (None is
rejected by the 'i' parser -> see #319).
- Type-token fixes: GridView.center -> Vector; GridView.texture -> (None,
read-only) (unimplemented, #318); GridPoint.grid_pos -> (tuple, read-only);
EntityCollection.find -> Entity | list[Entity] | None; extend RuntimeError;
UniformCollection.values -> list[float | tuple | None].
- automation: onScreen (x, y) form documented; scroll notes x is ignored (#317).
Also: correct stale AStarPath/DijkstraMap signatures in docs/api-audit-2026-04.md
(the bindings were right, the audit table was outdated). Rebaseline the API
snapshot golden and regenerate docs/stubs.
Code-level bugs surfaced by the pass are filed as #317, #318, #319.
Refs #314, #317, #318, #319
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 06:43:47 -04:00
|
|
|
.SS \f[V]draw_fov(source: tuple, radius: int | None = None, fov: FOV | None = None, visible: Color | None = None, discovered: Color | None = None, unknown: Color | None = None) -> None\f[R]
|
F15: convert frozen binding docstrings to MCRF_* macros (#314)
Convert 289 raw PyMethodDef/PyGetSetDef docstring slots to MCRF_METHOD /
MCRF_PROPERTY across the 20 frozen (non-3D) binding files, bringing the
frozen surface to 100% macro compliance (check_frozen_docstrings.sh PASS).
Done via a one-agent-per-file workflow gated by validate_file_docstrings.sh
and per-wave build/doc-rebuild checks.
- Adds #include "McRFPy_Doc.h" where missing; fills the lone genuine doc
gap (UIGrid.at, which was MISSING a doc field in two arrays).
- McRFPy_Doc.h: comment documenting the MCRF_METHOD_DOC comma rule (the
trap that broke the GridLayers conversion mid-run).
- Rebaseline api_surface golden: property types now resolve to real types
instead of "Any" (e.g. grid_pos: Vector, on_cell_click: Callable | None),
and 11 properties correctly flip rw->ro now that their docstrings carry
"read-only" (collections, grid_size, hovered_cell, texture, view — all
verified against NULL setter slots).
- Regenerate docs/stubs/man page from the new docstrings.
Module-level functions use MCRF_METHOD(<name>, ...) (expands identically to
the intended MCRF_FUNCTION; the audit's compliance set is METHOD/PROPERTY).
Experimental 3D/Voxel bindings (src/3d/) remain exempt from the freeze.
Pre-existing failures unrelated to this change: test_animation_*,
test_constructor_comprehensive (reference the removed mcrfpy.Animation and
old constructor arity).
Refs #314
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 01:20:55 -04:00
|
|
|
.PP
|
|
|
|
|
Paint cells based on field-of-view visibility from a source position.
|
refactor: Rename click kwarg to on_click for API consistency (closes #126)
BREAKING CHANGE: Constructor keyword argument renamed from `click` to
`on_click` for all UIDrawable types (Frame, Caption, Sprite, Grid, Line,
Circle, Arc).
Before: Frame(pos=(0,0), size=(100,100), click=handler)
After: Frame(pos=(0,0), size=(100,100), on_click=handler)
The property name was already `on_click` - this makes the constructor
kwarg match, completing the callback naming standardization from #139.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-28 14:31:22 -05:00
|
|
|
.PP
|
F15: convert frozen binding docstrings to MCRF_* macros (#314)
Convert 289 raw PyMethodDef/PyGetSetDef docstring slots to MCRF_METHOD /
MCRF_PROPERTY across the 20 frozen (non-3D) binding files, bringing the
frozen surface to 100% macro compliance (check_frozen_docstrings.sh PASS).
Done via a one-agent-per-file workflow gated by validate_file_docstrings.sh
and per-wave build/doc-rebuild checks.
- Adds #include "McRFPy_Doc.h" where missing; fills the lone genuine doc
gap (UIGrid.at, which was MISSING a doc field in two arrays).
- McRFPy_Doc.h: comment documenting the MCRF_METHOD_DOC comma rule (the
trap that broke the GridLayers conversion mid-run).
- Rebaseline api_surface golden: property types now resolve to real types
instead of "Any" (e.g. grid_pos: Vector, on_cell_click: Callable | None),
and 11 properties correctly flip rw->ro now that their docstrings carry
"read-only" (collections, grid_size, hovered_cell, texture, view — all
verified against NULL setter slots).
- Regenerate docs/stubs/man page from the new docstrings.
Module-level functions use MCRF_METHOD(<name>, ...) (expands identically to
the intended MCRF_FUNCTION; the audit's compliance set is METHOD/PROPERTY).
Experimental 3D/Voxel bindings (src/3d/) remain exempt from the freeze.
Pre-existing failures unrelated to this change: test_animation_*,
test_constructor_comprehensive (reference the removed mcrfpy.Animation and
old constructor arity).
Refs #314
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 01:20:55 -04:00
|
|
|
Note:
|
refactor: Rename click kwarg to on_click for API consistency (closes #126)
BREAKING CHANGE: Constructor keyword argument renamed from `click` to
`on_click` for all UIDrawable types (Frame, Caption, Sprite, Grid, Line,
Circle, Arc).
Before: Frame(pos=(0,0), size=(100,100), click=handler)
After: Frame(pos=(0,0), size=(100,100), on_click=handler)
The property name was already `on_click` - this makes the constructor
kwarg match, completing the callback naming standardization from #139.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-28 14:31:22 -05:00
|
|
|
.PP
|
F15: convert frozen binding docstrings to MCRF_* macros (#314)
Convert 289 raw PyMethodDef/PyGetSetDef docstring slots to MCRF_METHOD /
MCRF_PROPERTY across the 20 frozen (non-3D) binding files, bringing the
frozen surface to 100% macro compliance (check_frozen_docstrings.sh PASS).
Done via a one-agent-per-file workflow gated by validate_file_docstrings.sh
and per-wave build/doc-rebuild checks.
- Adds #include "McRFPy_Doc.h" where missing; fills the lone genuine doc
gap (UIGrid.at, which was MISSING a doc field in two arrays).
- McRFPy_Doc.h: comment documenting the MCRF_METHOD_DOC comma rule (the
trap that broke the GridLayers conversion mid-run).
- Rebaseline api_surface golden: property types now resolve to real types
instead of "Any" (e.g. grid_pos: Vector, on_cell_click: Callable | None),
and 11 properties correctly flip rw->ro now that their docstrings carry
"read-only" (collections, grid_size, hovered_cell, texture, view — all
verified against NULL setter slots).
- Regenerate docs/stubs/man page from the new docstrings.
Module-level functions use MCRF_METHOD(<name>, ...) (expands identically to
the intended MCRF_FUNCTION; the audit's compliance set is METHOD/PROPERTY).
Experimental 3D/Voxel bindings (src/3d/) remain exempt from the freeze.
Pre-existing failures unrelated to this change: test_animation_*,
test_constructor_comprehensive (reference the removed mcrfpy.Animation and
old constructor arity).
Refs #314
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 01:20:55 -04:00
|
|
|
\f[B]Arguments:\f[R] - \f[V]source\f[R]: FOV origin as (x, y) -
|
|
|
|
|
\f[V]radius\f[R]: FOV radius; defaults to the grid\[cq]s fov_radius -
|
|
|
|
|
\f[V]fov\f[R]: FOV algorithm; defaults to the grid\[cq]s fov setting -
|
|
|
|
|
\f[V]visible\f[R]: Color for currently visible cells -
|
|
|
|
|
\f[V]discovered\f[R]: Color for previously seen cells -
|
|
|
|
|
\f[V]unknown\f[R]: Color for never-seen cells
|
|
|
|
|
.SS \f[V]fill(color: Color) -> None\f[R]
|
2025-12-02 09:21:43 -05:00
|
|
|
.PP
|
|
|
|
|
Fill the entire layer with the specified color.
|
refactor: Rename click kwarg to on_click for API consistency (closes #126)
BREAKING CHANGE: Constructor keyword argument renamed from `click` to
`on_click` for all UIDrawable types (Frame, Caption, Sprite, Grid, Line,
Circle, Arc).
Before: Frame(pos=(0,0), size=(100,100), click=handler)
After: Frame(pos=(0,0), size=(100,100), on_click=handler)
The property name was already `on_click` - this makes the constructor
kwarg match, completing the callback naming standardization from #139.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-28 14:31:22 -05:00
|
|
|
.PP
|
|
|
|
|
\f[B]Arguments:\f[R] - \f[V]color\f[R]: Color object or (r, g, b[, a])
|
|
|
|
|
tuple
|
F15: convert frozen binding docstrings to MCRF_* macros (#314)
Convert 289 raw PyMethodDef/PyGetSetDef docstring slots to MCRF_METHOD /
MCRF_PROPERTY across the 20 frozen (non-3D) binding files, bringing the
frozen surface to 100% macro compliance (check_frozen_docstrings.sh PASS).
Done via a one-agent-per-file workflow gated by validate_file_docstrings.sh
and per-wave build/doc-rebuild checks.
- Adds #include "McRFPy_Doc.h" where missing; fills the lone genuine doc
gap (UIGrid.at, which was MISSING a doc field in two arrays).
- McRFPy_Doc.h: comment documenting the MCRF_METHOD_DOC comma rule (the
trap that broke the GridLayers conversion mid-run).
- Rebaseline api_surface golden: property types now resolve to real types
instead of "Any" (e.g. grid_pos: Vector, on_cell_click: Callable | None),
and 11 properties correctly flip rw->ro now that their docstrings carry
"read-only" (collections, grid_size, hovered_cell, texture, view — all
verified against NULL setter slots).
- Regenerate docs/stubs/man page from the new docstrings.
Module-level functions use MCRF_METHOD(<name>, ...) (expands identically to
the intended MCRF_FUNCTION; the audit's compliance set is METHOD/PROPERTY).
Experimental 3D/Voxel bindings (src/3d/) remain exempt from the freeze.
Pre-existing failures unrelated to this change: test_animation_*,
test_constructor_comprehensive (reference the removed mcrfpy.Animation and
old constructor arity).
Refs #314
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 01:20:55 -04:00
|
|
|
.SS \f[V]fill_rect(pos: tuple, size: tuple, color: Color) -> None\f[R]
|
2025-12-02 09:21:43 -05:00
|
|
|
.PP
|
F15: convert frozen binding docstrings to MCRF_* macros (#314)
Convert 289 raw PyMethodDef/PyGetSetDef docstring slots to MCRF_METHOD /
MCRF_PROPERTY across the 20 frozen (non-3D) binding files, bringing the
frozen surface to 100% macro compliance (check_frozen_docstrings.sh PASS).
Done via a one-agent-per-file workflow gated by validate_file_docstrings.sh
and per-wave build/doc-rebuild checks.
- Adds #include "McRFPy_Doc.h" where missing; fills the lone genuine doc
gap (UIGrid.at, which was MISSING a doc field in two arrays).
- McRFPy_Doc.h: comment documenting the MCRF_METHOD_DOC comma rule (the
trap that broke the GridLayers conversion mid-run).
- Rebaseline api_surface golden: property types now resolve to real types
instead of "Any" (e.g. grid_pos: Vector, on_cell_click: Callable | None),
and 11 properties correctly flip rw->ro now that their docstrings carry
"read-only" (collections, grid_size, hovered_cell, texture, view — all
verified against NULL setter slots).
- Regenerate docs/stubs/man page from the new docstrings.
Module-level functions use MCRF_METHOD(<name>, ...) (expands identically to
the intended MCRF_FUNCTION; the audit's compliance set is METHOD/PROPERTY).
Experimental 3D/Voxel bindings (src/3d/) remain exempt from the freeze.
Pre-existing failures unrelated to this change: test_animation_*,
test_constructor_comprehensive (reference the removed mcrfpy.Animation and
old constructor arity).
Refs #314
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 01:20:55 -04:00
|
|
|
Fill a rectangular region with a color.
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Arguments:\f[R] - \f[V]pos\f[R]: Top-left corner as (x, y) -
|
|
|
|
|
\f[V]size\f[R]: Dimensions as (width, height) - \f[V]color\f[R]: Color
|
|
|
|
|
object or (r, g, b[, a]) tuple
|
|
|
|
|
.SS \f[V]set(pos, color: Color) -> None\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Set the color at a cell position.
|
2026-01-23 20:49:11 -05:00
|
|
|
.PP
|
|
|
|
|
\f[B]Arguments:\f[R] - \f[V]pos\f[R]: Position as (x, y) tuple, list, or
|
|
|
|
|
Vector - \f[V]color\f[R]: Color object or (r, g, b[, a]) tuple
|
F15: convert frozen binding docstrings to MCRF_* macros (#314)
Convert 289 raw PyMethodDef/PyGetSetDef docstring slots to MCRF_METHOD /
MCRF_PROPERTY across the 20 frozen (non-3D) binding files, bringing the
frozen surface to 100% macro compliance (check_frozen_docstrings.sh PASS).
Done via a one-agent-per-file workflow gated by validate_file_docstrings.sh
and per-wave build/doc-rebuild checks.
- Adds #include "McRFPy_Doc.h" where missing; fills the lone genuine doc
gap (UIGrid.at, which was MISSING a doc field in two arrays).
- McRFPy_Doc.h: comment documenting the MCRF_METHOD_DOC comma rule (the
trap that broke the GridLayers conversion mid-run).
- Rebaseline api_surface golden: property types now resolve to real types
instead of "Any" (e.g. grid_pos: Vector, on_cell_click: Callable | None),
and 11 properties correctly flip rw->ro now that their docstrings carry
"read-only" (collections, grid_size, hovered_cell, texture, view — all
verified against NULL setter slots).
- Regenerate docs/stubs/man page from the new docstrings.
Module-level functions use MCRF_METHOD(<name>, ...) (expands identically to
the intended MCRF_FUNCTION; the audit's compliance set is METHOD/PROPERTY).
Experimental 3D/Voxel bindings (src/3d/) remain exempt from the freeze.
Pre-existing failures unrelated to this change: test_animation_*,
test_constructor_comprehensive (reference the removed mcrfpy.Animation and
old constructor arity).
Refs #314
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 01:20:55 -04:00
|
|
|
.PP
|
|
|
|
|
\f[B]Raises:\f[R] IndexError: If coordinates are out of bounds
|
|
|
|
|
.SS \f[V]update_perspective() -> None\f[R]
|
refactor: Rename click kwarg to on_click for API consistency (closes #126)
BREAKING CHANGE: Constructor keyword argument renamed from `click` to
`on_click` for all UIDrawable types (Frame, Caption, Sprite, Grid, Line,
Circle, Arc).
Before: Frame(pos=(0,0), size=(100,100), click=handler)
After: Frame(pos=(0,0), size=(100,100), on_click=handler)
The property name was already `on_click` - this makes the constructor
kwarg match, completing the callback naming standardization from #139.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-28 14:31:22 -05:00
|
|
|
.PP
|
|
|
|
|
Redraw FOV based on the bound entity\[cq]s current position.
|
|
|
|
|
Call this after the entity moves to update the visibility layer.
|
F15: convert frozen binding docstrings to MCRF_* macros (#314)
Convert 289 raw PyMethodDef/PyGetSetDef docstring slots to MCRF_METHOD /
MCRF_PROPERTY across the 20 frozen (non-3D) binding files, bringing the
frozen surface to 100% macro compliance (check_frozen_docstrings.sh PASS).
Done via a one-agent-per-file workflow gated by validate_file_docstrings.sh
and per-wave build/doc-rebuild checks.
- Adds #include "McRFPy_Doc.h" where missing; fills the lone genuine doc
gap (UIGrid.at, which was MISSING a doc field in two arrays).
- McRFPy_Doc.h: comment documenting the MCRF_METHOD_DOC comma rule (the
trap that broke the GridLayers conversion mid-run).
- Rebaseline api_surface golden: property types now resolve to real types
instead of "Any" (e.g. grid_pos: Vector, on_cell_click: Callable | None),
and 11 properties correctly flip rw->ro now that their docstrings carry
"read-only" (collections, grid_size, hovered_cell, texture, view — all
verified against NULL setter slots).
- Regenerate docs/stubs/man page from the new docstrings.
Module-level functions use MCRF_METHOD(<name>, ...) (expands identically to
the intended MCRF_FUNCTION; the audit's compliance set is METHOD/PROPERTY).
Experimental 3D/Voxel bindings (src/3d/) remain exempt from the freeze.
Pre-existing failures unrelated to this change: test_animation_*,
test_constructor_comprehensive (reference the removed mcrfpy.Animation and
old constructor arity).
Refs #314
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 01:20:55 -04:00
|
|
|
.PP
|
|
|
|
|
\f[B]Raises:\f[R] RuntimeError: If no perspective binding has been set
|
|
|
|
|
via apply_perspective()
|
2026-01-23 20:49:11 -05:00
|
|
|
.SS DijkstraMap
|
2025-10-30 21:20:50 -04:00
|
|
|
.PP
|
2026-01-23 20:49:11 -05:00
|
|
|
A Dijkstra distance map from a fixed root position.
|
2025-10-30 21:20:50 -04:00
|
|
|
.PP
|
2026-01-23 20:49:11 -05:00
|
|
|
Created by Grid.get_dijkstra_map().
|
|
|
|
|
Cannot be instantiated directly.
|
2025-10-30 21:20:50 -04:00
|
|
|
.PP
|
2026-01-23 20:49:11 -05:00
|
|
|
Grid caches these maps - multiple requests for the same root return the
|
|
|
|
|
same map.
|
|
|
|
|
Call Grid.clear_dijkstra_maps() after changing grid walkability to
|
|
|
|
|
invalidate the cache.
|
2025-10-30 21:20:50 -04:00
|
|
|
.PP
|
2026-01-23 20:49:11 -05:00
|
|
|
Properties: root (Vector): Root position (read-only)
|
2025-10-30 21:20:50 -04:00
|
|
|
.PP
|
2026-01-23 20:49:11 -05:00
|
|
|
Methods: distance(pos) -> float | None: Get distance to root
|
|
|
|
|
path_from(pos) -> AStarPath: Get full path to root step_from(pos) ->
|
|
|
|
|
Vector | None: Get single step toward root
|
2025-10-30 21:20:50 -04:00
|
|
|
.PP
|
2026-01-23 20:49:11 -05:00
|
|
|
Example: dijkstra = grid.get_dijkstra_map(player.pos) for enemy in
|
|
|
|
|
enemies: dist = dijkstra.distance(enemy.pos) if dist and dist < 10: step
|
|
|
|
|
= dijkstra.step_from(enemy.pos) if step: enemy.pos = step
|
2025-10-30 21:20:50 -04:00
|
|
|
.PP
|
2026-01-23 20:49:11 -05:00
|
|
|
\f[B]Properties:\f[R] - \f[V]root\f[R] \f[I](read-only)\f[R]: Root
|
|
|
|
|
position that distances are measured from (Vector, read-only).
|
2025-10-30 21:20:50 -04:00
|
|
|
.PP
|
2026-01-23 20:49:11 -05:00
|
|
|
\f[B]Methods:\f[R]
|
F15: convert frozen binding docstrings to MCRF_* macros (#314)
Convert 289 raw PyMethodDef/PyGetSetDef docstring slots to MCRF_METHOD /
MCRF_PROPERTY across the 20 frozen (non-3D) binding files, bringing the
frozen surface to 100% macro compliance (check_frozen_docstrings.sh PASS).
Done via a one-agent-per-file workflow gated by validate_file_docstrings.sh
and per-wave build/doc-rebuild checks.
- Adds #include "McRFPy_Doc.h" where missing; fills the lone genuine doc
gap (UIGrid.at, which was MISSING a doc field in two arrays).
- McRFPy_Doc.h: comment documenting the MCRF_METHOD_DOC comma rule (the
trap that broke the GridLayers conversion mid-run).
- Rebaseline api_surface golden: property types now resolve to real types
instead of "Any" (e.g. grid_pos: Vector, on_cell_click: Callable | None),
and 11 properties correctly flip rw->ro now that their docstrings carry
"read-only" (collections, grid_size, hovered_cell, texture, view — all
verified against NULL setter slots).
- Regenerate docs/stubs/man page from the new docstrings.
Module-level functions use MCRF_METHOD(<name>, ...) (expands identically to
the intended MCRF_FUNCTION; the audit's compliance set is METHOD/PROPERTY).
Experimental 3D/Voxel bindings (src/3d/) remain exempt from the freeze.
Pre-existing failures unrelated to this change: test_animation_*,
test_constructor_comprehensive (reference the removed mcrfpy.Animation and
old constructor arity).
Refs #314
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 01:20:55 -04:00
|
|
|
.SS \f[V]descent_step(pos: Vector | tuple) -> Vector | None\f[R]
|
2026-04-18 13:35:26 -04:00
|
|
|
.PP
|
|
|
|
|
Get the adjacent cell with the lowest distance (steepest descent).
|
F15: convert frozen binding docstrings to MCRF_* macros (#314)
Convert 289 raw PyMethodDef/PyGetSetDef docstring slots to MCRF_METHOD /
MCRF_PROPERTY across the 20 frozen (non-3D) binding files, bringing the
frozen surface to 100% macro compliance (check_frozen_docstrings.sh PASS).
Done via a one-agent-per-file workflow gated by validate_file_docstrings.sh
and per-wave build/doc-rebuild checks.
- Adds #include "McRFPy_Doc.h" where missing; fills the lone genuine doc
gap (UIGrid.at, which was MISSING a doc field in two arrays).
- McRFPy_Doc.h: comment documenting the MCRF_METHOD_DOC comma rule (the
trap that broke the GridLayers conversion mid-run).
- Rebaseline api_surface golden: property types now resolve to real types
instead of "Any" (e.g. grid_pos: Vector, on_cell_click: Callable | None),
and 11 properties correctly flip rw->ro now that their docstrings carry
"read-only" (collections, grid_size, hovered_cell, texture, view — all
verified against NULL setter slots).
- Regenerate docs/stubs/man page from the new docstrings.
Module-level functions use MCRF_METHOD(<name>, ...) (expands identically to
the intended MCRF_FUNCTION; the audit's compliance set is METHOD/PROPERTY).
Experimental 3D/Voxel bindings (src/3d/) remain exempt from the freeze.
Pre-existing failures unrelated to this change: test_animation_*,
test_constructor_comprehensive (reference the removed mcrfpy.Animation and
old constructor arity).
Refs #314
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 01:20:55 -04:00
|
|
|
Unlike step_from, this always returns the best neighbor in a single hop
|
|
|
|
|
without following a precomputed path.
|
2026-04-18 13:35:26 -04:00
|
|
|
.PP
|
|
|
|
|
\f[B]Arguments:\f[R] - \f[V]pos\f[R]: Current position as Vector,
|
F15: convert frozen binding docstrings to MCRF_* macros (#314)
Convert 289 raw PyMethodDef/PyGetSetDef docstring slots to MCRF_METHOD /
MCRF_PROPERTY across the 20 frozen (non-3D) binding files, bringing the
frozen surface to 100% macro compliance (check_frozen_docstrings.sh PASS).
Done via a one-agent-per-file workflow gated by validate_file_docstrings.sh
and per-wave build/doc-rebuild checks.
- Adds #include "McRFPy_Doc.h" where missing; fills the lone genuine doc
gap (UIGrid.at, which was MISSING a doc field in two arrays).
- McRFPy_Doc.h: comment documenting the MCRF_METHOD_DOC comma rule (the
trap that broke the GridLayers conversion mid-run).
- Rebaseline api_surface golden: property types now resolve to real types
instead of "Any" (e.g. grid_pos: Vector, on_cell_click: Callable | None),
and 11 properties correctly flip rw->ro now that their docstrings carry
"read-only" (collections, grid_size, hovered_cell, texture, view — all
verified against NULL setter slots).
- Regenerate docs/stubs/man page from the new docstrings.
Module-level functions use MCRF_METHOD(<name>, ...) (expands identically to
the intended MCRF_FUNCTION; the audit's compliance set is METHOD/PROPERTY).
Experimental 3D/Voxel bindings (src/3d/) remain exempt from the freeze.
Pre-existing failures unrelated to this change: test_animation_*,
test_constructor_comprehensive (reference the removed mcrfpy.Animation and
old constructor arity).
Refs #314
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 01:20:55 -04:00
|
|
|
Entity, or (x, y) tuple
|
2026-04-18 13:35:26 -04:00
|
|
|
.PP
|
|
|
|
|
\f[B]Returns:\f[R] Next position as Vector, or None if pos is a local
|
F15: convert frozen binding docstrings to MCRF_* macros (#314)
Convert 289 raw PyMethodDef/PyGetSetDef docstring slots to MCRF_METHOD /
MCRF_PROPERTY across the 20 frozen (non-3D) binding files, bringing the
frozen surface to 100% macro compliance (check_frozen_docstrings.sh PASS).
Done via a one-agent-per-file workflow gated by validate_file_docstrings.sh
and per-wave build/doc-rebuild checks.
- Adds #include "McRFPy_Doc.h" where missing; fills the lone genuine doc
gap (UIGrid.at, which was MISSING a doc field in two arrays).
- McRFPy_Doc.h: comment documenting the MCRF_METHOD_DOC comma rule (the
trap that broke the GridLayers conversion mid-run).
- Rebaseline api_surface golden: property types now resolve to real types
instead of "Any" (e.g. grid_pos: Vector, on_cell_click: Callable | None),
and 11 properties correctly flip rw->ro now that their docstrings carry
"read-only" (collections, grid_size, hovered_cell, texture, view — all
verified against NULL setter slots).
- Regenerate docs/stubs/man page from the new docstrings.
Module-level functions use MCRF_METHOD(<name>, ...) (expands identically to
the intended MCRF_FUNCTION; the audit's compliance set is METHOD/PROPERTY).
Experimental 3D/Voxel bindings (src/3d/) remain exempt from the freeze.
Pre-existing failures unrelated to this change: test_animation_*,
test_constructor_comprehensive (reference the removed mcrfpy.Animation and
old constructor arity).
Refs #314
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 01:20:55 -04:00
|
|
|
minimum or off-grid
|
|
|
|
|
.SS \f[V]distance(pos: Vector | tuple) -> float | None\f[R]
|
2025-10-30 21:20:50 -04:00
|
|
|
.PP
|
2026-01-23 20:49:11 -05:00
|
|
|
Get distance from position to root.
|
2025-10-30 21:20:50 -04:00
|
|
|
.PP
|
2026-01-23 20:49:11 -05:00
|
|
|
\f[B]Arguments:\f[R] - \f[V]pos\f[R]: Position as Vector, Entity, or (x,
|
F15: convert frozen binding docstrings to MCRF_* macros (#314)
Convert 289 raw PyMethodDef/PyGetSetDef docstring slots to MCRF_METHOD /
MCRF_PROPERTY across the 20 frozen (non-3D) binding files, bringing the
frozen surface to 100% macro compliance (check_frozen_docstrings.sh PASS).
Done via a one-agent-per-file workflow gated by validate_file_docstrings.sh
and per-wave build/doc-rebuild checks.
- Adds #include "McRFPy_Doc.h" where missing; fills the lone genuine doc
gap (UIGrid.at, which was MISSING a doc field in two arrays).
- McRFPy_Doc.h: comment documenting the MCRF_METHOD_DOC comma rule (the
trap that broke the GridLayers conversion mid-run).
- Rebaseline api_surface golden: property types now resolve to real types
instead of "Any" (e.g. grid_pos: Vector, on_cell_click: Callable | None),
and 11 properties correctly flip rw->ro now that their docstrings carry
"read-only" (collections, grid_size, hovered_cell, texture, view — all
verified against NULL setter slots).
- Regenerate docs/stubs/man page from the new docstrings.
Module-level functions use MCRF_METHOD(<name>, ...) (expands identically to
the intended MCRF_FUNCTION; the audit's compliance set is METHOD/PROPERTY).
Experimental 3D/Voxel bindings (src/3d/) remain exempt from the freeze.
Pre-existing failures unrelated to this change: test_animation_*,
test_constructor_comprehensive (reference the removed mcrfpy.Animation and
old constructor arity).
Refs #314
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 01:20:55 -04:00
|
|
|
y) tuple
|
2025-10-30 21:20:50 -04:00
|
|
|
.PP
|
F15: convert frozen binding docstrings to MCRF_* macros (#314)
Convert 289 raw PyMethodDef/PyGetSetDef docstring slots to MCRF_METHOD /
MCRF_PROPERTY across the 20 frozen (non-3D) binding files, bringing the
frozen surface to 100% macro compliance (check_frozen_docstrings.sh PASS).
Done via a one-agent-per-file workflow gated by validate_file_docstrings.sh
and per-wave build/doc-rebuild checks.
- Adds #include "McRFPy_Doc.h" where missing; fills the lone genuine doc
gap (UIGrid.at, which was MISSING a doc field in two arrays).
- McRFPy_Doc.h: comment documenting the MCRF_METHOD_DOC comma rule (the
trap that broke the GridLayers conversion mid-run).
- Rebaseline api_surface golden: property types now resolve to real types
instead of "Any" (e.g. grid_pos: Vector, on_cell_click: Callable | None),
and 11 properties correctly flip rw->ro now that their docstrings carry
"read-only" (collections, grid_size, hovered_cell, texture, view — all
verified against NULL setter slots).
- Regenerate docs/stubs/man page from the new docstrings.
Module-level functions use MCRF_METHOD(<name>, ...) (expands identically to
the intended MCRF_FUNCTION; the audit's compliance set is METHOD/PROPERTY).
Experimental 3D/Voxel bindings (src/3d/) remain exempt from the freeze.
Pre-existing failures unrelated to this change: test_animation_*,
test_constructor_comprehensive (reference the removed mcrfpy.Animation and
old constructor arity).
Refs #314
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 01:20:55 -04:00
|
|
|
\f[B]Returns:\f[R] Float distance, or None if position is unreachable
|
2026-04-18 13:35:26 -04:00
|
|
|
.SS \f[V]invert() -> DijkstraMap\f[R]
|
|
|
|
|
.PP
|
F15: convert frozen binding docstrings to MCRF_* macros (#314)
Convert 289 raw PyMethodDef/PyGetSetDef docstring slots to MCRF_METHOD /
MCRF_PROPERTY across the 20 frozen (non-3D) binding files, bringing the
frozen surface to 100% macro compliance (check_frozen_docstrings.sh PASS).
Done via a one-agent-per-file workflow gated by validate_file_docstrings.sh
and per-wave build/doc-rebuild checks.
- Adds #include "McRFPy_Doc.h" where missing; fills the lone genuine doc
gap (UIGrid.at, which was MISSING a doc field in two arrays).
- McRFPy_Doc.h: comment documenting the MCRF_METHOD_DOC comma rule (the
trap that broke the GridLayers conversion mid-run).
- Rebaseline api_surface golden: property types now resolve to real types
instead of "Any" (e.g. grid_pos: Vector, on_cell_click: Callable | None),
and 11 properties correctly flip rw->ro now that their docstrings carry
"read-only" (collections, grid_size, hovered_cell, texture, view — all
verified against NULL setter slots).
- Regenerate docs/stubs/man page from the new docstrings.
Module-level functions use MCRF_METHOD(<name>, ...) (expands identically to
the intended MCRF_FUNCTION; the audit's compliance set is METHOD/PROPERTY).
Experimental 3D/Voxel bindings (src/3d/) remain exempt from the freeze.
Pre-existing failures unrelated to this change: test_animation_*,
test_constructor_comprehensive (reference the removed mcrfpy.Animation and
old constructor arity).
Refs #314
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 01:20:55 -04:00
|
|
|
Return a new DijkstraMap whose distance field is inverted (safety
|
|
|
|
|
field).
|
|
|
|
|
Cells near a root become high values; descend to flee from original
|
|
|
|
|
roots.
|
2026-04-18 13:35:26 -04:00
|
|
|
The original DijkstraMap is unchanged.
|
|
|
|
|
.PP
|
F15: convert frozen binding docstrings to MCRF_* macros (#314)
Convert 289 raw PyMethodDef/PyGetSetDef docstring slots to MCRF_METHOD /
MCRF_PROPERTY across the 20 frozen (non-3D) binding files, bringing the
frozen surface to 100% macro compliance (check_frozen_docstrings.sh PASS).
Done via a one-agent-per-file workflow gated by validate_file_docstrings.sh
and per-wave build/doc-rebuild checks.
- Adds #include "McRFPy_Doc.h" where missing; fills the lone genuine doc
gap (UIGrid.at, which was MISSING a doc field in two arrays).
- McRFPy_Doc.h: comment documenting the MCRF_METHOD_DOC comma rule (the
trap that broke the GridLayers conversion mid-run).
- Rebaseline api_surface golden: property types now resolve to real types
instead of "Any" (e.g. grid_pos: Vector, on_cell_click: Callable | None),
and 11 properties correctly flip rw->ro now that their docstrings carry
"read-only" (collections, grid_size, hovered_cell, texture, view — all
verified against NULL setter slots).
- Regenerate docs/stubs/man page from the new docstrings.
Module-level functions use MCRF_METHOD(<name>, ...) (expands identically to
the intended MCRF_FUNCTION; the audit's compliance set is METHOD/PROPERTY).
Experimental 3D/Voxel bindings (src/3d/) remain exempt from the freeze.
Pre-existing failures unrelated to this change: test_animation_*,
test_constructor_comprehensive (reference the removed mcrfpy.Animation and
old constructor arity).
Refs #314
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 01:20:55 -04:00
|
|
|
\f[B]Returns:\f[R] New DijkstraMap with inverted distances
|
|
|
|
|
.SS \f[V]path_from(pos: Vector | tuple) -> AStarPath\f[R]
|
2025-10-30 21:20:50 -04:00
|
|
|
.PP
|
2026-01-23 20:49:11 -05:00
|
|
|
Get full path from position to root.
|
2025-10-30 21:20:50 -04:00
|
|
|
.PP
|
2026-01-23 20:49:11 -05:00
|
|
|
\f[B]Arguments:\f[R] - \f[V]pos\f[R]: Starting position as Vector,
|
F15: convert frozen binding docstrings to MCRF_* macros (#314)
Convert 289 raw PyMethodDef/PyGetSetDef docstring slots to MCRF_METHOD /
MCRF_PROPERTY across the 20 frozen (non-3D) binding files, bringing the
frozen surface to 100% macro compliance (check_frozen_docstrings.sh PASS).
Done via a one-agent-per-file workflow gated by validate_file_docstrings.sh
and per-wave build/doc-rebuild checks.
- Adds #include "McRFPy_Doc.h" where missing; fills the lone genuine doc
gap (UIGrid.at, which was MISSING a doc field in two arrays).
- McRFPy_Doc.h: comment documenting the MCRF_METHOD_DOC comma rule (the
trap that broke the GridLayers conversion mid-run).
- Rebaseline api_surface golden: property types now resolve to real types
instead of "Any" (e.g. grid_pos: Vector, on_cell_click: Callable | None),
and 11 properties correctly flip rw->ro now that their docstrings carry
"read-only" (collections, grid_size, hovered_cell, texture, view — all
verified against NULL setter slots).
- Regenerate docs/stubs/man page from the new docstrings.
Module-level functions use MCRF_METHOD(<name>, ...) (expands identically to
the intended MCRF_FUNCTION; the audit's compliance set is METHOD/PROPERTY).
Experimental 3D/Voxel bindings (src/3d/) remain exempt from the freeze.
Pre-existing failures unrelated to this change: test_animation_*,
test_constructor_comprehensive (reference the removed mcrfpy.Animation and
old constructor arity).
Refs #314
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 01:20:55 -04:00
|
|
|
Entity, or (x, y) tuple
|
2025-10-30 21:20:50 -04:00
|
|
|
.PP
|
F15: convert frozen binding docstrings to MCRF_* macros (#314)
Convert 289 raw PyMethodDef/PyGetSetDef docstring slots to MCRF_METHOD /
MCRF_PROPERTY across the 20 frozen (non-3D) binding files, bringing the
frozen surface to 100% macro compliance (check_frozen_docstrings.sh PASS).
Done via a one-agent-per-file workflow gated by validate_file_docstrings.sh
and per-wave build/doc-rebuild checks.
- Adds #include "McRFPy_Doc.h" where missing; fills the lone genuine doc
gap (UIGrid.at, which was MISSING a doc field in two arrays).
- McRFPy_Doc.h: comment documenting the MCRF_METHOD_DOC comma rule (the
trap that broke the GridLayers conversion mid-run).
- Rebaseline api_surface golden: property types now resolve to real types
instead of "Any" (e.g. grid_pos: Vector, on_cell_click: Callable | None),
and 11 properties correctly flip rw->ro now that their docstrings carry
"read-only" (collections, grid_size, hovered_cell, texture, view — all
verified against NULL setter slots).
- Regenerate docs/stubs/man page from the new docstrings.
Module-level functions use MCRF_METHOD(<name>, ...) (expands identically to
the intended MCRF_FUNCTION; the audit's compliance set is METHOD/PROPERTY).
Experimental 3D/Voxel bindings (src/3d/) remain exempt from the freeze.
Pre-existing failures unrelated to this change: test_animation_*,
test_constructor_comprehensive (reference the removed mcrfpy.Animation and
old constructor arity).
Refs #314
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 01:20:55 -04:00
|
|
|
\f[B]Returns:\f[R] AStarPath from pos toward root
|
|
|
|
|
.SS \f[V]step_from(pos: Vector | tuple) -> Vector | None\f[R]
|
2025-10-30 21:20:50 -04:00
|
|
|
.PP
|
2026-01-23 20:49:11 -05:00
|
|
|
Get single step from position toward root.
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Arguments:\f[R] - \f[V]pos\f[R]: Current position as Vector,
|
F15: convert frozen binding docstrings to MCRF_* macros (#314)
Convert 289 raw PyMethodDef/PyGetSetDef docstring slots to MCRF_METHOD /
MCRF_PROPERTY across the 20 frozen (non-3D) binding files, bringing the
frozen surface to 100% macro compliance (check_frozen_docstrings.sh PASS).
Done via a one-agent-per-file workflow gated by validate_file_docstrings.sh
and per-wave build/doc-rebuild checks.
- Adds #include "McRFPy_Doc.h" where missing; fills the lone genuine doc
gap (UIGrid.at, which was MISSING a doc field in two arrays).
- McRFPy_Doc.h: comment documenting the MCRF_METHOD_DOC comma rule (the
trap that broke the GridLayers conversion mid-run).
- Rebaseline api_surface golden: property types now resolve to real types
instead of "Any" (e.g. grid_pos: Vector, on_cell_click: Callable | None),
and 11 properties correctly flip rw->ro now that their docstrings carry
"read-only" (collections, grid_size, hovered_cell, texture, view — all
verified against NULL setter slots).
- Regenerate docs/stubs/man page from the new docstrings.
Module-level functions use MCRF_METHOD(<name>, ...) (expands identically to
the intended MCRF_FUNCTION; the audit's compliance set is METHOD/PROPERTY).
Experimental 3D/Voxel bindings (src/3d/) remain exempt from the freeze.
Pre-existing failures unrelated to this change: test_animation_*,
test_constructor_comprehensive (reference the removed mcrfpy.Animation and
old constructor arity).
Refs #314
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 01:20:55 -04:00
|
|
|
Entity, or (x, y) tuple
|
2026-01-23 20:49:11 -05:00
|
|
|
.PP
|
|
|
|
|
\f[B]Returns:\f[R] Next position as Vector, or None if at root or
|
F15: convert frozen binding docstrings to MCRF_* macros (#314)
Convert 289 raw PyMethodDef/PyGetSetDef docstring slots to MCRF_METHOD /
MCRF_PROPERTY across the 20 frozen (non-3D) binding files, bringing the
frozen surface to 100% macro compliance (check_frozen_docstrings.sh PASS).
Done via a one-agent-per-file workflow gated by validate_file_docstrings.sh
and per-wave build/doc-rebuild checks.
- Adds #include "McRFPy_Doc.h" where missing; fills the lone genuine doc
gap (UIGrid.at, which was MISSING a doc field in two arrays).
- McRFPy_Doc.h: comment documenting the MCRF_METHOD_DOC comma rule (the
trap that broke the GridLayers conversion mid-run).
- Rebaseline api_surface golden: property types now resolve to real types
instead of "Any" (e.g. grid_pos: Vector, on_cell_click: Callable | None),
and 11 properties correctly flip rw->ro now that their docstrings carry
"read-only" (collections, grid_size, hovered_cell, texture, view — all
verified against NULL setter slots).
- Regenerate docs/stubs/man page from the new docstrings.
Module-level functions use MCRF_METHOD(<name>, ...) (expands identically to
the intended MCRF_FUNCTION; the audit's compliance set is METHOD/PROPERTY).
Experimental 3D/Voxel bindings (src/3d/) remain exempt from the freeze.
Pre-existing failures unrelated to this change: test_animation_*,
test_constructor_comprehensive (reference the removed mcrfpy.Animation and
old constructor arity).
Refs #314
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 01:20:55 -04:00
|
|
|
unreachable
|
2026-01-23 20:49:11 -05:00
|
|
|
.SS \f[V]to_heightmap(size=None, unreachable=-1.0) -> HeightMap\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Convert distance field to a HeightMap.
|
F15: convert frozen binding docstrings to MCRF_* macros (#314)
Convert 289 raw PyMethodDef/PyGetSetDef docstring slots to MCRF_METHOD /
MCRF_PROPERTY across the 20 frozen (non-3D) binding files, bringing the
frozen surface to 100% macro compliance (check_frozen_docstrings.sh PASS).
Done via a one-agent-per-file workflow gated by validate_file_docstrings.sh
and per-wave build/doc-rebuild checks.
- Adds #include "McRFPy_Doc.h" where missing; fills the lone genuine doc
gap (UIGrid.at, which was MISSING a doc field in two arrays).
- McRFPy_Doc.h: comment documenting the MCRF_METHOD_DOC comma rule (the
trap that broke the GridLayers conversion mid-run).
- Rebaseline api_surface golden: property types now resolve to real types
instead of "Any" (e.g. grid_pos: Vector, on_cell_click: Callable | None),
and 11 properties correctly flip rw->ro now that their docstrings carry
"read-only" (collections, grid_size, hovered_cell, texture, view — all
verified against NULL setter slots).
- Regenerate docs/stubs/man page from the new docstrings.
Module-level functions use MCRF_METHOD(<name>, ...) (expands identically to
the intended MCRF_FUNCTION; the audit's compliance set is METHOD/PROPERTY).
Experimental 3D/Voxel bindings (src/3d/) remain exempt from the freeze.
Pre-existing failures unrelated to this change: test_animation_*,
test_constructor_comprehensive (reference the removed mcrfpy.Animation and
old constructor arity).
Refs #314
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 01:20:55 -04:00
|
|
|
Each cell\[cq]s height equals its pathfinding distance from the root,
|
|
|
|
|
useful for visualization, procedural terrain, or influence mapping.
|
2026-01-23 20:49:11 -05:00
|
|
|
.PP
|
|
|
|
|
\f[B]Arguments:\f[R] - \f[V]size\f[R]: Optional (width, height) tuple.
|
F15: convert frozen binding docstrings to MCRF_* macros (#314)
Convert 289 raw PyMethodDef/PyGetSetDef docstring slots to MCRF_METHOD /
MCRF_PROPERTY across the 20 frozen (non-3D) binding files, bringing the
frozen surface to 100% macro compliance (check_frozen_docstrings.sh PASS).
Done via a one-agent-per-file workflow gated by validate_file_docstrings.sh
and per-wave build/doc-rebuild checks.
- Adds #include "McRFPy_Doc.h" where missing; fills the lone genuine doc
gap (UIGrid.at, which was MISSING a doc field in two arrays).
- McRFPy_Doc.h: comment documenting the MCRF_METHOD_DOC comma rule (the
trap that broke the GridLayers conversion mid-run).
- Rebaseline api_surface golden: property types now resolve to real types
instead of "Any" (e.g. grid_pos: Vector, on_cell_click: Callable | None),
and 11 properties correctly flip rw->ro now that their docstrings carry
"read-only" (collections, grid_size, hovered_cell, texture, view — all
verified against NULL setter slots).
- Regenerate docs/stubs/man page from the new docstrings.
Module-level functions use MCRF_METHOD(<name>, ...) (expands identically to
the intended MCRF_FUNCTION; the audit's compliance set is METHOD/PROPERTY).
Experimental 3D/Voxel bindings (src/3d/) remain exempt from the freeze.
Pre-existing failures unrelated to this change: test_animation_*,
test_constructor_comprehensive (reference the removed mcrfpy.Animation and
old constructor arity).
Refs #314
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 01:20:55 -04:00
|
|
|
Defaults to dijkstra dimensions - \f[V]unreachable\f[R]: Value for cells
|
|
|
|
|
that cannot reach root (default -1.0)
|
2026-01-23 20:49:11 -05:00
|
|
|
.PP
|
F15: convert frozen binding docstrings to MCRF_* macros (#314)
Convert 289 raw PyMethodDef/PyGetSetDef docstring slots to MCRF_METHOD /
MCRF_PROPERTY across the 20 frozen (non-3D) binding files, bringing the
frozen surface to 100% macro compliance (check_frozen_docstrings.sh PASS).
Done via a one-agent-per-file workflow gated by validate_file_docstrings.sh
and per-wave build/doc-rebuild checks.
- Adds #include "McRFPy_Doc.h" where missing; fills the lone genuine doc
gap (UIGrid.at, which was MISSING a doc field in two arrays).
- McRFPy_Doc.h: comment documenting the MCRF_METHOD_DOC comma rule (the
trap that broke the GridLayers conversion mid-run).
- Rebaseline api_surface golden: property types now resolve to real types
instead of "Any" (e.g. grid_pos: Vector, on_cell_click: Callable | None),
and 11 properties correctly flip rw->ro now that their docstrings carry
"read-only" (collections, grid_size, hovered_cell, texture, view — all
verified against NULL setter slots).
- Regenerate docs/stubs/man page from the new docstrings.
Module-level functions use MCRF_METHOD(<name>, ...) (expands identically to
the intended MCRF_FUNCTION; the audit's compliance set is METHOD/PROPERTY).
Experimental 3D/Voxel bindings (src/3d/) remain exempt from the freeze.
Pre-existing failures unrelated to this change: test_animation_*,
test_constructor_comprehensive (reference the removed mcrfpy.Animation and
old constructor arity).
Refs #314
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 01:20:55 -04:00
|
|
|
\f[B]Returns:\f[R] HeightMap with distance values as heights
|
Replace UIEntity gridstate with DiscreteMap perspective_map; closes #294
Per-entity FOV memory moves from std::vector<UIGridPointState> (two-bool
visible/discovered pairs) to a 3-state DiscreteMap (0=UNKNOWN, 1=DISCOVERED,
2=VISIBLE), exposed as entity.perspective_map. The invariant
visible-subset-of-discovered becomes structural (single value per cell), and
the map is a live, serializable, first-class object rather than an implicit
internal array.
Changes:
- New DiscreteMap C++ class with shared ownership; PyDiscreteMapObject now
holds shared_ptr<DiscreteMap>. UIEntity holds the same shared_ptr.
- New mcrfpy.Perspective IntEnum (UNKNOWN/DISCOVERED/VISIBLE), modelled on
PyInputState.
- entity.perspective_map: lazy-allocated on first access with a grid;
setter validates size against grid and raises ValueError on mismatch;
None clears (next access lazy-reallocates fresh).
- updateVisibility() now demotes 2->1 then promotes visible cells to 2.
- entity.at(x, y) returns grid.at(x, y) when VISIBLE, else None.
- Fog-of-war rendering in UIGridView and UIGrid reads the 3-state map.
- Removed: UIEntity::gridstate, ensureGridstate(), entity.gridstate getter,
UIGridPointState struct + PyUIGridPointStateType.
- Obsolete tests deleted (test_gridpointstate_point,
issue_265_gridpointstate_dangle); 4 new tests cover lazy allocation,
identity, serialization round-trip, size validation, and the
visible-subset-of-discovered invariant.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-17 23:04:27 -04:00
|
|
|
.SS DiscreteMap
|
|
|
|
|
.PP
|
|
|
|
|
DiscreteMap(size: tuple[int, int], fill: int = 0, enum: type[IntEnum] =
|
|
|
|
|
None)
|
|
|
|
|
.PP
|
|
|
|
|
A 2D grid of uint8 values (0-255) for discrete/categorical data.
|
|
|
|
|
.PP
|
|
|
|
|
DiscreteMap provides memory-efficient storage for terrain types, region
|
|
|
|
|
IDs, walkability masks, and other categorical data.
|
|
|
|
|
Uses 4x less memory than HeightMap for the same dimensions.
|
|
|
|
|
.PP
|
|
|
|
|
Args: size: (width, height) dimensions.
|
|
|
|
|
Immutable after creation.
|
|
|
|
|
fill: Initial value for all cells (0-255).
|
|
|
|
|
Default 0.
|
|
|
|
|
enum: Optional IntEnum class for value interpretation.
|
|
|
|
|
.PP
|
|
|
|
|
Example: from enum import IntEnum class Terrain(IntEnum): WATER = 0
|
|
|
|
|
GRASS = 1 MOUNTAIN = 2
|
|
|
|
|
.IP
|
|
|
|
|
.nf
|
|
|
|
|
\f[C]
|
|
|
|
|
dmap = mcrfpy.DiscreteMap((100, 100), fill=0, enum=Terrain)
|
|
|
|
|
dmap.fill(Terrain.GRASS, pos=(10, 10), size=(20, 20))
|
|
|
|
|
print(dmap[15, 15]) # Terrain.GRASS
|
|
|
|
|
\f[R]
|
|
|
|
|
.fi
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Properties:\f[R] - \f[V]enum_type\f[R]: Optional IntEnum class for
|
|
|
|
|
value interpretation.
|
|
|
|
|
- \f[V]size\f[R] \f[I](read-only)\f[R]: Dimensions (width, height) of
|
|
|
|
|
the map.
|
|
|
|
|
Read-only.
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Methods:\f[R]
|
|
|
|
|
.SS \f[V]add(other: DiscreteMap | int, *, pos=None, source_pos=None, size=None) -> DiscreteMap\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Add values from another map or a scalar, with saturation to 0-255.
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Arguments:\f[R] - \f[V]other\f[R]: DiscreteMap to add, or int
|
|
|
|
|
scalar to add to all cells - \f[V]pos\f[R]: Destination start (x, y) in
|
|
|
|
|
self (default: (0, 0)) - \f[V]source_pos\f[R]: Source start (x, y) in
|
|
|
|
|
other (default: (0, 0)) - \f[V]size\f[R]: Region (width, height)
|
|
|
|
|
(default: max overlapping area)
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Returns:\f[R] DiscreteMap: self, for method chaining
|
|
|
|
|
.SS \f[V]bitwise_and(other: DiscreteMap, *, pos=None, source_pos=None, size=None) -> DiscreteMap\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Bitwise AND with another DiscreteMap.
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Arguments:\f[R] - \f[V]other\f[R]: DiscreteMap for AND operation -
|
|
|
|
|
\f[V]pos\f[R]: Destination start (x, y) in self (default: (0, 0)) -
|
|
|
|
|
\f[V]source_pos\f[R]: Source start (x, y) in other (default: (0, 0)) -
|
|
|
|
|
\f[V]size\f[R]: Region (width, height) (default: max overlapping area)
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Returns:\f[R] DiscreteMap: self, for method chaining
|
|
|
|
|
.SS \f[V]bitwise_or(other: DiscreteMap, *, pos=None, source_pos=None, size=None) -> DiscreteMap\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Bitwise OR with another DiscreteMap.
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Arguments:\f[R] - \f[V]other\f[R]: DiscreteMap for OR operation -
|
|
|
|
|
\f[V]pos\f[R]: Destination start (x, y) in self (default: (0, 0)) -
|
|
|
|
|
\f[V]source_pos\f[R]: Source start (x, y) in other (default: (0, 0)) -
|
|
|
|
|
\f[V]size\f[R]: Region (width, height) (default: max overlapping area)
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Returns:\f[R] DiscreteMap: self, for method chaining
|
|
|
|
|
.SS \f[V]bitwise_xor(other: DiscreteMap, *, pos=None, source_pos=None, size=None) -> DiscreteMap\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Bitwise XOR with another DiscreteMap.
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Arguments:\f[R] - \f[V]other\f[R]: DiscreteMap for XOR operation -
|
|
|
|
|
\f[V]pos\f[R]: Destination start (x, y) in self (default: (0, 0)) -
|
|
|
|
|
\f[V]source_pos\f[R]: Source start (x, y) in other (default: (0, 0)) -
|
|
|
|
|
\f[V]size\f[R]: Region (width, height) (default: max overlapping area)
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Returns:\f[R] DiscreteMap: self, for method chaining
|
|
|
|
|
.SS \f[V]bool(condition: int | set | callable) -> DiscreteMap\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Create binary mask from condition.
|
|
|
|
|
Returns NEW DiscreteMap.
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Arguments:\f[R] - \f[V]condition\f[R]: int: match that value; set:
|
|
|
|
|
match any in set; callable: predicate
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Returns:\f[R] DiscreteMap: new map with 1 where condition true, 0
|
|
|
|
|
elsewhere
|
|
|
|
|
.SS \f[V]clear() -> DiscreteMap\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Set all cells to 0.
|
|
|
|
|
Equivalent to fill(0).
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Returns:\f[R] DiscreteMap: self, for method chaining
|
|
|
|
|
.SS \f[V]copy_from(other: DiscreteMap, *, pos=None, source_pos=None, size=None) -> DiscreteMap\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Copy values from another DiscreteMap into the specified region.
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Arguments:\f[R] - \f[V]other\f[R]: DiscreteMap to copy from -
|
|
|
|
|
\f[V]pos\f[R]: Destination start (x, y) in self (default: (0, 0)) -
|
|
|
|
|
\f[V]source_pos\f[R]: Source start (x, y) in other (default: (0, 0)) -
|
|
|
|
|
\f[V]size\f[R]: Region (width, height) (default: max overlapping area)
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Returns:\f[R] DiscreteMap: self, for method chaining
|
|
|
|
|
.SS \f[V]count(value: int) -> int\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Count cells with the specified value.
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Arguments:\f[R] - \f[V]value\f[R]: Value to count (0-255)
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Returns:\f[R] int: Number of cells with that value
|
|
|
|
|
.SS \f[V]count_range(min_val: int, max_val: int) -> int\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Count cells with values in the specified range (inclusive).
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Arguments:\f[R] - \f[V]min_val\f[R]: Minimum value (inclusive) -
|
|
|
|
|
\f[V]max_val\f[R]: Maximum value (inclusive)
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Returns:\f[R] int: Number of cells in range
|
|
|
|
|
.SS \f[V]fill(value: int, *, pos=None, size=None) -> DiscreteMap\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Set cells in region to the specified value.
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Arguments:\f[R] - \f[V]value\f[R]: The value to set (0-255, or
|
|
|
|
|
IntEnum member) - \f[V]pos\f[R]: Region start (x, y) in destination
|
|
|
|
|
(default: (0, 0)) - \f[V]size\f[R]: Region (width, height) to fill
|
|
|
|
|
(default: remaining space)
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Returns:\f[R] DiscreteMap: self, for method chaining
|
|
|
|
|
.SS \f[V]from_bytes(data: bytes, size: tuple[int, int], *, enum: type = None) -> DiscreteMap\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Create a DiscreteMap from raw byte data.
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Arguments:\f[R] - \f[V]data\f[R]: Raw cell data (one byte per cell,
|
|
|
|
|
row-major) - \f[V]size\f[R]: (width, height) dimensions -
|
|
|
|
|
\f[V]enum\f[R]: Optional IntEnum class for value interpretation
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Returns:\f[R] DiscreteMap: new map initialized from data
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Raises:\f[R] ValueError: Data length does not match width * height
|
|
|
|
|
.SS \f[V]from_heightmap(hmap: HeightMap, mapping: list[tuple[tuple[float,float], int]], *, enum=None) -> DiscreteMap\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Create DiscreteMap from HeightMap using range-to-value mapping.
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Arguments:\f[R] - \f[V]hmap\f[R]: HeightMap to convert -
|
|
|
|
|
\f[V]mapping\f[R]: List of ((min, max), value) tuples - \f[V]enum\f[R]:
|
|
|
|
|
Optional IntEnum class for value interpretation
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Returns:\f[R] DiscreteMap: new map with mapped values
|
|
|
|
|
.SS \f[V]get(x, y) or (pos) -> int | Enum\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Get the value at integer coordinates.
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Returns:\f[R] int or enum member if enum_type is set
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Raises:\f[R] IndexError: Position is out of bounds
|
|
|
|
|
.SS \f[V]histogram() -> dict[int, int]\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Get a histogram of value counts.
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Returns:\f[R] dict: {value: count} for all values present in the
|
|
|
|
|
map
|
|
|
|
|
.SS \f[V]invert() -> DiscreteMap\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Return NEW DiscreteMap with (255 - value) for each cell.
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Returns:\f[R] DiscreteMap: new inverted map (original unchanged)
|
|
|
|
|
.SS \f[V]mask() -> memoryview\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Get raw uint8_t data as memoryview for libtcod compatibility.
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Returns:\f[R] memoryview: Direct access to internal buffer
|
|
|
|
|
(read/write)
|
|
|
|
|
.SS \f[V]max(other: DiscreteMap, *, pos=None, source_pos=None, size=None) -> DiscreteMap\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Set each cell to the maximum of this and another DiscreteMap.
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Arguments:\f[R] - \f[V]other\f[R]: DiscreteMap to compare with -
|
|
|
|
|
\f[V]pos\f[R]: Destination start (x, y) in self (default: (0, 0)) -
|
|
|
|
|
\f[V]source_pos\f[R]: Source start (x, y) in other (default: (0, 0)) -
|
|
|
|
|
\f[V]size\f[R]: Region (width, height) (default: max overlapping area)
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Returns:\f[R] DiscreteMap: self, for method chaining
|
|
|
|
|
.SS \f[V]min(other: DiscreteMap, *, pos=None, source_pos=None, size=None) -> DiscreteMap\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Set each cell to the minimum of this and another DiscreteMap.
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Arguments:\f[R] - \f[V]other\f[R]: DiscreteMap to compare with -
|
|
|
|
|
\f[V]pos\f[R]: Destination start (x, y) in self (default: (0, 0)) -
|
|
|
|
|
\f[V]source_pos\f[R]: Source start (x, y) in other (default: (0, 0)) -
|
|
|
|
|
\f[V]size\f[R]: Region (width, height) (default: max overlapping area)
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Returns:\f[R] DiscreteMap: self, for method chaining
|
|
|
|
|
.SS \f[V]min_max() -> tuple[int, int]\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Get the minimum and maximum values in the map.
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Returns:\f[R] tuple[int, int]: (min_value, max_value)
|
|
|
|
|
.SS \f[V]multiply(factor: float, *, pos=None, size=None) -> DiscreteMap\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Multiply values by a scalar factor, with saturation to 0-255.
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Arguments:\f[R] - \f[V]factor\f[R]: Multiplier for each cell -
|
|
|
|
|
\f[V]pos\f[R]: Region start (x, y) (default: (0, 0)) - \f[V]size\f[R]:
|
|
|
|
|
Region (width, height) (default: entire map)
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Returns:\f[R] DiscreteMap: self, for method chaining
|
|
|
|
|
.SS \f[V]set(x: int, y: int, value: int) -> None\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Set the value at integer coordinates.
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Arguments:\f[R] - \f[V]x\f[R]: X coordinate - \f[V]y\f[R]: Y
|
|
|
|
|
coordinate - \f[V]value\f[R]: Value to set (0-255, or IntEnum member)
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Raises:\f[R] IndexError: Position is out of bounds ValueError:
|
|
|
|
|
Value out of range 0-255
|
|
|
|
|
.SS \f[V]subtract(other: DiscreteMap | int, *, pos=None, source_pos=None, size=None) -> DiscreteMap\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Subtract values from another map or a scalar, with saturation to 0-255.
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Arguments:\f[R] - \f[V]other\f[R]: DiscreteMap to subtract, or int
|
|
|
|
|
scalar - \f[V]pos\f[R]: Destination start (x, y) in self (default: (0,
|
|
|
|
|
0)) - \f[V]source_pos\f[R]: Source start (x, y) in other (default: (0,
|
|
|
|
|
0)) - \f[V]size\f[R]: Region (width, height) (default: max overlapping
|
|
|
|
|
area)
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Returns:\f[R] DiscreteMap: self, for method chaining
|
|
|
|
|
.SS \f[V]to_bytes() -> bytes\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Serialize map data to bytes (row-major, one byte per cell).
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Returns:\f[R] bytes: Raw cell data, length = width * height
|
|
|
|
|
.SS \f[V]to_heightmap(mapping: dict[int, float] = None) -> HeightMap\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Convert to HeightMap, optionally mapping values to floats.
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Arguments:\f[R] - \f[V]mapping\f[R]: Optional {int: float} mapping
|
|
|
|
|
(default: direct cast)
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Returns:\f[R] HeightMap: new heightmap with converted values
|
2026-01-23 20:49:11 -05:00
|
|
|
.SS Drawable
|
|
|
|
|
.PP
|
|
|
|
|
Base class for all drawable UI elements
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Properties:\f[R] - \f[V]on_click\f[R]: Callable executed when
|
|
|
|
|
object is clicked.
|
F15: correct docstring accuracy from adversarial verify pass (#314)
Follow-up to the macro conversion: an adversarial verify pass (one agent per
file vs. the C++ implementation + stubs) found 62 content issues; the real
ones are fixed here.
Callbacks (centralized):
- on_click: receives (pos, MouseButton, InputState), not str (8 files).
- on_enter/on_exit/on_move (UIBase.h): hover passes only (pos) -- removed the
fictional button/action args.
- bounds/global_bounds (UIBase.h): mark (tuple, read-only).
Signatures / types:
- Grid.find_path: document heuristic + weight; get_dijkstra_map: document roots;
compute_fov: FOV | int = FOV.BASIC (not the C constant FOV_BASIC) + Returns;
at/is_in_fov: document (pos) and (x, y) call forms.
- get_metrics: document all 16 returned dict keys (was 8); bresenham: drop the
bogus '*' keyword-only separator.
- Nullable defaults typed correctly: BSP seed/size, ColorLayer draw_fov/
apply_perspective Color|None, Entity.visible_entities radius int=-1 (None is
rejected by the 'i' parser -> see #319).
- Type-token fixes: GridView.center -> Vector; GridView.texture -> (None,
read-only) (unimplemented, #318); GridPoint.grid_pos -> (tuple, read-only);
EntityCollection.find -> Entity | list[Entity] | None; extend RuntimeError;
UniformCollection.values -> list[float | tuple | None].
- automation: onScreen (x, y) form documented; scroll notes x is ignored (#317).
Also: correct stale AStarPath/DijkstraMap signatures in docs/api-audit-2026-04.md
(the bindings were right, the audit table was outdated). Rebaseline the API
snapshot golden and regenerate docs/stubs.
Code-level bugs surfaced by the pass are filed as #317, #318, #319.
Refs #314, #317, #318, #319
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 06:43:47 -04:00
|
|
|
Function receives (pos: Vector, button: MouseButton, action:
|
|
|
|
|
InputState).
|
2026-01-23 20:49:11 -05:00
|
|
|
- \f[V]opacity\f[R]: Opacity level (0.0 = transparent, 1.0 = opaque).
|
|
|
|
|
Automatically clamped to valid range [0.0, 1.0].
|
|
|
|
|
- \f[V]visible\f[R]: Whether the object is visible (bool).
|
|
|
|
|
Invisible objects are not rendered or clickable.
|
|
|
|
|
- \f[V]z_index\f[R]: Z-order for rendering (lower values rendered
|
|
|
|
|
first).
|
|
|
|
|
Automatically triggers scene resort when changed.
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Methods:\f[R]
|
|
|
|
|
.SS \f[V]move(dx, dy) or (delta) -> None\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Move the element by a relative offset.
|
|
|
|
|
.PP
|
|
|
|
|
Note:
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Arguments:\f[R] - \f[V]dx\f[R]: Horizontal offset in pixels (or use
|
|
|
|
|
delta) - \f[V]dy\f[R]: Vertical offset in pixels (or use delta) -
|
|
|
|
|
\f[V]delta\f[R]: Offset as tuple, list, or Vector: (dx, dy)
|
|
|
|
|
.SS \f[V]resize(width, height) or (size) -> None\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Resize the element to new dimensions.
|
|
|
|
|
.PP
|
|
|
|
|
Note:
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Arguments:\f[R] - \f[V]width\f[R]: New width in pixels (or use
|
|
|
|
|
size) - \f[V]height\f[R]: New height in pixels (or use size) -
|
|
|
|
|
\f[V]size\f[R]: Size as tuple, list, or Vector: (width, height)
|
|
|
|
|
.SS Easing
|
|
|
|
|
.PP
|
|
|
|
|
\f[I]Inherits from: IntEnum\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Properties:\f[R] - \f[V]denominator\f[R]: the denominator of a
|
|
|
|
|
rational number in lowest terms - \f[V]imag\f[R]: the imaginary part of
|
|
|
|
|
a complex number - \f[V]numerator\f[R]: the numerator of a rational
|
|
|
|
|
number in lowest terms - \f[V]real\f[R]: the real part of a complex
|
|
|
|
|
number
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Methods:\f[R]
|
|
|
|
|
.SS \f[V]as_integer_ratio(...)\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Return a pair of integers, whose ratio is equal to the original int.
|
|
|
|
|
The ratio is in lowest terms and has a positive denominator.
|
|
|
|
|
>>> (10).as_integer_ratio() (10, 1) >>> (-10).as_integer_ratio() (-10,
|
|
|
|
|
1) >>> (0).as_integer_ratio() (0, 1)
|
|
|
|
|
.SS \f[V]bit_count(...)\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Number of ones in the binary representation of the absolute value of
|
|
|
|
|
self.
|
|
|
|
|
Also known as the population count.
|
|
|
|
|
>>> bin(13) `0b1101' >>> (13).bit_count() 3
|
|
|
|
|
.SS \f[V]bit_length(...)\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Number of bits necessary to represent self in binary.
|
|
|
|
|
>>> bin(37) `0b100101' >>> (37).bit_length() 6
|
|
|
|
|
.SS \f[V]conjugate(...)\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Returns self, the complex conjugate of any int.
|
|
|
|
|
.SS \f[V]from_bytes(...)\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Return the integer represented by the given array of bytes.
|
|
|
|
|
bytes Holds the array of bytes to convert.
|
|
|
|
|
The argument must either support the buffer protocol or be an iterable
|
|
|
|
|
object producing bytes.
|
|
|
|
|
Bytes and bytearray are examples of built-in objects that support the
|
|
|
|
|
buffer protocol.
|
|
|
|
|
byteorder The byte order used to represent the integer.
|
|
|
|
|
If byteorder is `big', the most significant byte is at the beginning of
|
|
|
|
|
the byte array.
|
|
|
|
|
If byteorder is `little', the most significant byte is at the end of the
|
|
|
|
|
byte array.
|
|
|
|
|
To request the native byte order of the host system, use sys.byteorder
|
|
|
|
|
as the byte order value.
|
|
|
|
|
Default is to use `big'.
|
|
|
|
|
signed Indicates whether two\[cq]s complement is used to represent the
|
|
|
|
|
integer.
|
|
|
|
|
.SS \f[V]is_integer(...)\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Returns True.
|
|
|
|
|
Exists for duck type compatibility with float.is_integer.
|
|
|
|
|
.SS \f[V]to_bytes(...)\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Return an array of bytes representing an integer.
|
|
|
|
|
length Length of bytes object to use.
|
|
|
|
|
An OverflowError is raised if the integer is not representable with the
|
|
|
|
|
given number of bytes.
|
|
|
|
|
Default is length 1.
|
|
|
|
|
byteorder The byte order used to represent the integer.
|
|
|
|
|
If byteorder is `big', the most significant byte is at the beginning of
|
|
|
|
|
the byte array.
|
|
|
|
|
If byteorder is `little', the most significant byte is at the end of the
|
|
|
|
|
byte array.
|
|
|
|
|
To request the native byte order of the host system, use sys.byteorder
|
|
|
|
|
as the byte order value.
|
|
|
|
|
Default is to use `big'.
|
|
|
|
|
signed Determines whether two\[cq]s complement is used to represent the
|
|
|
|
|
integer.
|
|
|
|
|
If signed is False and a negative integer is given, an OverflowError is
|
|
|
|
|
raised.
|
|
|
|
|
.SS Entity
|
|
|
|
|
.PP
|
|
|
|
|
Entity(grid_pos=None, texture=None, sprite_index=0, **kwargs)
|
|
|
|
|
.PP
|
|
|
|
|
A game entity that exists on a grid with sprite rendering.
|
|
|
|
|
.PP
|
|
|
|
|
Args: grid_pos (tuple, optional): Grid position as (x, y) tuple.
|
|
|
|
|
Default: (0, 0) texture (Texture, optional): Texture object for sprite.
|
|
|
|
|
Default: default texture sprite_index (int, optional): Index into
|
|
|
|
|
texture atlas.
|
2025-10-30 21:20:50 -04:00
|
|
|
Default: 0
|
|
|
|
|
.PP
|
2026-01-23 20:49:11 -05:00
|
|
|
Keyword Args: grid (Grid): Grid to attach entity to.
|
|
|
|
|
Default: None visible (bool): Visibility state.
|
|
|
|
|
Default: True opacity (float): Opacity (0.0-1.0).
|
|
|
|
|
Default: 1.0 name (str): Element name for finding.
|
|
|
|
|
Default: None x (float): X grid position override (tile coords).
|
|
|
|
|
Default: 0 y (float): Y grid position override (tile coords).
|
Replace UIEntity gridstate with DiscreteMap perspective_map; closes #294
Per-entity FOV memory moves from std::vector<UIGridPointState> (two-bool
visible/discovered pairs) to a 3-state DiscreteMap (0=UNKNOWN, 1=DISCOVERED,
2=VISIBLE), exposed as entity.perspective_map. The invariant
visible-subset-of-discovered becomes structural (single value per cell), and
the map is a live, serializable, first-class object rather than an implicit
internal array.
Changes:
- New DiscreteMap C++ class with shared ownership; PyDiscreteMapObject now
holds shared_ptr<DiscreteMap>. UIEntity holds the same shared_ptr.
- New mcrfpy.Perspective IntEnum (UNKNOWN/DISCOVERED/VISIBLE), modelled on
PyInputState.
- entity.perspective_map: lazy-allocated on first access with a grid;
setter validates size against grid and raises ValueError on mismatch;
None clears (next access lazy-reallocates fresh).
- updateVisibility() now demotes 2->1 then promotes visible cells to 2.
- entity.at(x, y) returns grid.at(x, y) when VISIBLE, else None.
- Fog-of-war rendering in UIGridView and UIGrid reads the 3-state map.
- Removed: UIEntity::gridstate, ensureGridstate(), entity.gridstate getter,
UIGridPointState struct + PyUIGridPointStateType.
- Obsolete tests deleted (test_gridpointstate_point,
issue_265_gridpointstate_dangle); 4 new tests cover lazy allocation,
identity, serialization round-trip, size validation, and the
visible-subset-of-discovered invariant.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-17 23:04:27 -04:00
|
|
|
Default: 0 sprite_offset (tuple): Pixel offset for oversized sprites.
|
|
|
|
|
Default: (0, 0) sprite_grid (list): Per-tile sprite indices for
|
|
|
|
|
composite entities.
|
|
|
|
|
Default: None
|
2026-01-23 20:49:11 -05:00
|
|
|
.PP
|
|
|
|
|
Attributes: pos (Vector): Pixel position relative to grid (requires grid
|
|
|
|
|
attachment) x, y (float): Pixel position components (requires grid
|
|
|
|
|
attachment) grid_pos (Vector): Integer tile coordinates (logical game
|
|
|
|
|
position) grid_x, grid_y (int): Integer tile coordinate components
|
|
|
|
|
draw_pos (Vector): Fractional tile position for smooth animation
|
Replace UIEntity gridstate with DiscreteMap perspective_map; closes #294
Per-entity FOV memory moves from std::vector<UIGridPointState> (two-bool
visible/discovered pairs) to a 3-state DiscreteMap (0=UNKNOWN, 1=DISCOVERED,
2=VISIBLE), exposed as entity.perspective_map. The invariant
visible-subset-of-discovered becomes structural (single value per cell), and
the map is a live, serializable, first-class object rather than an implicit
internal array.
Changes:
- New DiscreteMap C++ class with shared ownership; PyDiscreteMapObject now
holds shared_ptr<DiscreteMap>. UIEntity holds the same shared_ptr.
- New mcrfpy.Perspective IntEnum (UNKNOWN/DISCOVERED/VISIBLE), modelled on
PyInputState.
- entity.perspective_map: lazy-allocated on first access with a grid;
setter validates size against grid and raises ValueError on mismatch;
None clears (next access lazy-reallocates fresh).
- updateVisibility() now demotes 2->1 then promotes visible cells to 2.
- entity.at(x, y) returns grid.at(x, y) when VISIBLE, else None.
- Fog-of-war rendering in UIGridView and UIGrid reads the 3-state map.
- Removed: UIEntity::gridstate, ensureGridstate(), entity.gridstate getter,
UIGridPointState struct + PyUIGridPointStateType.
- Obsolete tests deleted (test_gridpointstate_point,
issue_265_gridpointstate_dangle); 4 new tests cover lazy allocation,
identity, serialization round-trip, size validation, and the
visible-subset-of-discovered invariant.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-17 23:04:27 -04:00
|
|
|
perspective_map (DiscreteMap | None): 3-state per-entity FOV memory
|
Refactor UIEntity::grid to shared_ptr<GridData>; add entity.texture; closes #313
UIEntity now depends on the grid DATA layer only:
- GridData gains cell_width_px/cell_height_px (mirrored from the grid
texture in UIGrid's 5-arg ctor; texture is write-once) so entity
tile<->pixel math no longer reaches into rendering (getTexture()).
- GridData gains markDirty()/markCompositeDirty(): set the flag on the
UIGrid subobject AND notify owning_view, covering both render paths.
UIGrid disambiguates via 'using UIDrawable::markDirty' so all
pre-existing UIGrid-receiver calls resolve exactly as before.
- The three Python wrappers that still need the full UIGrid (GridPoint
from entity.at(), the _GridData fallback in get_grid, find_path's temp
wrapper) reconstruct it via a single aliasing-downcast helper
(grid_as_uigrid) that documents the never-independently-allocated
GridData invariant; init/set_grid simplify (share grid_data directly).
Removing the casts is deferred to #252.
entity.texture (new, frozen surface +1): thin get/set over the entity's
own UISprite. Entities render with their OWN texture (default_texture
fallback at construction); the grid's texture only determines cell size.
Setter preserves sprite_index; rejects non-Texture (TypeError),
null-data Texture wrappers (ValueError), and deletion.
Adversarial review fixes folded in:
- set_texture/get_texture guard uninitialized Entity wrappers
(RuntimeError), isinstance errors, and null-data Textures.
- PyUIGridViewType tp_dealloc no longer unconditionally severs
GridData::owning_view: gated on last-owner (#251 use_count pattern)
plus owning-view identity. Previously ANY Grid wrapper GC while the
view lived (e.g. scene.children.append(mcrfpy.Grid(...))) silently
broke entity.grid -> Grid identity and data-layer dirty notification.
Tests: tests/regression/issue_313_entity_grid_data_test.py (texture
semantics, grid-cell-size invariance, entity.grid identity, #251 gate
survival, GridPoint outliving teardown, review-fix guards, owning_view
survival) + tests/unit/entity_texture_test.py. API snapshot golden
re-baselined: exactly +1 surface line (Entity.texture) + writability
probe flip. Docs/stubs regenerated. Native + Emscripten builds verified.
Known edges recorded in docs/api-audit-2026-04.md: texture read-back is
a fresh wrapper each get (no Texture __eq__); sprite_index not
re-validated against a new atlas. Multi-view markDirty broadcast and
pure-GridData wrappers remain deferred to #252. Addresses #314.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-11 00:51:22 -04:00
|
|
|
texture (Texture): Texture atlas used by the entity\[cq]s sprite
|
2025-10-30 21:20:50 -04:00
|
|
|
sprite_index (int): Current sprite index visible (bool): Visibility
|
|
|
|
|
state opacity (float): Opacity value name (str): Element name
|
Replace UIEntity gridstate with DiscreteMap perspective_map; closes #294
Per-entity FOV memory moves from std::vector<UIGridPointState> (two-bool
visible/discovered pairs) to a 3-state DiscreteMap (0=UNKNOWN, 1=DISCOVERED,
2=VISIBLE), exposed as entity.perspective_map. The invariant
visible-subset-of-discovered becomes structural (single value per cell), and
the map is a live, serializable, first-class object rather than an implicit
internal array.
Changes:
- New DiscreteMap C++ class with shared ownership; PyDiscreteMapObject now
holds shared_ptr<DiscreteMap>. UIEntity holds the same shared_ptr.
- New mcrfpy.Perspective IntEnum (UNKNOWN/DISCOVERED/VISIBLE), modelled on
PyInputState.
- entity.perspective_map: lazy-allocated on first access with a grid;
setter validates size against grid and raises ValueError on mismatch;
None clears (next access lazy-reallocates fresh).
- updateVisibility() now demotes 2->1 then promotes visible cells to 2.
- entity.at(x, y) returns grid.at(x, y) when VISIBLE, else None.
- Fog-of-war rendering in UIGridView and UIGrid reads the 3-state map.
- Removed: UIEntity::gridstate, ensureGridstate(), entity.gridstate getter,
UIGridPointState struct + PyUIGridPointStateType.
- Obsolete tests deleted (test_gridpointstate_point,
issue_265_gridpointstate_dangle); 4 new tests cover lazy allocation,
identity, serialization round-trip, size validation, and the
visible-subset-of-discovered invariant.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-17 23:04:27 -04:00
|
|
|
sprite_offset (Vector): Pixel offset for oversized sprites
|
|
|
|
|
sprite_offset_x (float): X component of sprite offset sprite_offset_y
|
|
|
|
|
(float): Y component of sprite offset
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Properties:\f[R] - \f[V]behavior_type\f[R] \f[I](read-only)\f[R]:
|
|
|
|
|
Current behavior type (int, read-only).
|
|
|
|
|
Use set_behavior() to change.
|
|
|
|
|
- \f[V]cell_pos\f[R]: Integer logical cell position (Vector).
|
Refactor UIEntity::grid to shared_ptr<GridData>; add entity.texture; closes #313
UIEntity now depends on the grid DATA layer only:
- GridData gains cell_width_px/cell_height_px (mirrored from the grid
texture in UIGrid's 5-arg ctor; texture is write-once) so entity
tile<->pixel math no longer reaches into rendering (getTexture()).
- GridData gains markDirty()/markCompositeDirty(): set the flag on the
UIGrid subobject AND notify owning_view, covering both render paths.
UIGrid disambiguates via 'using UIDrawable::markDirty' so all
pre-existing UIGrid-receiver calls resolve exactly as before.
- The three Python wrappers that still need the full UIGrid (GridPoint
from entity.at(), the _GridData fallback in get_grid, find_path's temp
wrapper) reconstruct it via a single aliasing-downcast helper
(grid_as_uigrid) that documents the never-independently-allocated
GridData invariant; init/set_grid simplify (share grid_data directly).
Removing the casts is deferred to #252.
entity.texture (new, frozen surface +1): thin get/set over the entity's
own UISprite. Entities render with their OWN texture (default_texture
fallback at construction); the grid's texture only determines cell size.
Setter preserves sprite_index; rejects non-Texture (TypeError),
null-data Texture wrappers (ValueError), and deletion.
Adversarial review fixes folded in:
- set_texture/get_texture guard uninitialized Entity wrappers
(RuntimeError), isinstance errors, and null-data Textures.
- PyUIGridViewType tp_dealloc no longer unconditionally severs
GridData::owning_view: gated on last-owner (#251 use_count pattern)
plus owning-view identity. Previously ANY Grid wrapper GC while the
view lived (e.g. scene.children.append(mcrfpy.Grid(...))) silently
broke entity.grid -> Grid identity and data-layer dirty notification.
Tests: tests/regression/issue_313_entity_grid_data_test.py (texture
semantics, grid-cell-size invariance, entity.grid identity, #251 gate
survival, GridPoint outliving teardown, review-fix guards, owning_view
survival) + tests/unit/entity_texture_test.py. API snapshot golden
re-baselined: exactly +1 surface line (Entity.texture) + writability
probe flip. Docs/stubs regenerated. Native + Emscripten builds verified.
Known edges recorded in docs/api-audit-2026-04.md: texture read-back is
a fresh wrapper each get (no Texture __eq__); sprite_index not
re-validated against a new atlas. Multi-view markDirty broadcast and
pure-GridData wrappers remain deferred to #252. Addresses #314.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-11 00:51:22 -04:00
|
|
|
Alias for grid_pos (the canonical name).
|
F15: convert frozen binding docstrings to MCRF_* macros (#314)
Convert 289 raw PyMethodDef/PyGetSetDef docstring slots to MCRF_METHOD /
MCRF_PROPERTY across the 20 frozen (non-3D) binding files, bringing the
frozen surface to 100% macro compliance (check_frozen_docstrings.sh PASS).
Done via a one-agent-per-file workflow gated by validate_file_docstrings.sh
and per-wave build/doc-rebuild checks.
- Adds #include "McRFPy_Doc.h" where missing; fills the lone genuine doc
gap (UIGrid.at, which was MISSING a doc field in two arrays).
- McRFPy_Doc.h: comment documenting the MCRF_METHOD_DOC comma rule (the
trap that broke the GridLayers conversion mid-run).
- Rebaseline api_surface golden: property types now resolve to real types
instead of "Any" (e.g. grid_pos: Vector, on_cell_click: Callable | None),
and 11 properties correctly flip rw->ro now that their docstrings carry
"read-only" (collections, grid_size, hovered_cell, texture, view — all
verified against NULL setter slots).
- Regenerate docs/stubs/man page from the new docstrings.
Module-level functions use MCRF_METHOD(<name>, ...) (expands identically to
the intended MCRF_FUNCTION; the audit's compliance set is METHOD/PROPERTY).
Experimental 3D/Voxel bindings (src/3d/) remain exempt from the freeze.
Pre-existing failures unrelated to this change: test_animation_*,
test_constructor_comprehensive (reference the removed mcrfpy.Animation and
old constructor arity).
Refs #314
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 01:20:55 -04:00
|
|
|
- \f[V]cell_x\f[R]: Integer X cell coordinate (int).
|
Refactor UIEntity::grid to shared_ptr<GridData>; add entity.texture; closes #313
UIEntity now depends on the grid DATA layer only:
- GridData gains cell_width_px/cell_height_px (mirrored from the grid
texture in UIGrid's 5-arg ctor; texture is write-once) so entity
tile<->pixel math no longer reaches into rendering (getTexture()).
- GridData gains markDirty()/markCompositeDirty(): set the flag on the
UIGrid subobject AND notify owning_view, covering both render paths.
UIGrid disambiguates via 'using UIDrawable::markDirty' so all
pre-existing UIGrid-receiver calls resolve exactly as before.
- The three Python wrappers that still need the full UIGrid (GridPoint
from entity.at(), the _GridData fallback in get_grid, find_path's temp
wrapper) reconstruct it via a single aliasing-downcast helper
(grid_as_uigrid) that documents the never-independently-allocated
GridData invariant; init/set_grid simplify (share grid_data directly).
Removing the casts is deferred to #252.
entity.texture (new, frozen surface +1): thin get/set over the entity's
own UISprite. Entities render with their OWN texture (default_texture
fallback at construction); the grid's texture only determines cell size.
Setter preserves sprite_index; rejects non-Texture (TypeError),
null-data Texture wrappers (ValueError), and deletion.
Adversarial review fixes folded in:
- set_texture/get_texture guard uninitialized Entity wrappers
(RuntimeError), isinstance errors, and null-data Textures.
- PyUIGridViewType tp_dealloc no longer unconditionally severs
GridData::owning_view: gated on last-owner (#251 use_count pattern)
plus owning-view identity. Previously ANY Grid wrapper GC while the
view lived (e.g. scene.children.append(mcrfpy.Grid(...))) silently
broke entity.grid -> Grid identity and data-layer dirty notification.
Tests: tests/regression/issue_313_entity_grid_data_test.py (texture
semantics, grid-cell-size invariance, entity.grid identity, #251 gate
survival, GridPoint outliving teardown, review-fix guards, owning_view
survival) + tests/unit/entity_texture_test.py. API snapshot golden
re-baselined: exactly +1 surface line (Entity.texture) + writability
probe flip. Docs/stubs regenerated. Native + Emscripten builds verified.
Known edges recorded in docs/api-audit-2026-04.md: texture read-back is
a fresh wrapper each get (no Texture __eq__); sprite_index not
re-validated against a new atlas. Multi-view markDirty broadcast and
pure-GridData wrappers remain deferred to #252. Addresses #314.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-11 00:51:22 -04:00
|
|
|
Alias for grid_x.
|
F15: convert frozen binding docstrings to MCRF_* macros (#314)
Convert 289 raw PyMethodDef/PyGetSetDef docstring slots to MCRF_METHOD /
MCRF_PROPERTY across the 20 frozen (non-3D) binding files, bringing the
frozen surface to 100% macro compliance (check_frozen_docstrings.sh PASS).
Done via a one-agent-per-file workflow gated by validate_file_docstrings.sh
and per-wave build/doc-rebuild checks.
- Adds #include "McRFPy_Doc.h" where missing; fills the lone genuine doc
gap (UIGrid.at, which was MISSING a doc field in two arrays).
- McRFPy_Doc.h: comment documenting the MCRF_METHOD_DOC comma rule (the
trap that broke the GridLayers conversion mid-run).
- Rebaseline api_surface golden: property types now resolve to real types
instead of "Any" (e.g. grid_pos: Vector, on_cell_click: Callable | None),
and 11 properties correctly flip rw->ro now that their docstrings carry
"read-only" (collections, grid_size, hovered_cell, texture, view — all
verified against NULL setter slots).
- Regenerate docs/stubs/man page from the new docstrings.
Module-level functions use MCRF_METHOD(<name>, ...) (expands identically to
the intended MCRF_FUNCTION; the audit's compliance set is METHOD/PROPERTY).
Experimental 3D/Voxel bindings (src/3d/) remain exempt from the freeze.
Pre-existing failures unrelated to this change: test_animation_*,
test_constructor_comprehensive (reference the removed mcrfpy.Animation and
old constructor arity).
Refs #314
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 01:20:55 -04:00
|
|
|
- \f[V]cell_y\f[R]: Integer Y cell coordinate (int).
|
Refactor UIEntity::grid to shared_ptr<GridData>; add entity.texture; closes #313
UIEntity now depends on the grid DATA layer only:
- GridData gains cell_width_px/cell_height_px (mirrored from the grid
texture in UIGrid's 5-arg ctor; texture is write-once) so entity
tile<->pixel math no longer reaches into rendering (getTexture()).
- GridData gains markDirty()/markCompositeDirty(): set the flag on the
UIGrid subobject AND notify owning_view, covering both render paths.
UIGrid disambiguates via 'using UIDrawable::markDirty' so all
pre-existing UIGrid-receiver calls resolve exactly as before.
- The three Python wrappers that still need the full UIGrid (GridPoint
from entity.at(), the _GridData fallback in get_grid, find_path's temp
wrapper) reconstruct it via a single aliasing-downcast helper
(grid_as_uigrid) that documents the never-independently-allocated
GridData invariant; init/set_grid simplify (share grid_data directly).
Removing the casts is deferred to #252.
entity.texture (new, frozen surface +1): thin get/set over the entity's
own UISprite. Entities render with their OWN texture (default_texture
fallback at construction); the grid's texture only determines cell size.
Setter preserves sprite_index; rejects non-Texture (TypeError),
null-data Texture wrappers (ValueError), and deletion.
Adversarial review fixes folded in:
- set_texture/get_texture guard uninitialized Entity wrappers
(RuntimeError), isinstance errors, and null-data Textures.
- PyUIGridViewType tp_dealloc no longer unconditionally severs
GridData::owning_view: gated on last-owner (#251 use_count pattern)
plus owning-view identity. Previously ANY Grid wrapper GC while the
view lived (e.g. scene.children.append(mcrfpy.Grid(...))) silently
broke entity.grid -> Grid identity and data-layer dirty notification.
Tests: tests/regression/issue_313_entity_grid_data_test.py (texture
semantics, grid-cell-size invariance, entity.grid identity, #251 gate
survival, GridPoint outliving teardown, review-fix guards, owning_view
survival) + tests/unit/entity_texture_test.py. API snapshot golden
re-baselined: exactly +1 surface line (Entity.texture) + writability
probe flip. Docs/stubs regenerated. Native + Emscripten builds verified.
Known edges recorded in docs/api-audit-2026-04.md: texture read-back is
a fresh wrapper each get (no Texture __eq__); sprite_index not
re-validated against a new atlas. Multi-view markDirty broadcast and
pure-GridData wrappers remain deferred to #252. Addresses #314.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-11 00:51:22 -04:00
|
|
|
Alias for grid_y.
|
Replace UIEntity gridstate with DiscreteMap perspective_map; closes #294
Per-entity FOV memory moves from std::vector<UIGridPointState> (two-bool
visible/discovered pairs) to a 3-state DiscreteMap (0=UNKNOWN, 1=DISCOVERED,
2=VISIBLE), exposed as entity.perspective_map. The invariant
visible-subset-of-discovered becomes structural (single value per cell), and
the map is a live, serializable, first-class object rather than an implicit
internal array.
Changes:
- New DiscreteMap C++ class with shared ownership; PyDiscreteMapObject now
holds shared_ptr<DiscreteMap>. UIEntity holds the same shared_ptr.
- New mcrfpy.Perspective IntEnum (UNKNOWN/DISCOVERED/VISIBLE), modelled on
PyInputState.
- entity.perspective_map: lazy-allocated on first access with a grid;
setter validates size against grid and raises ValueError on mismatch;
None clears (next access lazy-reallocates fresh).
- updateVisibility() now demotes 2->1 then promotes visible cells to 2.
- entity.at(x, y) returns grid.at(x, y) when VISIBLE, else None.
- Fog-of-war rendering in UIGridView and UIGrid reads the 3-state map.
- Removed: UIEntity::gridstate, ensureGridstate(), entity.gridstate getter,
UIGridPointState struct + PyUIGridPointStateType.
- Obsolete tests deleted (test_gridpointstate_point,
issue_265_gridpointstate_dangle); 4 new tests cover lazy allocation,
identity, serialization round-trip, size validation, and the
visible-subset-of-discovered invariant.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-17 23:04:27 -04:00
|
|
|
- \f[V]default_behavior\f[R]: Default behavior type (int, maps to
|
|
|
|
|
Behavior enum).
|
|
|
|
|
Entity reverts to this after DONE trigger.
|
|
|
|
|
Default: 0 (IDLE).
|
|
|
|
|
- \f[V]draw_pos\f[R]: Fractional tile position for rendering (Vector).
|
2026-01-23 20:49:11 -05:00
|
|
|
Use for smooth animation between grid cells.
|
F15: convert frozen binding docstrings to MCRF_* macros (#314)
Convert 289 raw PyMethodDef/PyGetSetDef docstring slots to MCRF_METHOD /
MCRF_PROPERTY across the 20 frozen (non-3D) binding files, bringing the
frozen surface to 100% macro compliance (check_frozen_docstrings.sh PASS).
Done via a one-agent-per-file workflow gated by validate_file_docstrings.sh
and per-wave build/doc-rebuild checks.
- Adds #include "McRFPy_Doc.h" where missing; fills the lone genuine doc
gap (UIGrid.at, which was MISSING a doc field in two arrays).
- McRFPy_Doc.h: comment documenting the MCRF_METHOD_DOC comma rule (the
trap that broke the GridLayers conversion mid-run).
- Rebaseline api_surface golden: property types now resolve to real types
instead of "Any" (e.g. grid_pos: Vector, on_cell_click: Callable | None),
and 11 properties correctly flip rw->ro now that their docstrings carry
"read-only" (collections, grid_size, hovered_cell, texture, view — all
verified against NULL setter slots).
- Regenerate docs/stubs/man page from the new docstrings.
Module-level functions use MCRF_METHOD(<name>, ...) (expands identically to
the intended MCRF_FUNCTION; the audit's compliance set is METHOD/PROPERTY).
Experimental 3D/Voxel bindings (src/3d/) remain exempt from the freeze.
Pre-existing failures unrelated to this change: test_animation_*,
test_constructor_comprehensive (reference the removed mcrfpy.Animation and
old constructor arity).
Refs #314
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 01:20:55 -04:00
|
|
|
- \f[V]grid\f[R]: Grid this entity belongs to (Grid or None).
|
|
|
|
|
Assign a Grid to attach the entity, or None to remove it from its
|
|
|
|
|
current grid.
|
Refactor UIEntity::grid to shared_ptr<GridData>; add entity.texture; closes #313
UIEntity now depends on the grid DATA layer only:
- GridData gains cell_width_px/cell_height_px (mirrored from the grid
texture in UIGrid's 5-arg ctor; texture is write-once) so entity
tile<->pixel math no longer reaches into rendering (getTexture()).
- GridData gains markDirty()/markCompositeDirty(): set the flag on the
UIGrid subobject AND notify owning_view, covering both render paths.
UIGrid disambiguates via 'using UIDrawable::markDirty' so all
pre-existing UIGrid-receiver calls resolve exactly as before.
- The three Python wrappers that still need the full UIGrid (GridPoint
from entity.at(), the _GridData fallback in get_grid, find_path's temp
wrapper) reconstruct it via a single aliasing-downcast helper
(grid_as_uigrid) that documents the never-independently-allocated
GridData invariant; init/set_grid simplify (share grid_data directly).
Removing the casts is deferred to #252.
entity.texture (new, frozen surface +1): thin get/set over the entity's
own UISprite. Entities render with their OWN texture (default_texture
fallback at construction); the grid's texture only determines cell size.
Setter preserves sprite_index; rejects non-Texture (TypeError),
null-data Texture wrappers (ValueError), and deletion.
Adversarial review fixes folded in:
- set_texture/get_texture guard uninitialized Entity wrappers
(RuntimeError), isinstance errors, and null-data Textures.
- PyUIGridViewType tp_dealloc no longer unconditionally severs
GridData::owning_view: gated on last-owner (#251 use_count pattern)
plus owning-view identity. Previously ANY Grid wrapper GC while the
view lived (e.g. scene.children.append(mcrfpy.Grid(...))) silently
broke entity.grid -> Grid identity and data-layer dirty notification.
Tests: tests/regression/issue_313_entity_grid_data_test.py (texture
semantics, grid-cell-size invariance, entity.grid identity, #251 gate
survival, GridPoint outliving teardown, review-fix guards, owning_view
survival) + tests/unit/entity_texture_test.py. API snapshot golden
re-baselined: exactly +1 surface line (Entity.texture) + writability
probe flip. Docs/stubs regenerated. Native + Emscripten builds verified.
Known edges recorded in docs/api-audit-2026-04.md: texture read-back is
a fresh wrapper each get (no Texture __eq__); sprite_index not
re-validated against a new atlas. Multi-view markDirty broadcast and
pure-GridData wrappers remain deferred to #252. Addresses #314.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-11 00:51:22 -04:00
|
|
|
- \f[V]grid_pos\f[R]: Integer logical cell position (Vector).
|
F15: convert frozen binding docstrings to MCRF_* macros (#314)
Convert 289 raw PyMethodDef/PyGetSetDef docstring slots to MCRF_METHOD /
MCRF_PROPERTY across the 20 frozen (non-3D) binding files, bringing the
frozen surface to 100% macro compliance (check_frozen_docstrings.sh PASS).
Done via a one-agent-per-file workflow gated by validate_file_docstrings.sh
and per-wave build/doc-rebuild checks.
- Adds #include "McRFPy_Doc.h" where missing; fills the lone genuine doc
gap (UIGrid.at, which was MISSING a doc field in two arrays).
- McRFPy_Doc.h: comment documenting the MCRF_METHOD_DOC comma rule (the
trap that broke the GridLayers conversion mid-run).
- Rebaseline api_surface golden: property types now resolve to real types
instead of "Any" (e.g. grid_pos: Vector, on_cell_click: Callable | None),
and 11 properties correctly flip rw->ro now that their docstrings carry
"read-only" (collections, grid_size, hovered_cell, texture, view — all
verified against NULL setter slots).
- Regenerate docs/stubs/man page from the new docstrings.
Module-level functions use MCRF_METHOD(<name>, ...) (expands identically to
the intended MCRF_FUNCTION; the audit's compliance set is METHOD/PROPERTY).
Experimental 3D/Voxel bindings (src/3d/) remain exempt from the freeze.
Pre-existing failures unrelated to this change: test_animation_*,
test_constructor_comprehensive (reference the removed mcrfpy.Animation and
old constructor arity).
Refs #314
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 01:20:55 -04:00
|
|
|
Canonical cell-position property matching the `grid_pos' constructor
|
Refactor UIEntity::grid to shared_ptr<GridData>; add entity.texture; closes #313
UIEntity now depends on the grid DATA layer only:
- GridData gains cell_width_px/cell_height_px (mirrored from the grid
texture in UIGrid's 5-arg ctor; texture is write-once) so entity
tile<->pixel math no longer reaches into rendering (getTexture()).
- GridData gains markDirty()/markCompositeDirty(): set the flag on the
UIGrid subobject AND notify owning_view, covering both render paths.
UIGrid disambiguates via 'using UIDrawable::markDirty' so all
pre-existing UIGrid-receiver calls resolve exactly as before.
- The three Python wrappers that still need the full UIGrid (GridPoint
from entity.at(), the _GridData fallback in get_grid, find_path's temp
wrapper) reconstruct it via a single aliasing-downcast helper
(grid_as_uigrid) that documents the never-independently-allocated
GridData invariant; init/set_grid simplify (share grid_data directly).
Removing the casts is deferred to #252.
entity.texture (new, frozen surface +1): thin get/set over the entity's
own UISprite. Entities render with their OWN texture (default_texture
fallback at construction); the grid's texture only determines cell size.
Setter preserves sprite_index; rejects non-Texture (TypeError),
null-data Texture wrappers (ValueError), and deletion.
Adversarial review fixes folded in:
- set_texture/get_texture guard uninitialized Entity wrappers
(RuntimeError), isinstance errors, and null-data Textures.
- PyUIGridViewType tp_dealloc no longer unconditionally severs
GridData::owning_view: gated on last-owner (#251 use_count pattern)
plus owning-view identity. Previously ANY Grid wrapper GC while the
view lived (e.g. scene.children.append(mcrfpy.Grid(...))) silently
broke entity.grid -> Grid identity and data-layer dirty notification.
Tests: tests/regression/issue_313_entity_grid_data_test.py (texture
semantics, grid-cell-size invariance, entity.grid identity, #251 gate
survival, GridPoint outliving teardown, review-fix guards, owning_view
survival) + tests/unit/entity_texture_test.py. API snapshot golden
re-baselined: exactly +1 surface line (Entity.texture) + writability
probe flip. Docs/stubs regenerated. Native + Emscripten builds verified.
Known edges recorded in docs/api-audit-2026-04.md: texture read-back is
a fresh wrapper each get (no Texture __eq__); sprite_index not
re-validated against a new atlas. Multi-view markDirty broadcast and
pure-GridData wrappers remain deferred to #252. Addresses #314.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-11 00:51:22 -04:00
|
|
|
argument.
|
|
|
|
|
Decoupled from draw_pos.
|
F15: convert frozen binding docstrings to MCRF_* macros (#314)
Convert 289 raw PyMethodDef/PyGetSetDef docstring slots to MCRF_METHOD /
MCRF_PROPERTY across the 20 frozen (non-3D) binding files, bringing the
frozen surface to 100% macro compliance (check_frozen_docstrings.sh PASS).
Done via a one-agent-per-file workflow gated by validate_file_docstrings.sh
and per-wave build/doc-rebuild checks.
- Adds #include "McRFPy_Doc.h" where missing; fills the lone genuine doc
gap (UIGrid.at, which was MISSING a doc field in two arrays).
- McRFPy_Doc.h: comment documenting the MCRF_METHOD_DOC comma rule (the
trap that broke the GridLayers conversion mid-run).
- Rebaseline api_surface golden: property types now resolve to real types
instead of "Any" (e.g. grid_pos: Vector, on_cell_click: Callable | None),
and 11 properties correctly flip rw->ro now that their docstrings carry
"read-only" (collections, grid_size, hovered_cell, texture, view — all
verified against NULL setter slots).
- Regenerate docs/stubs/man page from the new docstrings.
Module-level functions use MCRF_METHOD(<name>, ...) (expands identically to
the intended MCRF_FUNCTION; the audit's compliance set is METHOD/PROPERTY).
Experimental 3D/Voxel bindings (src/3d/) remain exempt from the freeze.
Pre-existing failures unrelated to this change: test_animation_*,
test_constructor_comprehensive (reference the removed mcrfpy.Animation and
old constructor arity).
Refs #314
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 01:20:55 -04:00
|
|
|
Determines which cell this entity logically occupies for collision and
|
|
|
|
|
pathfinding.
|
|
|
|
|
- \f[V]grid_x\f[R]: Integer X cell coordinate (int).
|
Refactor UIEntity::grid to shared_ptr<GridData>; add entity.texture; closes #313
UIEntity now depends on the grid DATA layer only:
- GridData gains cell_width_px/cell_height_px (mirrored from the grid
texture in UIGrid's 5-arg ctor; texture is write-once) so entity
tile<->pixel math no longer reaches into rendering (getTexture()).
- GridData gains markDirty()/markCompositeDirty(): set the flag on the
UIGrid subobject AND notify owning_view, covering both render paths.
UIGrid disambiguates via 'using UIDrawable::markDirty' so all
pre-existing UIGrid-receiver calls resolve exactly as before.
- The three Python wrappers that still need the full UIGrid (GridPoint
from entity.at(), the _GridData fallback in get_grid, find_path's temp
wrapper) reconstruct it via a single aliasing-downcast helper
(grid_as_uigrid) that documents the never-independently-allocated
GridData invariant; init/set_grid simplify (share grid_data directly).
Removing the casts is deferred to #252.
entity.texture (new, frozen surface +1): thin get/set over the entity's
own UISprite. Entities render with their OWN texture (default_texture
fallback at construction); the grid's texture only determines cell size.
Setter preserves sprite_index; rejects non-Texture (TypeError),
null-data Texture wrappers (ValueError), and deletion.
Adversarial review fixes folded in:
- set_texture/get_texture guard uninitialized Entity wrappers
(RuntimeError), isinstance errors, and null-data Textures.
- PyUIGridViewType tp_dealloc no longer unconditionally severs
GridData::owning_view: gated on last-owner (#251 use_count pattern)
plus owning-view identity. Previously ANY Grid wrapper GC while the
view lived (e.g. scene.children.append(mcrfpy.Grid(...))) silently
broke entity.grid -> Grid identity and data-layer dirty notification.
Tests: tests/regression/issue_313_entity_grid_data_test.py (texture
semantics, grid-cell-size invariance, entity.grid identity, #251 gate
survival, GridPoint outliving teardown, review-fix guards, owning_view
survival) + tests/unit/entity_texture_test.py. API snapshot golden
re-baselined: exactly +1 surface line (Entity.texture) + writability
probe flip. Docs/stubs regenerated. Native + Emscripten builds verified.
Known edges recorded in docs/api-audit-2026-04.md: texture read-back is
a fresh wrapper each get (no Texture __eq__); sprite_index not
re-validated against a new atlas. Multi-view markDirty broadcast and
pure-GridData wrappers remain deferred to #252. Addresses #314.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-11 00:51:22 -04:00
|
|
|
Canonical; matches grid_pos.
|
F15: convert frozen binding docstrings to MCRF_* macros (#314)
Convert 289 raw PyMethodDef/PyGetSetDef docstring slots to MCRF_METHOD /
MCRF_PROPERTY across the 20 frozen (non-3D) binding files, bringing the
frozen surface to 100% macro compliance (check_frozen_docstrings.sh PASS).
Done via a one-agent-per-file workflow gated by validate_file_docstrings.sh
and per-wave build/doc-rebuild checks.
- Adds #include "McRFPy_Doc.h" where missing; fills the lone genuine doc
gap (UIGrid.at, which was MISSING a doc field in two arrays).
- McRFPy_Doc.h: comment documenting the MCRF_METHOD_DOC comma rule (the
trap that broke the GridLayers conversion mid-run).
- Rebaseline api_surface golden: property types now resolve to real types
instead of "Any" (e.g. grid_pos: Vector, on_cell_click: Callable | None),
and 11 properties correctly flip rw->ro now that their docstrings carry
"read-only" (collections, grid_size, hovered_cell, texture, view — all
verified against NULL setter slots).
- Regenerate docs/stubs/man page from the new docstrings.
Module-level functions use MCRF_METHOD(<name>, ...) (expands identically to
the intended MCRF_FUNCTION; the audit's compliance set is METHOD/PROPERTY).
Experimental 3D/Voxel bindings (src/3d/) remain exempt from the freeze.
Pre-existing failures unrelated to this change: test_animation_*,
test_constructor_comprehensive (reference the removed mcrfpy.Animation and
old constructor arity).
Refs #314
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 01:20:55 -04:00
|
|
|
- \f[V]grid_y\f[R]: Integer Y cell coordinate (int).
|
Refactor UIEntity::grid to shared_ptr<GridData>; add entity.texture; closes #313
UIEntity now depends on the grid DATA layer only:
- GridData gains cell_width_px/cell_height_px (mirrored from the grid
texture in UIGrid's 5-arg ctor; texture is write-once) so entity
tile<->pixel math no longer reaches into rendering (getTexture()).
- GridData gains markDirty()/markCompositeDirty(): set the flag on the
UIGrid subobject AND notify owning_view, covering both render paths.
UIGrid disambiguates via 'using UIDrawable::markDirty' so all
pre-existing UIGrid-receiver calls resolve exactly as before.
- The three Python wrappers that still need the full UIGrid (GridPoint
from entity.at(), the _GridData fallback in get_grid, find_path's temp
wrapper) reconstruct it via a single aliasing-downcast helper
(grid_as_uigrid) that documents the never-independently-allocated
GridData invariant; init/set_grid simplify (share grid_data directly).
Removing the casts is deferred to #252.
entity.texture (new, frozen surface +1): thin get/set over the entity's
own UISprite. Entities render with their OWN texture (default_texture
fallback at construction); the grid's texture only determines cell size.
Setter preserves sprite_index; rejects non-Texture (TypeError),
null-data Texture wrappers (ValueError), and deletion.
Adversarial review fixes folded in:
- set_texture/get_texture guard uninitialized Entity wrappers
(RuntimeError), isinstance errors, and null-data Textures.
- PyUIGridViewType tp_dealloc no longer unconditionally severs
GridData::owning_view: gated on last-owner (#251 use_count pattern)
plus owning-view identity. Previously ANY Grid wrapper GC while the
view lived (e.g. scene.children.append(mcrfpy.Grid(...))) silently
broke entity.grid -> Grid identity and data-layer dirty notification.
Tests: tests/regression/issue_313_entity_grid_data_test.py (texture
semantics, grid-cell-size invariance, entity.grid identity, #251 gate
survival, GridPoint outliving teardown, review-fix guards, owning_view
survival) + tests/unit/entity_texture_test.py. API snapshot golden
re-baselined: exactly +1 surface line (Entity.texture) + writability
probe flip. Docs/stubs regenerated. Native + Emscripten builds verified.
Known edges recorded in docs/api-audit-2026-04.md: texture read-back is
a fresh wrapper each get (no Texture __eq__); sprite_index not
re-validated against a new atlas. Multi-view markDirty broadcast and
pure-GridData wrappers remain deferred to #252. Addresses #314.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-11 00:51:22 -04:00
|
|
|
Canonical; matches grid_pos.
|
F15: convert frozen binding docstrings to MCRF_* macros (#314)
Convert 289 raw PyMethodDef/PyGetSetDef docstring slots to MCRF_METHOD /
MCRF_PROPERTY across the 20 frozen (non-3D) binding files, bringing the
frozen surface to 100% macro compliance (check_frozen_docstrings.sh PASS).
Done via a one-agent-per-file workflow gated by validate_file_docstrings.sh
and per-wave build/doc-rebuild checks.
- Adds #include "McRFPy_Doc.h" where missing; fills the lone genuine doc
gap (UIGrid.at, which was MISSING a doc field in two arrays).
- McRFPy_Doc.h: comment documenting the MCRF_METHOD_DOC comma rule (the
trap that broke the GridLayers conversion mid-run).
- Rebaseline api_surface golden: property types now resolve to real types
instead of "Any" (e.g. grid_pos: Vector, on_cell_click: Callable | None),
and 11 properties correctly flip rw->ro now that their docstrings carry
"read-only" (collections, grid_size, hovered_cell, texture, view — all
verified against NULL setter slots).
- Regenerate docs/stubs/man page from the new docstrings.
Module-level functions use MCRF_METHOD(<name>, ...) (expands identically to
the intended MCRF_FUNCTION; the audit's compliance set is METHOD/PROPERTY).
Experimental 3D/Voxel bindings (src/3d/) remain exempt from the freeze.
Pre-existing failures unrelated to this change: test_animation_*,
test_constructor_comprehensive (reference the removed mcrfpy.Animation and
old constructor arity).
Refs #314
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 01:20:55 -04:00
|
|
|
- \f[V]labels\f[R]: String labels for collision and targeting
|
Replace UIEntity gridstate with DiscreteMap perspective_map; closes #294
Per-entity FOV memory moves from std::vector<UIGridPointState> (two-bool
visible/discovered pairs) to a 3-state DiscreteMap (0=UNKNOWN, 1=DISCOVERED,
2=VISIBLE), exposed as entity.perspective_map. The invariant
visible-subset-of-discovered becomes structural (single value per cell), and
the map is a live, serializable, first-class object rather than an implicit
internal array.
Changes:
- New DiscreteMap C++ class with shared ownership; PyDiscreteMapObject now
holds shared_ptr<DiscreteMap>. UIEntity holds the same shared_ptr.
- New mcrfpy.Perspective IntEnum (UNKNOWN/DISCOVERED/VISIBLE), modelled on
PyInputState.
- entity.perspective_map: lazy-allocated on first access with a grid;
setter validates size against grid and raises ValueError on mismatch;
None clears (next access lazy-reallocates fresh).
- updateVisibility() now demotes 2->1 then promotes visible cells to 2.
- entity.at(x, y) returns grid.at(x, y) when VISIBLE, else None.
- Fog-of-war rendering in UIGridView and UIGrid reads the 3-state map.
- Removed: UIEntity::gridstate, ensureGridstate(), entity.gridstate getter,
UIGridPointState struct + PyUIGridPointStateType.
- Obsolete tests deleted (test_gridpointstate_point,
issue_265_gridpointstate_dangle); 4 new tests cover lazy allocation,
identity, serialization round-trip, size validation, and the
visible-subset-of-discovered invariant.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-17 23:04:27 -04:00
|
|
|
(frozenset).
|
|
|
|
|
Assign any iterable of strings to replace all labels.
|
|
|
|
|
- \f[V]move_speed\f[R]: Animation duration for behavior movement in
|
|
|
|
|
seconds (float).
|
|
|
|
|
0 = instant.
|
|
|
|
|
Default: 0.15.
|
F15: convert frozen binding docstrings to MCRF_* macros (#314)
Convert 289 raw PyMethodDef/PyGetSetDef docstring slots to MCRF_METHOD /
MCRF_PROPERTY across the 20 frozen (non-3D) binding files, bringing the
frozen surface to 100% macro compliance (check_frozen_docstrings.sh PASS).
Done via a one-agent-per-file workflow gated by validate_file_docstrings.sh
and per-wave build/doc-rebuild checks.
- Adds #include "McRFPy_Doc.h" where missing; fills the lone genuine doc
gap (UIGrid.at, which was MISSING a doc field in two arrays).
- McRFPy_Doc.h: comment documenting the MCRF_METHOD_DOC comma rule (the
trap that broke the GridLayers conversion mid-run).
- Rebaseline api_surface golden: property types now resolve to real types
instead of "Any" (e.g. grid_pos: Vector, on_cell_click: Callable | None),
and 11 properties correctly flip rw->ro now that their docstrings carry
"read-only" (collections, grid_size, hovered_cell, texture, view — all
verified against NULL setter slots).
- Regenerate docs/stubs/man page from the new docstrings.
Module-level functions use MCRF_METHOD(<name>, ...) (expands identically to
the intended MCRF_FUNCTION; the audit's compliance set is METHOD/PROPERTY).
Experimental 3D/Voxel bindings (src/3d/) remain exempt from the freeze.
Pre-existing failures unrelated to this change: test_animation_*,
test_constructor_comprehensive (reference the removed mcrfpy.Animation and
old constructor arity).
Refs #314
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 01:20:55 -04:00
|
|
|
- \f[V]name\f[R]: Entity name for lookup (str).
|
|
|
|
|
- \f[V]opacity\f[R]: Render opacity (float).
|
|
|
|
|
0.0 = fully transparent, 1.0 = fully opaque.
|
|
|
|
|
- \f[V]perspective_map\f[R]: Per-entity FOV memory (DiscreteMap).
|
|
|
|
|
3-state values per cell: 0=unknown, 1=discovered, 2=visible.
|
|
|
|
|
Lazy-allocated on first access once entity has a grid; returns None
|
Replace UIEntity gridstate with DiscreteMap perspective_map; closes #294
Per-entity FOV memory moves from std::vector<UIGridPointState> (two-bool
visible/discovered pairs) to a 3-state DiscreteMap (0=UNKNOWN, 1=DISCOVERED,
2=VISIBLE), exposed as entity.perspective_map. The invariant
visible-subset-of-discovered becomes structural (single value per cell), and
the map is a live, serializable, first-class object rather than an implicit
internal array.
Changes:
- New DiscreteMap C++ class with shared ownership; PyDiscreteMapObject now
holds shared_ptr<DiscreteMap>. UIEntity holds the same shared_ptr.
- New mcrfpy.Perspective IntEnum (UNKNOWN/DISCOVERED/VISIBLE), modelled on
PyInputState.
- entity.perspective_map: lazy-allocated on first access with a grid;
setter validates size against grid and raises ValueError on mismatch;
None clears (next access lazy-reallocates fresh).
- updateVisibility() now demotes 2->1 then promotes visible cells to 2.
- entity.at(x, y) returns grid.at(x, y) when VISIBLE, else None.
- Fog-of-war rendering in UIGridView and UIGrid reads the 3-state map.
- Removed: UIEntity::gridstate, ensureGridstate(), entity.gridstate getter,
UIGridPointState struct + PyUIGridPointStateType.
- Obsolete tests deleted (test_gridpointstate_point,
issue_265_gridpointstate_dangle); 4 new tests cover lazy allocation,
identity, serialization round-trip, size validation, and the
visible-subset-of-discovered invariant.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-17 23:04:27 -04:00
|
|
|
otherwise.
|
F15: convert frozen binding docstrings to MCRF_* macros (#314)
Convert 289 raw PyMethodDef/PyGetSetDef docstring slots to MCRF_METHOD /
MCRF_PROPERTY across the 20 frozen (non-3D) binding files, bringing the
frozen surface to 100% macro compliance (check_frozen_docstrings.sh PASS).
Done via a one-agent-per-file workflow gated by validate_file_docstrings.sh
and per-wave build/doc-rebuild checks.
- Adds #include "McRFPy_Doc.h" where missing; fills the lone genuine doc
gap (UIGrid.at, which was MISSING a doc field in two arrays).
- McRFPy_Doc.h: comment documenting the MCRF_METHOD_DOC comma rule (the
trap that broke the GridLayers conversion mid-run).
- Rebaseline api_surface golden: property types now resolve to real types
instead of "Any" (e.g. grid_pos: Vector, on_cell_click: Callable | None),
and 11 properties correctly flip rw->ro now that their docstrings carry
"read-only" (collections, grid_size, hovered_cell, texture, view — all
verified against NULL setter slots).
- Regenerate docs/stubs/man page from the new docstrings.
Module-level functions use MCRF_METHOD(<name>, ...) (expands identically to
the intended MCRF_FUNCTION; the audit's compliance set is METHOD/PROPERTY).
Experimental 3D/Voxel bindings (src/3d/) remain exempt from the freeze.
Pre-existing failures unrelated to this change: test_animation_*,
test_constructor_comprehensive (reference the removed mcrfpy.Animation and
old constructor arity).
Refs #314
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 01:20:55 -04:00
|
|
|
The returned DiscreteMap is a live reference.
|
Windowed perspective writeback in UIEntity::updateVisibility; closes #316
Clip the demote+promote passes in updateVisibility() to an AABB sized to
fov_radius instead of two full-W*H walks per entity. A prev_fov window cache
demotes last tick's promoted rect (not the current one) so a moving entity
leaves no trailing "ghost vision". On a 1000x1000 grid the Phase 5.2 benchmark's
flat ~25-36 ms/entity writeback overhead collapses to single-digit microseconds
(384x-6577x speedup on the cheap algorithms; below timing noise on the rest).
Adversarial verify caught a regression the happy-path test missed: the
documented from_bytes -> assign -> update_visibility() load/resume path left
permanent ghost-VISIBLE cells, because prev_fov only bounds engine-promoted
cells. Fixed with a one-shot perspective_full_demote_pending flag (full demote
only on the tick after an external assignment; per-turn hot path stays
windowed). Documented the engine-owned demote contract on the perspective_map
property.
- src/UIEntity.cpp/.h: windowed demote/promote, prev_fov cache, demote flag
- src/DiscreteMap.cpp/.h: demoteVisibleRect(x0, y0, x1, y1)
- tests/regression/issue_316_sparse_perspective_test.py: 7-section regression
(equivalence matrix, radius-0, moving disjoint, trailing-edge, grid resize,
load/resume assignment, AABB margin lock)
- docs regenerated for the perspective_map docstring change
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KnywUddaFRhkxo5kijxJnv
2026-06-21 09:40:05 -04:00
|
|
|
Assigning a DiscreteMap replaces the entity\[cq]s memory (e.g.\ loading
|
|
|
|
|
a saved perspective via from_bytes); size must match the grid or
|
|
|
|
|
ValueError is raised, and the next updateVisibility() demotes any loaded
|
|
|
|
|
visible cells to discovered before recomputing FOV.
|
F15: convert frozen binding docstrings to MCRF_* macros (#314)
Convert 289 raw PyMethodDef/PyGetSetDef docstring slots to MCRF_METHOD /
MCRF_PROPERTY across the 20 frozen (non-3D) binding files, bringing the
frozen surface to 100% macro compliance (check_frozen_docstrings.sh PASS).
Done via a one-agent-per-file workflow gated by validate_file_docstrings.sh
and per-wave build/doc-rebuild checks.
- Adds #include "McRFPy_Doc.h" where missing; fills the lone genuine doc
gap (UIGrid.at, which was MISSING a doc field in two arrays).
- McRFPy_Doc.h: comment documenting the MCRF_METHOD_DOC comma rule (the
trap that broke the GridLayers conversion mid-run).
- Rebaseline api_surface golden: property types now resolve to real types
instead of "Any" (e.g. grid_pos: Vector, on_cell_click: Callable | None),
and 11 properties correctly flip rw->ro now that their docstrings carry
"read-only" (collections, grid_size, hovered_cell, texture, view — all
verified against NULL setter slots).
- Regenerate docs/stubs/man page from the new docstrings.
Module-level functions use MCRF_METHOD(<name>, ...) (expands identically to
the intended MCRF_FUNCTION; the audit's compliance set is METHOD/PROPERTY).
Experimental 3D/Voxel bindings (src/3d/) remain exempt from the freeze.
Pre-existing failures unrelated to this change: test_animation_*,
test_constructor_comprehensive (reference the removed mcrfpy.Animation and
old constructor arity).
Refs #314
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 01:20:55 -04:00
|
|
|
Assign None to clear.
|
Windowed perspective writeback in UIEntity::updateVisibility; closes #316
Clip the demote+promote passes in updateVisibility() to an AABB sized to
fov_radius instead of two full-W*H walks per entity. A prev_fov window cache
demotes last tick's promoted rect (not the current one) so a moving entity
leaves no trailing "ghost vision". On a 1000x1000 grid the Phase 5.2 benchmark's
flat ~25-36 ms/entity writeback overhead collapses to single-digit microseconds
(384x-6577x speedup on the cheap algorithms; below timing noise on the rest).
Adversarial verify caught a regression the happy-path test missed: the
documented from_bytes -> assign -> update_visibility() load/resume path left
permanent ghost-VISIBLE cells, because prev_fov only bounds engine-promoted
cells. Fixed with a one-shot perspective_full_demote_pending flag (full demote
only on the tick after an external assignment; per-turn hot path stays
windowed). Documented the engine-owned demote contract on the perspective_map
property.
- src/UIEntity.cpp/.h: windowed demote/promote, prev_fov cache, demote flag
- src/DiscreteMap.cpp/.h: demoteVisibleRect(x0, y0, x1, y1)
- tests/regression/issue_316_sparse_perspective_test.py: 7-section regression
(equivalence matrix, radius-0, moving disjoint, trailing-edge, grid resize,
load/resume assignment, AABB margin lock)
- docs regenerated for the perspective_map docstring change
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KnywUddaFRhkxo5kijxJnv
2026-06-21 09:40:05 -04:00
|
|
|
Note: updateVisibility() only auto-demotes visible cells the engine
|
|
|
|
|
itself promoted; if you write 2 (visible) into the live map by hand at a
|
|
|
|
|
cell outside the entity\[cq]s current FOV, it will not be auto-demoted
|
|
|
|
|
\[en] use 1 (discovered) to reveal remembered cells, or assign a whole
|
|
|
|
|
map to set arbitrary state.
|
Replace UIEntity gridstate with DiscreteMap perspective_map; closes #294
Per-entity FOV memory moves from std::vector<UIGridPointState> (two-bool
visible/discovered pairs) to a 3-state DiscreteMap (0=UNKNOWN, 1=DISCOVERED,
2=VISIBLE), exposed as entity.perspective_map. The invariant
visible-subset-of-discovered becomes structural (single value per cell), and
the map is a live, serializable, first-class object rather than an implicit
internal array.
Changes:
- New DiscreteMap C++ class with shared ownership; PyDiscreteMapObject now
holds shared_ptr<DiscreteMap>. UIEntity holds the same shared_ptr.
- New mcrfpy.Perspective IntEnum (UNKNOWN/DISCOVERED/VISIBLE), modelled on
PyInputState.
- entity.perspective_map: lazy-allocated on first access with a grid;
setter validates size against grid and raises ValueError on mismatch;
None clears (next access lazy-reallocates fresh).
- updateVisibility() now demotes 2->1 then promotes visible cells to 2.
- entity.at(x, y) returns grid.at(x, y) when VISIBLE, else None.
- Fog-of-war rendering in UIGridView and UIGrid reads the 3-state map.
- Removed: UIEntity::gridstate, ensureGridstate(), entity.gridstate getter,
UIGridPointState struct + PyUIGridPointStateType.
- Obsolete tests deleted (test_gridpointstate_point,
issue_265_gridpointstate_dangle); 4 new tests cover lazy allocation,
identity, serialization round-trip, size validation, and the
visible-subset-of-discovered invariant.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-17 23:04:27 -04:00
|
|
|
- \f[V]pos\f[R]: Pixel position relative to grid (Vector).
|
2026-01-23 20:49:11 -05:00
|
|
|
Computed as draw_pos * tile_size.
|
|
|
|
|
Requires entity to be attached to a grid.
|
F15: convert frozen binding docstrings to MCRF_* macros (#314)
Convert 289 raw PyMethodDef/PyGetSetDef docstring slots to MCRF_METHOD /
MCRF_PROPERTY across the 20 frozen (non-3D) binding files, bringing the
frozen surface to 100% macro compliance (check_frozen_docstrings.sh PASS).
Done via a one-agent-per-file workflow gated by validate_file_docstrings.sh
and per-wave build/doc-rebuild checks.
- Adds #include "McRFPy_Doc.h" where missing; fills the lone genuine doc
gap (UIGrid.at, which was MISSING a doc field in two arrays).
- McRFPy_Doc.h: comment documenting the MCRF_METHOD_DOC comma rule (the
trap that broke the GridLayers conversion mid-run).
- Rebaseline api_surface golden: property types now resolve to real types
instead of "Any" (e.g. grid_pos: Vector, on_cell_click: Callable | None),
and 11 properties correctly flip rw->ro now that their docstrings carry
"read-only" (collections, grid_size, hovered_cell, texture, view — all
verified against NULL setter slots).
- Regenerate docs/stubs/man page from the new docstrings.
Module-level functions use MCRF_METHOD(<name>, ...) (expands identically to
the intended MCRF_FUNCTION; the audit's compliance set is METHOD/PROPERTY).
Experimental 3D/Voxel bindings (src/3d/) remain exempt from the freeze.
Pre-existing failures unrelated to this change: test_animation_*,
test_constructor_comprehensive (reference the removed mcrfpy.Animation and
old constructor arity).
Refs #314
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 01:20:55 -04:00
|
|
|
- \f[V]shader\f[R]: GPU shader for visual effects (Shader or None).
|
|
|
|
|
Set to None to disable shader rendering.
|
Replace UIEntity gridstate with DiscreteMap perspective_map; closes #294
Per-entity FOV memory moves from std::vector<UIGridPointState> (two-bool
visible/discovered pairs) to a 3-state DiscreteMap (0=UNKNOWN, 1=DISCOVERED,
2=VISIBLE), exposed as entity.perspective_map. The invariant
visible-subset-of-discovered becomes structural (single value per cell), and
the map is a live, serializable, first-class object rather than an implicit
internal array.
Changes:
- New DiscreteMap C++ class with shared ownership; PyDiscreteMapObject now
holds shared_ptr<DiscreteMap>. UIEntity holds the same shared_ptr.
- New mcrfpy.Perspective IntEnum (UNKNOWN/DISCOVERED/VISIBLE), modelled on
PyInputState.
- entity.perspective_map: lazy-allocated on first access with a grid;
setter validates size against grid and raises ValueError on mismatch;
None clears (next access lazy-reallocates fresh).
- updateVisibility() now demotes 2->1 then promotes visible cells to 2.
- entity.at(x, y) returns grid.at(x, y) when VISIBLE, else None.
- Fog-of-war rendering in UIGridView and UIGrid reads the 3-state map.
- Removed: UIEntity::gridstate, ensureGridstate(), entity.gridstate getter,
UIGridPointState struct + PyUIGridPointStateType.
- Obsolete tests deleted (test_gridpointstate_point,
issue_265_gridpointstate_dangle); 4 new tests cover lazy allocation,
identity, serialization round-trip, size validation, and the
visible-subset-of-discovered invariant.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-17 23:04:27 -04:00
|
|
|
- \f[V]sight_radius\f[R]: FOV radius for TARGET trigger (int).
|
|
|
|
|
Default: 10.
|
|
|
|
|
- \f[V]sprite_grid\f[R]: Per-tile sprite indices for composite
|
|
|
|
|
multi-tile entities (list of lists or None).
|
|
|
|
|
Row-major, dimensions must match tile_width x tile_height.
|
|
|
|
|
Use -1 for empty tiles.
|
F15: convert frozen binding docstrings to MCRF_* macros (#314)
Convert 289 raw PyMethodDef/PyGetSetDef docstring slots to MCRF_METHOD /
MCRF_PROPERTY across the 20 frozen (non-3D) binding files, bringing the
frozen surface to 100% macro compliance (check_frozen_docstrings.sh PASS).
Done via a one-agent-per-file workflow gated by validate_file_docstrings.sh
and per-wave build/doc-rebuild checks.
- Adds #include "McRFPy_Doc.h" where missing; fills the lone genuine doc
gap (UIGrid.at, which was MISSING a doc field in two arrays).
- McRFPy_Doc.h: comment documenting the MCRF_METHOD_DOC comma rule (the
trap that broke the GridLayers conversion mid-run).
- Rebaseline api_surface golden: property types now resolve to real types
instead of "Any" (e.g. grid_pos: Vector, on_cell_click: Callable | None),
and 11 properties correctly flip rw->ro now that their docstrings carry
"read-only" (collections, grid_size, hovered_cell, texture, view — all
verified against NULL setter slots).
- Regenerate docs/stubs/man page from the new docstrings.
Module-level functions use MCRF_METHOD(<name>, ...) (expands identically to
the intended MCRF_FUNCTION; the audit's compliance set is METHOD/PROPERTY).
Experimental 3D/Voxel bindings (src/3d/) remain exempt from the freeze.
Pre-existing failures unrelated to this change: test_animation_*,
test_constructor_comprehensive (reference the removed mcrfpy.Animation and
old constructor arity).
Refs #314
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 01:20:55 -04:00
|
|
|
- \f[V]sprite_index\f[R]: Sprite index into the entity\[cq]s texture
|
|
|
|
|
atlas (int).
|
|
|
|
|
- \f[V]sprite_offset\f[R]: Pixel offset for oversized sprites (Vector).
|
Replace UIEntity gridstate with DiscreteMap perspective_map; closes #294
Per-entity FOV memory moves from std::vector<UIGridPointState> (two-bool
visible/discovered pairs) to a 3-state DiscreteMap (0=UNKNOWN, 1=DISCOVERED,
2=VISIBLE), exposed as entity.perspective_map. The invariant
visible-subset-of-discovered becomes structural (single value per cell), and
the map is a live, serializable, first-class object rather than an implicit
internal array.
Changes:
- New DiscreteMap C++ class with shared ownership; PyDiscreteMapObject now
holds shared_ptr<DiscreteMap>. UIEntity holds the same shared_ptr.
- New mcrfpy.Perspective IntEnum (UNKNOWN/DISCOVERED/VISIBLE), modelled on
PyInputState.
- entity.perspective_map: lazy-allocated on first access with a grid;
setter validates size against grid and raises ValueError on mismatch;
None clears (next access lazy-reallocates fresh).
- updateVisibility() now demotes 2->1 then promotes visible cells to 2.
- entity.at(x, y) returns grid.at(x, y) when VISIBLE, else None.
- Fog-of-war rendering in UIGridView and UIGrid reads the 3-state map.
- Removed: UIEntity::gridstate, ensureGridstate(), entity.gridstate getter,
UIGridPointState struct + PyUIGridPointStateType.
- Obsolete tests deleted (test_gridpointstate_point,
issue_265_gridpointstate_dangle); 4 new tests cover lazy allocation,
identity, serialization round-trip, size validation, and the
visible-subset-of-discovered invariant.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-17 23:04:27 -04:00
|
|
|
Applied pre-zoom during grid rendering.
|
F15: convert frozen binding docstrings to MCRF_* macros (#314)
Convert 289 raw PyMethodDef/PyGetSetDef docstring slots to MCRF_METHOD /
MCRF_PROPERTY across the 20 frozen (non-3D) binding files, bringing the
frozen surface to 100% macro compliance (check_frozen_docstrings.sh PASS).
Done via a one-agent-per-file workflow gated by validate_file_docstrings.sh
and per-wave build/doc-rebuild checks.
- Adds #include "McRFPy_Doc.h" where missing; fills the lone genuine doc
gap (UIGrid.at, which was MISSING a doc field in two arrays).
- McRFPy_Doc.h: comment documenting the MCRF_METHOD_DOC comma rule (the
trap that broke the GridLayers conversion mid-run).
- Rebaseline api_surface golden: property types now resolve to real types
instead of "Any" (e.g. grid_pos: Vector, on_cell_click: Callable | None),
and 11 properties correctly flip rw->ro now that their docstrings carry
"read-only" (collections, grid_size, hovered_cell, texture, view — all
verified against NULL setter slots).
- Regenerate docs/stubs/man page from the new docstrings.
Module-level functions use MCRF_METHOD(<name>, ...) (expands identically to
the intended MCRF_FUNCTION; the audit's compliance set is METHOD/PROPERTY).
Experimental 3D/Voxel bindings (src/3d/) remain exempt from the freeze.
Pre-existing failures unrelated to this change: test_animation_*,
test_constructor_comprehensive (reference the removed mcrfpy.Animation and
old constructor arity).
Refs #314
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 01:20:55 -04:00
|
|
|
- \f[V]sprite_offset_x\f[R]: X component of sprite pixel offset (float).
|
|
|
|
|
- \f[V]sprite_offset_y\f[R]: Y component of sprite pixel offset (float).
|
|
|
|
|
- \f[V]step\f[R]: Step callback for grid.step() turn management
|
|
|
|
|
(Callable or None).
|
Replace UIEntity gridstate with DiscreteMap perspective_map; closes #294
Per-entity FOV memory moves from std::vector<UIGridPointState> (two-bool
visible/discovered pairs) to a 3-state DiscreteMap (0=UNKNOWN, 1=DISCOVERED,
2=VISIBLE), exposed as entity.perspective_map. The invariant
visible-subset-of-discovered becomes structural (single value per cell), and
the map is a live, serializable, first-class object rather than an implicit
internal array.
Changes:
- New DiscreteMap C++ class with shared ownership; PyDiscreteMapObject now
holds shared_ptr<DiscreteMap>. UIEntity holds the same shared_ptr.
- New mcrfpy.Perspective IntEnum (UNKNOWN/DISCOVERED/VISIBLE), modelled on
PyInputState.
- entity.perspective_map: lazy-allocated on first access with a grid;
setter validates size against grid and raises ValueError on mismatch;
None clears (next access lazy-reallocates fresh).
- updateVisibility() now demotes 2->1 then promotes visible cells to 2.
- entity.at(x, y) returns grid.at(x, y) when VISIBLE, else None.
- Fog-of-war rendering in UIGridView and UIGrid reads the 3-state map.
- Removed: UIEntity::gridstate, ensureGridstate(), entity.gridstate getter,
UIGridPointState struct + PyUIGridPointStateType.
- Obsolete tests deleted (test_gridpointstate_point,
issue_265_gridpointstate_dangle); 4 new tests cover lazy allocation,
identity, serialization round-trip, size validation, and the
visible-subset-of-discovered invariant.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-17 23:04:27 -04:00
|
|
|
Called with (trigger, data) when behavior triggers fire.
|
|
|
|
|
- \f[V]target_label\f[R]: Label to search for with TARGET trigger (str
|
|
|
|
|
or None).
|
|
|
|
|
Default: None.
|
Refactor UIEntity::grid to shared_ptr<GridData>; add entity.texture; closes #313
UIEntity now depends on the grid DATA layer only:
- GridData gains cell_width_px/cell_height_px (mirrored from the grid
texture in UIGrid's 5-arg ctor; texture is write-once) so entity
tile<->pixel math no longer reaches into rendering (getTexture()).
- GridData gains markDirty()/markCompositeDirty(): set the flag on the
UIGrid subobject AND notify owning_view, covering both render paths.
UIGrid disambiguates via 'using UIDrawable::markDirty' so all
pre-existing UIGrid-receiver calls resolve exactly as before.
- The three Python wrappers that still need the full UIGrid (GridPoint
from entity.at(), the _GridData fallback in get_grid, find_path's temp
wrapper) reconstruct it via a single aliasing-downcast helper
(grid_as_uigrid) that documents the never-independently-allocated
GridData invariant; init/set_grid simplify (share grid_data directly).
Removing the casts is deferred to #252.
entity.texture (new, frozen surface +1): thin get/set over the entity's
own UISprite. Entities render with their OWN texture (default_texture
fallback at construction); the grid's texture only determines cell size.
Setter preserves sprite_index; rejects non-Texture (TypeError),
null-data Texture wrappers (ValueError), and deletion.
Adversarial review fixes folded in:
- set_texture/get_texture guard uninitialized Entity wrappers
(RuntimeError), isinstance errors, and null-data Textures.
- PyUIGridViewType tp_dealloc no longer unconditionally severs
GridData::owning_view: gated on last-owner (#251 use_count pattern)
plus owning-view identity. Previously ANY Grid wrapper GC while the
view lived (e.g. scene.children.append(mcrfpy.Grid(...))) silently
broke entity.grid -> Grid identity and data-layer dirty notification.
Tests: tests/regression/issue_313_entity_grid_data_test.py (texture
semantics, grid-cell-size invariance, entity.grid identity, #251 gate
survival, GridPoint outliving teardown, review-fix guards, owning_view
survival) + tests/unit/entity_texture_test.py. API snapshot golden
re-baselined: exactly +1 surface line (Entity.texture) + writability
probe flip. Docs/stubs regenerated. Native + Emscripten builds verified.
Known edges recorded in docs/api-audit-2026-04.md: texture read-back is
a fresh wrapper each get (no Texture __eq__); sprite_index not
re-validated against a new atlas. Multi-view markDirty broadcast and
pure-GridData wrappers remain deferred to #252. Addresses #314.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-11 00:51:22 -04:00
|
|
|
- \f[V]texture\f[R]: Sprite texture atlas (Texture).
|
F15: convert frozen binding docstrings to MCRF_* macros (#314)
Convert 289 raw PyMethodDef/PyGetSetDef docstring slots to MCRF_METHOD /
MCRF_PROPERTY across the 20 frozen (non-3D) binding files, bringing the
frozen surface to 100% macro compliance (check_frozen_docstrings.sh PASS).
Done via a one-agent-per-file workflow gated by validate_file_docstrings.sh
and per-wave build/doc-rebuild checks.
- Adds #include "McRFPy_Doc.h" where missing; fills the lone genuine doc
gap (UIGrid.at, which was MISSING a doc field in two arrays).
- McRFPy_Doc.h: comment documenting the MCRF_METHOD_DOC comma rule (the
trap that broke the GridLayers conversion mid-run).
- Rebaseline api_surface golden: property types now resolve to real types
instead of "Any" (e.g. grid_pos: Vector, on_cell_click: Callable | None),
and 11 properties correctly flip rw->ro now that their docstrings carry
"read-only" (collections, grid_size, hovered_cell, texture, view — all
verified against NULL setter slots).
- Regenerate docs/stubs/man page from the new docstrings.
Module-level functions use MCRF_METHOD(<name>, ...) (expands identically to
the intended MCRF_FUNCTION; the audit's compliance set is METHOD/PROPERTY).
Experimental 3D/Voxel bindings (src/3d/) remain exempt from the freeze.
Pre-existing failures unrelated to this change: test_animation_*,
test_constructor_comprehensive (reference the removed mcrfpy.Animation and
old constructor arity).
Refs #314
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 01:20:55 -04:00
|
|
|
Defaults to mcrfpy.default_texture at construction.
|
|
|
|
|
Setting preserves sprite_index (not re-validated against the new atlas).
|
Replace UIEntity gridstate with DiscreteMap perspective_map; closes #294
Per-entity FOV memory moves from std::vector<UIGridPointState> (two-bool
visible/discovered pairs) to a 3-state DiscreteMap (0=UNKNOWN, 1=DISCOVERED,
2=VISIBLE), exposed as entity.perspective_map. The invariant
visible-subset-of-discovered becomes structural (single value per cell), and
the map is a live, serializable, first-class object rather than an implicit
internal array.
Changes:
- New DiscreteMap C++ class with shared ownership; PyDiscreteMapObject now
holds shared_ptr<DiscreteMap>. UIEntity holds the same shared_ptr.
- New mcrfpy.Perspective IntEnum (UNKNOWN/DISCOVERED/VISIBLE), modelled on
PyInputState.
- entity.perspective_map: lazy-allocated on first access with a grid;
setter validates size against grid and raises ValueError on mismatch;
None clears (next access lazy-reallocates fresh).
- updateVisibility() now demotes 2->1 then promotes visible cells to 2.
- entity.at(x, y) returns grid.at(x, y) when VISIBLE, else None.
- Fog-of-war rendering in UIGridView and UIGrid reads the 3-state map.
- Removed: UIEntity::gridstate, ensureGridstate(), entity.gridstate getter,
UIGridPointState struct + PyUIGridPointStateType.
- Obsolete tests deleted (test_gridpointstate_point,
issue_265_gridpointstate_dangle); 4 new tests cover lazy allocation,
identity, serialization round-trip, size validation, and the
visible-subset-of-discovered invariant.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-17 23:04:27 -04:00
|
|
|
- \f[V]tile_height\f[R]: Entity height in tiles (int).
|
|
|
|
|
Must be >= 1.
|
|
|
|
|
Default 1.
|
F15: convert frozen binding docstrings to MCRF_* macros (#314)
Convert 289 raw PyMethodDef/PyGetSetDef docstring slots to MCRF_METHOD /
MCRF_PROPERTY across the 20 frozen (non-3D) binding files, bringing the
frozen surface to 100% macro compliance (check_frozen_docstrings.sh PASS).
Done via a one-agent-per-file workflow gated by validate_file_docstrings.sh
and per-wave build/doc-rebuild checks.
- Adds #include "McRFPy_Doc.h" where missing; fills the lone genuine doc
gap (UIGrid.at, which was MISSING a doc field in two arrays).
- McRFPy_Doc.h: comment documenting the MCRF_METHOD_DOC comma rule (the
trap that broke the GridLayers conversion mid-run).
- Rebaseline api_surface golden: property types now resolve to real types
instead of "Any" (e.g. grid_pos: Vector, on_cell_click: Callable | None),
and 11 properties correctly flip rw->ro now that their docstrings carry
"read-only" (collections, grid_size, hovered_cell, texture, view — all
verified against NULL setter slots).
- Regenerate docs/stubs/man page from the new docstrings.
Module-level functions use MCRF_METHOD(<name>, ...) (expands identically to
the intended MCRF_FUNCTION; the audit's compliance set is METHOD/PROPERTY).
Experimental 3D/Voxel bindings (src/3d/) remain exempt from the freeze.
Pre-existing failures unrelated to this change: test_animation_*,
test_constructor_comprehensive (reference the removed mcrfpy.Animation and
old constructor arity).
Refs #314
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 01:20:55 -04:00
|
|
|
- \f[V]tile_size\f[R]: Entity size in tiles as (width, height) (Vector).
|
Replace UIEntity gridstate with DiscreteMap perspective_map; closes #294
Per-entity FOV memory moves from std::vector<UIGridPointState> (two-bool
visible/discovered pairs) to a 3-state DiscreteMap (0=UNKNOWN, 1=DISCOVERED,
2=VISIBLE), exposed as entity.perspective_map. The invariant
visible-subset-of-discovered becomes structural (single value per cell), and
the map is a live, serializable, first-class object rather than an implicit
internal array.
Changes:
- New DiscreteMap C++ class with shared ownership; PyDiscreteMapObject now
holds shared_ptr<DiscreteMap>. UIEntity holds the same shared_ptr.
- New mcrfpy.Perspective IntEnum (UNKNOWN/DISCOVERED/VISIBLE), modelled on
PyInputState.
- entity.perspective_map: lazy-allocated on first access with a grid;
setter validates size against grid and raises ValueError on mismatch;
None clears (next access lazy-reallocates fresh).
- updateVisibility() now demotes 2->1 then promotes visible cells to 2.
- entity.at(x, y) returns grid.at(x, y) when VISIBLE, else None.
- Fog-of-war rendering in UIGridView and UIGrid reads the 3-state map.
- Removed: UIEntity::gridstate, ensureGridstate(), entity.gridstate getter,
UIGridPointState struct + PyUIGridPointStateType.
- Obsolete tests deleted (test_gridpointstate_point,
issue_265_gridpointstate_dangle); 4 new tests cover lazy allocation,
identity, serialization round-trip, size validation, and the
visible-subset-of-discovered invariant.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-17 23:04:27 -04:00
|
|
|
Default (1, 1).
|
|
|
|
|
- \f[V]tile_width\f[R]: Entity width in tiles (int).
|
|
|
|
|
Must be >= 1.
|
|
|
|
|
Default 1.
|
|
|
|
|
- \f[V]turn_order\f[R]: Turn order for grid.step() (int).
|
|
|
|
|
0 = skip, higher values go later.
|
|
|
|
|
Default: 1.
|
|
|
|
|
- \f[V]uniforms\f[R] \f[I](read-only)\f[R]: Collection of shader
|
F15: convert frozen binding docstrings to MCRF_* macros (#314)
Convert 289 raw PyMethodDef/PyGetSetDef docstring slots to MCRF_METHOD /
MCRF_PROPERTY across the 20 frozen (non-3D) binding files, bringing the
frozen surface to 100% macro compliance (check_frozen_docstrings.sh PASS).
Done via a one-agent-per-file workflow gated by validate_file_docstrings.sh
and per-wave build/doc-rebuild checks.
- Adds #include "McRFPy_Doc.h" where missing; fills the lone genuine doc
gap (UIGrid.at, which was MISSING a doc field in two arrays).
- McRFPy_Doc.h: comment documenting the MCRF_METHOD_DOC comma rule (the
trap that broke the GridLayers conversion mid-run).
- Rebaseline api_surface golden: property types now resolve to real types
instead of "Any" (e.g. grid_pos: Vector, on_cell_click: Callable | None),
and 11 properties correctly flip rw->ro now that their docstrings carry
"read-only" (collections, grid_size, hovered_cell, texture, view — all
verified against NULL setter slots).
- Regenerate docs/stubs/man page from the new docstrings.
Module-level functions use MCRF_METHOD(<name>, ...) (expands identically to
the intended MCRF_FUNCTION; the audit's compliance set is METHOD/PROPERTY).
Experimental 3D/Voxel bindings (src/3d/) remain exempt from the freeze.
Pre-existing failures unrelated to this change: test_animation_*,
test_constructor_comprehensive (reference the removed mcrfpy.Animation and
old constructor arity).
Refs #314
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 01:20:55 -04:00
|
|
|
uniforms (UniformCollection, read-only).
|
|
|
|
|
Set values via dict-like syntax: entity.uniforms[`name'] = value.
|
|
|
|
|
- \f[V]visible\f[R]: Visibility flag (bool).
|
|
|
|
|
When False, the entity is not rendered.
|
|
|
|
|
- \f[V]x\f[R]: Pixel X position relative to grid (float).
|
2026-01-23 20:49:11 -05:00
|
|
|
Requires entity to be attached to a grid.
|
F15: convert frozen binding docstrings to MCRF_* macros (#314)
Convert 289 raw PyMethodDef/PyGetSetDef docstring slots to MCRF_METHOD /
MCRF_PROPERTY across the 20 frozen (non-3D) binding files, bringing the
frozen surface to 100% macro compliance (check_frozen_docstrings.sh PASS).
Done via a one-agent-per-file workflow gated by validate_file_docstrings.sh
and per-wave build/doc-rebuild checks.
- Adds #include "McRFPy_Doc.h" where missing; fills the lone genuine doc
gap (UIGrid.at, which was MISSING a doc field in two arrays).
- McRFPy_Doc.h: comment documenting the MCRF_METHOD_DOC comma rule (the
trap that broke the GridLayers conversion mid-run).
- Rebaseline api_surface golden: property types now resolve to real types
instead of "Any" (e.g. grid_pos: Vector, on_cell_click: Callable | None),
and 11 properties correctly flip rw->ro now that their docstrings carry
"read-only" (collections, grid_size, hovered_cell, texture, view — all
verified against NULL setter slots).
- Regenerate docs/stubs/man page from the new docstrings.
Module-level functions use MCRF_METHOD(<name>, ...) (expands identically to
the intended MCRF_FUNCTION; the audit's compliance set is METHOD/PROPERTY).
Experimental 3D/Voxel bindings (src/3d/) remain exempt from the freeze.
Pre-existing failures unrelated to this change: test_animation_*,
test_constructor_comprehensive (reference the removed mcrfpy.Animation and
old constructor arity).
Refs #314
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 01:20:55 -04:00
|
|
|
- \f[V]y\f[R]: Pixel Y position relative to grid (float).
|
2026-01-23 20:49:11 -05:00
|
|
|
Requires entity to be attached to a grid.
|
2025-10-30 21:20:50 -04:00
|
|
|
.PP
|
2026-01-23 20:49:11 -05:00
|
|
|
\f[B]Methods:\f[R]
|
Replace UIEntity gridstate with DiscreteMap perspective_map; closes #294
Per-entity FOV memory moves from std::vector<UIGridPointState> (two-bool
visible/discovered pairs) to a 3-state DiscreteMap (0=UNKNOWN, 1=DISCOVERED,
2=VISIBLE), exposed as entity.perspective_map. The invariant
visible-subset-of-discovered becomes structural (single value per cell), and
the map is a live, serializable, first-class object rather than an implicit
internal array.
Changes:
- New DiscreteMap C++ class with shared ownership; PyDiscreteMapObject now
holds shared_ptr<DiscreteMap>. UIEntity holds the same shared_ptr.
- New mcrfpy.Perspective IntEnum (UNKNOWN/DISCOVERED/VISIBLE), modelled on
PyInputState.
- entity.perspective_map: lazy-allocated on first access with a grid;
setter validates size against grid and raises ValueError on mismatch;
None clears (next access lazy-reallocates fresh).
- updateVisibility() now demotes 2->1 then promotes visible cells to 2.
- entity.at(x, y) returns grid.at(x, y) when VISIBLE, else None.
- Fog-of-war rendering in UIGridView and UIGrid reads the 3-state map.
- Removed: UIEntity::gridstate, ensureGridstate(), entity.gridstate getter,
UIGridPointState struct + PyUIGridPointStateType.
- Obsolete tests deleted (test_gridpointstate_point,
issue_265_gridpointstate_dangle); 4 new tests cover lazy allocation,
identity, serialization round-trip, size validation, and the
visible-subset-of-discovered invariant.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-17 23:04:27 -04:00
|
|
|
.SS \f[V]add_label(label: str) -> None\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Add a label to this entity.
|
F15: convert frozen binding docstrings to MCRF_* macros (#314)
Convert 289 raw PyMethodDef/PyGetSetDef docstring slots to MCRF_METHOD /
MCRF_PROPERTY across the 20 frozen (non-3D) binding files, bringing the
frozen surface to 100% macro compliance (check_frozen_docstrings.sh PASS).
Done via a one-agent-per-file workflow gated by validate_file_docstrings.sh
and per-wave build/doc-rebuild checks.
- Adds #include "McRFPy_Doc.h" where missing; fills the lone genuine doc
gap (UIGrid.at, which was MISSING a doc field in two arrays).
- McRFPy_Doc.h: comment documenting the MCRF_METHOD_DOC comma rule (the
trap that broke the GridLayers conversion mid-run).
- Rebaseline api_surface golden: property types now resolve to real types
instead of "Any" (e.g. grid_pos: Vector, on_cell_click: Callable | None),
and 11 properties correctly flip rw->ro now that their docstrings carry
"read-only" (collections, grid_size, hovered_cell, texture, view — all
verified against NULL setter slots).
- Regenerate docs/stubs/man page from the new docstrings.
Module-level functions use MCRF_METHOD(<name>, ...) (expands identically to
the intended MCRF_FUNCTION; the audit's compliance set is METHOD/PROPERTY).
Experimental 3D/Voxel bindings (src/3d/) remain exempt from the freeze.
Pre-existing failures unrelated to this change: test_animation_*,
test_constructor_comprehensive (reference the removed mcrfpy.Animation and
old constructor arity).
Refs #314
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 01:20:55 -04:00
|
|
|
Idempotent; adding the same label twice is safe.
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Arguments:\f[R] - \f[V]label\f[R]: String label to add
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Returns:\f[R] None
|
Replace UIEntity gridstate with DiscreteMap perspective_map; closes #294
Per-entity FOV memory moves from std::vector<UIGridPointState> (two-bool
visible/discovered pairs) to a 3-state DiscreteMap (0=UNKNOWN, 1=DISCOVERED,
2=VISIBLE), exposed as entity.perspective_map. The invariant
visible-subset-of-discovered becomes structural (single value per cell), and
the map is a live, serializable, first-class object rather than an implicit
internal array.
Changes:
- New DiscreteMap C++ class with shared ownership; PyDiscreteMapObject now
holds shared_ptr<DiscreteMap>. UIEntity holds the same shared_ptr.
- New mcrfpy.Perspective IntEnum (UNKNOWN/DISCOVERED/VISIBLE), modelled on
PyInputState.
- entity.perspective_map: lazy-allocated on first access with a grid;
setter validates size against grid and raises ValueError on mismatch;
None clears (next access lazy-reallocates fresh).
- updateVisibility() now demotes 2->1 then promotes visible cells to 2.
- entity.at(x, y) returns grid.at(x, y) when VISIBLE, else None.
- Fog-of-war rendering in UIGridView and UIGrid reads the 3-state map.
- Removed: UIEntity::gridstate, ensureGridstate(), entity.gridstate getter,
UIGridPointState struct + PyUIGridPointStateType.
- Obsolete tests deleted (test_gridpointstate_point,
issue_265_gridpointstate_dangle); 4 new tests cover lazy allocation,
identity, serialization round-trip, size validation, and the
visible-subset-of-discovered invariant.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-17 23:04:27 -04:00
|
|
|
.SS \f[V]animate(property: str, target: Any, duration: float, easing=None, delta=False, loop=False, callback=None, conflict_mode=\[aq]replace\[aq]) -> Animation\f[R]
|
2025-10-30 21:20:50 -04:00
|
|
|
.PP
|
2026-01-23 20:49:11 -05:00
|
|
|
Create and start an animation on this entity\[cq]s property.
|
2025-10-30 21:20:50 -04:00
|
|
|
.PP
|
|
|
|
|
Note:
|
|
|
|
|
.PP
|
2026-01-23 20:49:11 -05:00
|
|
|
\f[B]Arguments:\f[R] - \f[V]property\f[R]: Name of the property to
|
|
|
|
|
animate: `draw_x', `draw_y' (tile coords), `sprite_scale',
|
F15: correct docstring accuracy from adversarial verify pass (#314)
Follow-up to the macro conversion: an adversarial verify pass (one agent per
file vs. the C++ implementation + stubs) found 62 content issues; the real
ones are fixed here.
Callbacks (centralized):
- on_click: receives (pos, MouseButton, InputState), not str (8 files).
- on_enter/on_exit/on_move (UIBase.h): hover passes only (pos) -- removed the
fictional button/action args.
- bounds/global_bounds (UIBase.h): mark (tuple, read-only).
Signatures / types:
- Grid.find_path: document heuristic + weight; get_dijkstra_map: document roots;
compute_fov: FOV | int = FOV.BASIC (not the C constant FOV_BASIC) + Returns;
at/is_in_fov: document (pos) and (x, y) call forms.
- get_metrics: document all 16 returned dict keys (was 8); bresenham: drop the
bogus '*' keyword-only separator.
- Nullable defaults typed correctly: BSP seed/size, ColorLayer draw_fov/
apply_perspective Color|None, Entity.visible_entities radius int=-1 (None is
rejected by the 'i' parser -> see #319).
- Type-token fixes: GridView.center -> Vector; GridView.texture -> (None,
read-only) (unimplemented, #318); GridPoint.grid_pos -> (tuple, read-only);
EntityCollection.find -> Entity | list[Entity] | None; extend RuntimeError;
UniformCollection.values -> list[float | tuple | None].
- automation: onScreen (x, y) form documented; scroll notes x is ignored (#317).
Also: correct stale AStarPath/DijkstraMap signatures in docs/api-audit-2026-04.md
(the bindings were right, the audit table was outdated). Rebaseline the API
snapshot golden and regenerate docs/stubs.
Code-level bugs surfaced by the pass are filed as #317, #318, #319.
Refs #314, #317, #318, #319
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 06:43:47 -04:00
|
|
|
`sprite_index', `sprite_offset_x', `sprite_offset_y' - \f[V]target\f[R]:
|
|
|
|
|
Target value - float, int, or list of int (for sprite frame sequences) -
|
|
|
|
|
\f[V]duration\f[R]: Animation duration in seconds - \f[V]easing\f[R]:
|
|
|
|
|
Easing function: Easing enum value, string name, or None for linear -
|
|
|
|
|
\f[V]delta\f[R]: If True, target is relative to current value; if False,
|
|
|
|
|
target is absolute - \f[V]loop\f[R]: If True, animation repeats from
|
|
|
|
|
start when it reaches the end (default False) - \f[V]callback\f[R]:
|
|
|
|
|
Optional callable invoked when animation completes (not called for
|
|
|
|
|
looping animations) - \f[V]conflict_mode\f[R]: `replace' (default),
|
|
|
|
|
`queue', or `error' if property already animating
|
2026-01-23 20:49:11 -05:00
|
|
|
.PP
|
|
|
|
|
\f[B]Returns:\f[R] Animation object for monitoring progress
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Raises:\f[R] ValueError: If property name is not valid for Entity
|
F15: correct docstring accuracy from adversarial verify pass (#314)
Follow-up to the macro conversion: an adversarial verify pass (one agent per
file vs. the C++ implementation + stubs) found 62 content issues; the real
ones are fixed here.
Callbacks (centralized):
- on_click: receives (pos, MouseButton, InputState), not str (8 files).
- on_enter/on_exit/on_move (UIBase.h): hover passes only (pos) -- removed the
fictional button/action args.
- bounds/global_bounds (UIBase.h): mark (tuple, read-only).
Signatures / types:
- Grid.find_path: document heuristic + weight; get_dijkstra_map: document roots;
compute_fov: FOV | int = FOV.BASIC (not the C constant FOV_BASIC) + Returns;
at/is_in_fov: document (pos) and (x, y) call forms.
- get_metrics: document all 16 returned dict keys (was 8); bresenham: drop the
bogus '*' keyword-only separator.
- Nullable defaults typed correctly: BSP seed/size, ColorLayer draw_fov/
apply_perspective Color|None, Entity.visible_entities radius int=-1 (None is
rejected by the 'i' parser -> see #319).
- Type-token fixes: GridView.center -> Vector; GridView.texture -> (None,
read-only) (unimplemented, #318); GridPoint.grid_pos -> (tuple, read-only);
EntityCollection.find -> Entity | list[Entity] | None; extend RuntimeError;
UniformCollection.values -> list[float | tuple | None].
- automation: onScreen (x, y) form documented; scroll notes x is ignored (#317).
Also: correct stale AStarPath/DijkstraMap signatures in docs/api-audit-2026-04.md
(the bindings were right, the audit table was outdated). Rebaseline the API
snapshot golden and regenerate docs/stubs.
Code-level bugs surfaced by the pass are filed as #317, #318, #319.
Refs #314, #317, #318, #319
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 06:43:47 -04:00
|
|
|
(draw_x, draw_y, sprite_scale, sprite_index, sprite_offset_x,
|
|
|
|
|
sprite_offset_y) Use `draw_x'/`draw_y' to animate tile coordinates for
|
|
|
|
|
smooth movement between grid cells.
|
Replace UIEntity gridstate with DiscreteMap perspective_map; closes #294
Per-entity FOV memory moves from std::vector<UIGridPointState> (two-bool
visible/discovered pairs) to a 3-state DiscreteMap (0=UNKNOWN, 1=DISCOVERED,
2=VISIBLE), exposed as entity.perspective_map. The invariant
visible-subset-of-discovered becomes structural (single value per cell), and
the map is a live, serializable, first-class object rather than an implicit
internal array.
Changes:
- New DiscreteMap C++ class with shared ownership; PyDiscreteMapObject now
holds shared_ptr<DiscreteMap>. UIEntity holds the same shared_ptr.
- New mcrfpy.Perspective IntEnum (UNKNOWN/DISCOVERED/VISIBLE), modelled on
PyInputState.
- entity.perspective_map: lazy-allocated on first access with a grid;
setter validates size against grid and raises ValueError on mismatch;
None clears (next access lazy-reallocates fresh).
- updateVisibility() now demotes 2->1 then promotes visible cells to 2.
- entity.at(x, y) returns grid.at(x, y) when VISIBLE, else None.
- Fog-of-war rendering in UIGridView and UIGrid reads the 3-state map.
- Removed: UIEntity::gridstate, ensureGridstate(), entity.gridstate getter,
UIGridPointState struct + PyUIGridPointStateType.
- Obsolete tests deleted (test_gridpointstate_point,
issue_265_gridpointstate_dangle); 4 new tests cover lazy allocation,
identity, serialization round-trip, size validation, and the
visible-subset-of-discovered invariant.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-17 23:04:27 -04:00
|
|
|
Use list target with loop=True for repeating sprite frame animations.
|
F15: correct docstring accuracy from adversarial verify pass (#314)
Follow-up to the macro conversion: an adversarial verify pass (one agent per
file vs. the C++ implementation + stubs) found 62 content issues; the real
ones are fixed here.
Callbacks (centralized):
- on_click: receives (pos, MouseButton, InputState), not str (8 files).
- on_enter/on_exit/on_move (UIBase.h): hover passes only (pos) -- removed the
fictional button/action args.
- bounds/global_bounds (UIBase.h): mark (tuple, read-only).
Signatures / types:
- Grid.find_path: document heuristic + weight; get_dijkstra_map: document roots;
compute_fov: FOV | int = FOV.BASIC (not the C constant FOV_BASIC) + Returns;
at/is_in_fov: document (pos) and (x, y) call forms.
- get_metrics: document all 16 returned dict keys (was 8); bresenham: drop the
bogus '*' keyword-only separator.
- Nullable defaults typed correctly: BSP seed/size, ColorLayer draw_fov/
apply_perspective Color|None, Entity.visible_entities radius int=-1 (None is
rejected by the 'i' parser -> see #319).
- Type-token fixes: GridView.center -> Vector; GridView.texture -> (None,
read-only) (unimplemented, #318); GridPoint.grid_pos -> (tuple, read-only);
EntityCollection.find -> Entity | list[Entity] | None; extend RuntimeError;
UniformCollection.values -> list[float | tuple | None].
- automation: onScreen (x, y) form documented; scroll notes x is ignored (#317).
Also: correct stale AStarPath/DijkstraMap signatures in docs/api-audit-2026-04.md
(the bindings were right, the audit table was outdated). Rebaseline the API
snapshot golden and regenerate docs/stubs.
Code-level bugs surfaced by the pass are filed as #317, #318, #319.
Refs #314, #317, #318, #319
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 06:43:47 -04:00
|
|
|
`x' and `y' are accepted as aliases for `draw_x' and `draw_y'.
|
F15: convert frozen binding docstrings to MCRF_* macros (#314)
Convert 289 raw PyMethodDef/PyGetSetDef docstring slots to MCRF_METHOD /
MCRF_PROPERTY across the 20 frozen (non-3D) binding files, bringing the
frozen surface to 100% macro compliance (check_frozen_docstrings.sh PASS).
Done via a one-agent-per-file workflow gated by validate_file_docstrings.sh
and per-wave build/doc-rebuild checks.
- Adds #include "McRFPy_Doc.h" where missing; fills the lone genuine doc
gap (UIGrid.at, which was MISSING a doc field in two arrays).
- McRFPy_Doc.h: comment documenting the MCRF_METHOD_DOC comma rule (the
trap that broke the GridLayers conversion mid-run).
- Rebaseline api_surface golden: property types now resolve to real types
instead of "Any" (e.g. grid_pos: Vector, on_cell_click: Callable | None),
and 11 properties correctly flip rw->ro now that their docstrings carry
"read-only" (collections, grid_size, hovered_cell, texture, view — all
verified against NULL setter slots).
- Regenerate docs/stubs/man page from the new docstrings.
Module-level functions use MCRF_METHOD(<name>, ...) (expands identically to
the intended MCRF_FUNCTION; the audit's compliance set is METHOD/PROPERTY).
Experimental 3D/Voxel bindings (src/3d/) remain exempt from the freeze.
Pre-existing failures unrelated to this change: test_animation_*,
test_constructor_comprehensive (reference the removed mcrfpy.Animation and
old constructor arity).
Refs #314
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 01:20:55 -04:00
|
|
|
.SS \f[V]at(x: int, y: int) -> GridPoint | None\f[R]
|
2026-01-23 20:49:11 -05:00
|
|
|
.PP
|
Replace UIEntity gridstate with DiscreteMap perspective_map; closes #294
Per-entity FOV memory moves from std::vector<UIGridPointState> (two-bool
visible/discovered pairs) to a 3-state DiscreteMap (0=UNKNOWN, 1=DISCOVERED,
2=VISIBLE), exposed as entity.perspective_map. The invariant
visible-subset-of-discovered becomes structural (single value per cell), and
the map is a live, serializable, first-class object rather than an implicit
internal array.
Changes:
- New DiscreteMap C++ class with shared ownership; PyDiscreteMapObject now
holds shared_ptr<DiscreteMap>. UIEntity holds the same shared_ptr.
- New mcrfpy.Perspective IntEnum (UNKNOWN/DISCOVERED/VISIBLE), modelled on
PyInputState.
- entity.perspective_map: lazy-allocated on first access with a grid;
setter validates size against grid and raises ValueError on mismatch;
None clears (next access lazy-reallocates fresh).
- updateVisibility() now demotes 2->1 then promotes visible cells to 2.
- entity.at(x, y) returns grid.at(x, y) when VISIBLE, else None.
- Fog-of-war rendering in UIGridView and UIGrid reads the 3-state map.
- Removed: UIEntity::gridstate, ensureGridstate(), entity.gridstate getter,
UIGridPointState struct + PyUIGridPointStateType.
- Obsolete tests deleted (test_gridpointstate_point,
issue_265_gridpointstate_dangle); 4 new tests cover lazy allocation,
identity, serialization round-trip, size validation, and the
visible-subset-of-discovered invariant.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-17 23:04:27 -04:00
|
|
|
Return the GridPoint at (x, y) if currently VISIBLE to this entity\[cq]s
|
|
|
|
|
perspective_map, otherwise None.
|
2026-01-23 20:49:11 -05:00
|
|
|
.PP
|
F15: convert frozen binding docstrings to MCRF_* macros (#314)
Convert 289 raw PyMethodDef/PyGetSetDef docstring slots to MCRF_METHOD /
MCRF_PROPERTY across the 20 frozen (non-3D) binding files, bringing the
frozen surface to 100% macro compliance (check_frozen_docstrings.sh PASS).
Done via a one-agent-per-file workflow gated by validate_file_docstrings.sh
and per-wave build/doc-rebuild checks.
- Adds #include "McRFPy_Doc.h" where missing; fills the lone genuine doc
gap (UIGrid.at, which was MISSING a doc field in two arrays).
- McRFPy_Doc.h: comment documenting the MCRF_METHOD_DOC comma rule (the
trap that broke the GridLayers conversion mid-run).
- Rebaseline api_surface golden: property types now resolve to real types
instead of "Any" (e.g. grid_pos: Vector, on_cell_click: Callable | None),
and 11 properties correctly flip rw->ro now that their docstrings carry
"read-only" (collections, grid_size, hovered_cell, texture, view — all
verified against NULL setter slots).
- Regenerate docs/stubs/man page from the new docstrings.
Module-level functions use MCRF_METHOD(<name>, ...) (expands identically to
the intended MCRF_FUNCTION; the audit's compliance set is METHOD/PROPERTY).
Experimental 3D/Voxel bindings (src/3d/) remain exempt from the freeze.
Pre-existing failures unrelated to this change: test_animation_*,
test_constructor_comprehensive (reference the removed mcrfpy.Animation and
old constructor arity).
Refs #314
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 01:20:55 -04:00
|
|
|
Note:
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Arguments:\f[R] - \f[V]x\f[R]: Grid X coordinate (also accepts a
|
|
|
|
|
tuple/Vector as first positional arg) - \f[V]y\f[R]: Grid Y coordinate
|
|
|
|
|
(omit when passing a tuple or Vector)
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Returns:\f[R] GridPoint if visible, None if undiscovered or not
|
|
|
|
|
currently in FOV To inspect discovered-but-not-visible cells, read
|
|
|
|
|
entity.perspective_map[x, y] directly.
|
|
|
|
|
.SS \f[V]die() -> None\f[R]
|
2026-01-23 20:49:11 -05:00
|
|
|
.PP
|
Replace UIEntity gridstate with DiscreteMap perspective_map; closes #294
Per-entity FOV memory moves from std::vector<UIGridPointState> (two-bool
visible/discovered pairs) to a 3-state DiscreteMap (0=UNKNOWN, 1=DISCOVERED,
2=VISIBLE), exposed as entity.perspective_map. The invariant
visible-subset-of-discovered becomes structural (single value per cell), and
the map is a live, serializable, first-class object rather than an implicit
internal array.
Changes:
- New DiscreteMap C++ class with shared ownership; PyDiscreteMapObject now
holds shared_ptr<DiscreteMap>. UIEntity holds the same shared_ptr.
- New mcrfpy.Perspective IntEnum (UNKNOWN/DISCOVERED/VISIBLE), modelled on
PyInputState.
- entity.perspective_map: lazy-allocated on first access with a grid;
setter validates size against grid and raises ValueError on mismatch;
None clears (next access lazy-reallocates fresh).
- updateVisibility() now demotes 2->1 then promotes visible cells to 2.
- entity.at(x, y) returns grid.at(x, y) when VISIBLE, else None.
- Fog-of-war rendering in UIGridView and UIGrid reads the 3-state map.
- Removed: UIEntity::gridstate, ensureGridstate(), entity.gridstate getter,
UIGridPointState struct + PyUIGridPointStateType.
- Obsolete tests deleted (test_gridpointstate_point,
issue_265_gridpointstate_dangle); 4 new tests cover lazy allocation,
identity, serialization round-trip, size validation, and the
visible-subset-of-discovered invariant.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-17 23:04:27 -04:00
|
|
|
Remove this entity from its grid.
|
F15: convert frozen binding docstrings to MCRF_* macros (#314)
Convert 289 raw PyMethodDef/PyGetSetDef docstring slots to MCRF_METHOD /
MCRF_PROPERTY across the 20 frozen (non-3D) binding files, bringing the
frozen surface to 100% macro compliance (check_frozen_docstrings.sh PASS).
Done via a one-agent-per-file workflow gated by validate_file_docstrings.sh
and per-wave build/doc-rebuild checks.
- Adds #include "McRFPy_Doc.h" where missing; fills the lone genuine doc
gap (UIGrid.at, which was MISSING a doc field in two arrays).
- McRFPy_Doc.h: comment documenting the MCRF_METHOD_DOC comma rule (the
trap that broke the GridLayers conversion mid-run).
- Rebaseline api_surface golden: property types now resolve to real types
instead of "Any" (e.g. grid_pos: Vector, on_cell_click: Callable | None),
and 11 properties correctly flip rw->ro now that their docstrings carry
"read-only" (collections, grid_size, hovered_cell, texture, view — all
verified against NULL setter slots).
- Regenerate docs/stubs/man page from the new docstrings.
Module-level functions use MCRF_METHOD(<name>, ...) (expands identically to
the intended MCRF_FUNCTION; the audit's compliance set is METHOD/PROPERTY).
Experimental 3D/Voxel bindings (src/3d/) remain exempt from the freeze.
Pre-existing failures unrelated to this change: test_animation_*,
test_constructor_comprehensive (reference the removed mcrfpy.Animation and
old constructor arity).
Refs #314
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 01:20:55 -04:00
|
|
|
.PP
|
|
|
|
|
Note:
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Returns:\f[R] None Do not call during iteration over grid.entities;
|
|
|
|
|
modifying the collection during iteration raises RuntimeError.
|
|
|
|
|
.SS \f[V]find_path(target, diagonal_cost: float = 1.41, collide: str = None) -> AStarPath | None\f[R]
|
Replace UIEntity gridstate with DiscreteMap perspective_map; closes #294
Per-entity FOV memory moves from std::vector<UIGridPointState> (two-bool
visible/discovered pairs) to a 3-state DiscreteMap (0=UNKNOWN, 1=DISCOVERED,
2=VISIBLE), exposed as entity.perspective_map. The invariant
visible-subset-of-discovered becomes structural (single value per cell), and
the map is a live, serializable, first-class object rather than an implicit
internal array.
Changes:
- New DiscreteMap C++ class with shared ownership; PyDiscreteMapObject now
holds shared_ptr<DiscreteMap>. UIEntity holds the same shared_ptr.
- New mcrfpy.Perspective IntEnum (UNKNOWN/DISCOVERED/VISIBLE), modelled on
PyInputState.
- entity.perspective_map: lazy-allocated on first access with a grid;
setter validates size against grid and raises ValueError on mismatch;
None clears (next access lazy-reallocates fresh).
- updateVisibility() now demotes 2->1 then promotes visible cells to 2.
- entity.at(x, y) returns grid.at(x, y) when VISIBLE, else None.
- Fog-of-war rendering in UIGridView and UIGrid reads the 3-state map.
- Removed: UIEntity::gridstate, ensureGridstate(), entity.gridstate getter,
UIGridPointState struct + PyUIGridPointStateType.
- Obsolete tests deleted (test_gridpointstate_point,
issue_265_gridpointstate_dangle); 4 new tests cover lazy allocation,
identity, serialization round-trip, size validation, and the
visible-subset-of-discovered invariant.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-17 23:04:27 -04:00
|
|
|
.PP
|
|
|
|
|
Find a path from this entity to the target position.
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Arguments:\f[R] - \f[V]target\f[R]: Target as Vector, Entity, or
|
F15: convert frozen binding docstrings to MCRF_* macros (#314)
Convert 289 raw PyMethodDef/PyGetSetDef docstring slots to MCRF_METHOD /
MCRF_PROPERTY across the 20 frozen (non-3D) binding files, bringing the
frozen surface to 100% macro compliance (check_frozen_docstrings.sh PASS).
Done via a one-agent-per-file workflow gated by validate_file_docstrings.sh
and per-wave build/doc-rebuild checks.
- Adds #include "McRFPy_Doc.h" where missing; fills the lone genuine doc
gap (UIGrid.at, which was MISSING a doc field in two arrays).
- McRFPy_Doc.h: comment documenting the MCRF_METHOD_DOC comma rule (the
trap that broke the GridLayers conversion mid-run).
- Rebaseline api_surface golden: property types now resolve to real types
instead of "Any" (e.g. grid_pos: Vector, on_cell_click: Callable | None),
and 11 properties correctly flip rw->ro now that their docstrings carry
"read-only" (collections, grid_size, hovered_cell, texture, view — all
verified against NULL setter slots).
- Regenerate docs/stubs/man page from the new docstrings.
Module-level functions use MCRF_METHOD(<name>, ...) (expands identically to
the intended MCRF_FUNCTION; the audit's compliance set is METHOD/PROPERTY).
Experimental 3D/Voxel bindings (src/3d/) remain exempt from the freeze.
Pre-existing failures unrelated to this change: test_animation_*,
test_constructor_comprehensive (reference the removed mcrfpy.Animation and
old constructor arity).
Refs #314
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 01:20:55 -04:00
|
|
|
(x, y) tuple - \f[V]diagonal_cost\f[R]: Cost of diagonal movement
|
|
|
|
|
(default 1.41) - \f[V]collide\f[R]: Label string; entities with this
|
|
|
|
|
label block pathfinding
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Returns:\f[R] AStarPath object, or None if no path exists
|
Replace UIEntity gridstate with DiscreteMap perspective_map; closes #294
Per-entity FOV memory moves from std::vector<UIGridPointState> (two-bool
visible/discovered pairs) to a 3-state DiscreteMap (0=UNKNOWN, 1=DISCOVERED,
2=VISIBLE), exposed as entity.perspective_map. The invariant
visible-subset-of-discovered becomes structural (single value per cell), and
the map is a live, serializable, first-class object rather than an implicit
internal array.
Changes:
- New DiscreteMap C++ class with shared ownership; PyDiscreteMapObject now
holds shared_ptr<DiscreteMap>. UIEntity holds the same shared_ptr.
- New mcrfpy.Perspective IntEnum (UNKNOWN/DISCOVERED/VISIBLE), modelled on
PyInputState.
- entity.perspective_map: lazy-allocated on first access with a grid;
setter validates size against grid and raises ValueError on mismatch;
None clears (next access lazy-reallocates fresh).
- updateVisibility() now demotes 2->1 then promotes visible cells to 2.
- entity.at(x, y) returns grid.at(x, y) when VISIBLE, else None.
- Fog-of-war rendering in UIGridView and UIGrid reads the 3-state map.
- Removed: UIEntity::gridstate, ensureGridstate(), entity.gridstate getter,
UIGridPointState struct + PyUIGridPointStateType.
- Obsolete tests deleted (test_gridpointstate_point,
issue_265_gridpointstate_dangle); 4 new tests cover lazy allocation,
identity, serialization round-trip, size validation, and the
visible-subset-of-discovered invariant.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-17 23:04:27 -04:00
|
|
|
.PP
|
F15: convert frozen binding docstrings to MCRF_* macros (#314)
Convert 289 raw PyMethodDef/PyGetSetDef docstring slots to MCRF_METHOD /
MCRF_PROPERTY across the 20 frozen (non-3D) binding files, bringing the
frozen surface to 100% macro compliance (check_frozen_docstrings.sh PASS).
Done via a one-agent-per-file workflow gated by validate_file_docstrings.sh
and per-wave build/doc-rebuild checks.
- Adds #include "McRFPy_Doc.h" where missing; fills the lone genuine doc
gap (UIGrid.at, which was MISSING a doc field in two arrays).
- McRFPy_Doc.h: comment documenting the MCRF_METHOD_DOC comma rule (the
trap that broke the GridLayers conversion mid-run).
- Rebaseline api_surface golden: property types now resolve to real types
instead of "Any" (e.g. grid_pos: Vector, on_cell_click: Callable | None),
and 11 properties correctly flip rw->ro now that their docstrings carry
"read-only" (collections, grid_size, hovered_cell, texture, view — all
verified against NULL setter slots).
- Regenerate docs/stubs/man page from the new docstrings.
Module-level functions use MCRF_METHOD(<name>, ...) (expands identically to
the intended MCRF_FUNCTION; the audit's compliance set is METHOD/PROPERTY).
Experimental 3D/Voxel bindings (src/3d/) remain exempt from the freeze.
Pre-existing failures unrelated to this change: test_animation_*,
test_constructor_comprehensive (reference the removed mcrfpy.Animation and
old constructor arity).
Refs #314
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 01:20:55 -04:00
|
|
|
\f[B]Raises:\f[R] ValueError: If entity has no grid or positions are out
|
|
|
|
|
of bounds
|
Replace UIEntity gridstate with DiscreteMap perspective_map; closes #294
Per-entity FOV memory moves from std::vector<UIGridPointState> (two-bool
visible/discovered pairs) to a 3-state DiscreteMap (0=UNKNOWN, 1=DISCOVERED,
2=VISIBLE), exposed as entity.perspective_map. The invariant
visible-subset-of-discovered becomes structural (single value per cell), and
the map is a live, serializable, first-class object rather than an implicit
internal array.
Changes:
- New DiscreteMap C++ class with shared ownership; PyDiscreteMapObject now
holds shared_ptr<DiscreteMap>. UIEntity holds the same shared_ptr.
- New mcrfpy.Perspective IntEnum (UNKNOWN/DISCOVERED/VISIBLE), modelled on
PyInputState.
- entity.perspective_map: lazy-allocated on first access with a grid;
setter validates size against grid and raises ValueError on mismatch;
None clears (next access lazy-reallocates fresh).
- updateVisibility() now demotes 2->1 then promotes visible cells to 2.
- entity.at(x, y) returns grid.at(x, y) when VISIBLE, else None.
- Fog-of-war rendering in UIGridView and UIGrid reads the 3-state map.
- Removed: UIEntity::gridstate, ensureGridstate(), entity.gridstate getter,
UIGridPointState struct + PyUIGridPointStateType.
- Obsolete tests deleted (test_gridpointstate_point,
issue_265_gridpointstate_dangle); 4 new tests cover lazy allocation,
identity, serialization round-trip, size validation, and the
visible-subset-of-discovered invariant.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-17 23:04:27 -04:00
|
|
|
.SS \f[V]has_label(label: str) -> bool\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Check if this entity has the given label.
|
2025-10-30 21:20:50 -04:00
|
|
|
.PP
|
F15: convert frozen binding docstrings to MCRF_* macros (#314)
Convert 289 raw PyMethodDef/PyGetSetDef docstring slots to MCRF_METHOD /
MCRF_PROPERTY across the 20 frozen (non-3D) binding files, bringing the
frozen surface to 100% macro compliance (check_frozen_docstrings.sh PASS).
Done via a one-agent-per-file workflow gated by validate_file_docstrings.sh
and per-wave build/doc-rebuild checks.
- Adds #include "McRFPy_Doc.h" where missing; fills the lone genuine doc
gap (UIGrid.at, which was MISSING a doc field in two arrays).
- McRFPy_Doc.h: comment documenting the MCRF_METHOD_DOC comma rule (the
trap that broke the GridLayers conversion mid-run).
- Rebaseline api_surface golden: property types now resolve to real types
instead of "Any" (e.g. grid_pos: Vector, on_cell_click: Callable | None),
and 11 properties correctly flip rw->ro now that their docstrings carry
"read-only" (collections, grid_size, hovered_cell, texture, view — all
verified against NULL setter slots).
- Regenerate docs/stubs/man page from the new docstrings.
Module-level functions use MCRF_METHOD(<name>, ...) (expands identically to
the intended MCRF_FUNCTION; the audit's compliance set is METHOD/PROPERTY).
Experimental 3D/Voxel bindings (src/3d/) remain exempt from the freeze.
Pre-existing failures unrelated to this change: test_animation_*,
test_constructor_comprehensive (reference the removed mcrfpy.Animation and
old constructor arity).
Refs #314
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 01:20:55 -04:00
|
|
|
\f[B]Arguments:\f[R] - \f[V]label\f[R]: String label to check
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Returns:\f[R] True if the entity has the label, False otherwise
|
|
|
|
|
.SS \f[V]index() -> int\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Return the index of this entity in its grid\[cq]s entity collection.
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Returns:\f[R] Zero-based index of this entity in grid.entities
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Raises:\f[R] RuntimeError: If entity is not associated with a grid
|
2026-01-23 20:49:11 -05:00
|
|
|
.SS \f[V]move(dx, dy) or (delta) -> None\f[R]
|
2025-10-30 21:20:50 -04:00
|
|
|
.PP
|
|
|
|
|
Move the element by a relative offset.
|
|
|
|
|
.PP
|
|
|
|
|
Note:
|
|
|
|
|
.PP
|
2026-01-23 20:49:11 -05:00
|
|
|
\f[B]Arguments:\f[R] - \f[V]dx\f[R]: Horizontal offset in pixels (or use
|
|
|
|
|
delta) - \f[V]dy\f[R]: Vertical offset in pixels (or use delta) -
|
|
|
|
|
\f[V]delta\f[R]: Offset as tuple, list, or Vector: (dx, dy)
|
F15: convert frozen binding docstrings to MCRF_* macros (#314)
Convert 289 raw PyMethodDef/PyGetSetDef docstring slots to MCRF_METHOD /
MCRF_PROPERTY across the 20 frozen (non-3D) binding files, bringing the
frozen surface to 100% macro compliance (check_frozen_docstrings.sh PASS).
Done via a one-agent-per-file workflow gated by validate_file_docstrings.sh
and per-wave build/doc-rebuild checks.
- Adds #include "McRFPy_Doc.h" where missing; fills the lone genuine doc
gap (UIGrid.at, which was MISSING a doc field in two arrays).
- McRFPy_Doc.h: comment documenting the MCRF_METHOD_DOC comma rule (the
trap that broke the GridLayers conversion mid-run).
- Rebaseline api_surface golden: property types now resolve to real types
instead of "Any" (e.g. grid_pos: Vector, on_cell_click: Callable | None),
and 11 properties correctly flip rw->ro now that their docstrings carry
"read-only" (collections, grid_size, hovered_cell, texture, view — all
verified against NULL setter slots).
- Regenerate docs/stubs/man page from the new docstrings.
Module-level functions use MCRF_METHOD(<name>, ...) (expands identically to
the intended MCRF_FUNCTION; the audit's compliance set is METHOD/PROPERTY).
Experimental 3D/Voxel bindings (src/3d/) remain exempt from the freeze.
Pre-existing failures unrelated to this change: test_animation_*,
test_constructor_comprehensive (reference the removed mcrfpy.Animation and
old constructor arity).
Refs #314
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 01:20:55 -04:00
|
|
|
.SS \f[V]path_to(x: int, y: int) -> list\f[R]
|
2025-10-30 21:20:50 -04:00
|
|
|
.PP
|
F15: convert frozen binding docstrings to MCRF_* macros (#314)
Convert 289 raw PyMethodDef/PyGetSetDef docstring slots to MCRF_METHOD /
MCRF_PROPERTY across the 20 frozen (non-3D) binding files, bringing the
frozen surface to 100% macro compliance (check_frozen_docstrings.sh PASS).
Done via a one-agent-per-file workflow gated by validate_file_docstrings.sh
and per-wave build/doc-rebuild checks.
- Adds #include "McRFPy_Doc.h" where missing; fills the lone genuine doc
gap (UIGrid.at, which was MISSING a doc field in two arrays).
- McRFPy_Doc.h: comment documenting the MCRF_METHOD_DOC comma rule (the
trap that broke the GridLayers conversion mid-run).
- Rebaseline api_surface golden: property types now resolve to real types
instead of "Any" (e.g. grid_pos: Vector, on_cell_click: Callable | None),
and 11 properties correctly flip rw->ro now that their docstrings carry
"read-only" (collections, grid_size, hovered_cell, texture, view — all
verified against NULL setter slots).
- Regenerate docs/stubs/man page from the new docstrings.
Module-level functions use MCRF_METHOD(<name>, ...) (expands identically to
the intended MCRF_FUNCTION; the audit's compliance set is METHOD/PROPERTY).
Experimental 3D/Voxel bindings (src/3d/) remain exempt from the freeze.
Pre-existing failures unrelated to this change: test_animation_*,
test_constructor_comprehensive (reference the removed mcrfpy.Animation and
old constructor arity).
Refs #314
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 01:20:55 -04:00
|
|
|
Find a path to the target position using A* pathfinding.
|
2025-10-30 21:20:50 -04:00
|
|
|
.PP
|
F15: convert frozen binding docstrings to MCRF_* macros (#314)
Convert 289 raw PyMethodDef/PyGetSetDef docstring slots to MCRF_METHOD /
MCRF_PROPERTY across the 20 frozen (non-3D) binding files, bringing the
frozen surface to 100% macro compliance (check_frozen_docstrings.sh PASS).
Done via a one-agent-per-file workflow gated by validate_file_docstrings.sh
and per-wave build/doc-rebuild checks.
- Adds #include "McRFPy_Doc.h" where missing; fills the lone genuine doc
gap (UIGrid.at, which was MISSING a doc field in two arrays).
- McRFPy_Doc.h: comment documenting the MCRF_METHOD_DOC comma rule (the
trap that broke the GridLayers conversion mid-run).
- Rebaseline api_surface golden: property types now resolve to real types
instead of "Any" (e.g. grid_pos: Vector, on_cell_click: Callable | None),
and 11 properties correctly flip rw->ro now that their docstrings carry
"read-only" (collections, grid_size, hovered_cell, texture, view — all
verified against NULL setter slots).
- Regenerate docs/stubs/man page from the new docstrings.
Module-level functions use MCRF_METHOD(<name>, ...) (expands identically to
the intended MCRF_FUNCTION; the audit's compliance set is METHOD/PROPERTY).
Experimental 3D/Voxel bindings (src/3d/) remain exempt from the freeze.
Pre-existing failures unrelated to this change: test_animation_*,
test_constructor_comprehensive (reference the removed mcrfpy.Animation and
old constructor arity).
Refs #314
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 01:20:55 -04:00
|
|
|
\f[B]Arguments:\f[R] - \f[V]x\f[R]: Target X coordinate (also accepts a
|
|
|
|
|
tuple/Vector as first positional arg) - \f[V]y\f[R]: Target Y coordinate
|
|
|
|
|
(omit when passing a tuple or Vector)
|
2025-10-30 21:20:50 -04:00
|
|
|
.PP
|
F15: convert frozen binding docstrings to MCRF_* macros (#314)
Convert 289 raw PyMethodDef/PyGetSetDef docstring slots to MCRF_METHOD /
MCRF_PROPERTY across the 20 frozen (non-3D) binding files, bringing the
frozen surface to 100% macro compliance (check_frozen_docstrings.sh PASS).
Done via a one-agent-per-file workflow gated by validate_file_docstrings.sh
and per-wave build/doc-rebuild checks.
- Adds #include "McRFPy_Doc.h" where missing; fills the lone genuine doc
gap (UIGrid.at, which was MISSING a doc field in two arrays).
- McRFPy_Doc.h: comment documenting the MCRF_METHOD_DOC comma rule (the
trap that broke the GridLayers conversion mid-run).
- Rebaseline api_surface golden: property types now resolve to real types
instead of "Any" (e.g. grid_pos: Vector, on_cell_click: Callable | None),
and 11 properties correctly flip rw->ro now that their docstrings carry
"read-only" (collections, grid_size, hovered_cell, texture, view — all
verified against NULL setter slots).
- Regenerate docs/stubs/man page from the new docstrings.
Module-level functions use MCRF_METHOD(<name>, ...) (expands identically to
the intended MCRF_FUNCTION; the audit's compliance set is METHOD/PROPERTY).
Experimental 3D/Voxel bindings (src/3d/) remain exempt from the freeze.
Pre-existing failures unrelated to this change: test_animation_*,
test_constructor_comprehensive (reference the removed mcrfpy.Animation and
old constructor arity).
Refs #314
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 01:20:55 -04:00
|
|
|
\f[B]Returns:\f[R] List of (x, y) tuples representing the path from
|
|
|
|
|
current position to target
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Raises:\f[R] ValueError: If entity has no grid or target is out of
|
|
|
|
|
bounds
|
Replace UIEntity gridstate with DiscreteMap perspective_map; closes #294
Per-entity FOV memory moves from std::vector<UIGridPointState> (two-bool
visible/discovered pairs) to a 3-state DiscreteMap (0=UNKNOWN, 1=DISCOVERED,
2=VISIBLE), exposed as entity.perspective_map. The invariant
visible-subset-of-discovered becomes structural (single value per cell), and
the map is a live, serializable, first-class object rather than an implicit
internal array.
Changes:
- New DiscreteMap C++ class with shared ownership; PyDiscreteMapObject now
holds shared_ptr<DiscreteMap>. UIEntity holds the same shared_ptr.
- New mcrfpy.Perspective IntEnum (UNKNOWN/DISCOVERED/VISIBLE), modelled on
PyInputState.
- entity.perspective_map: lazy-allocated on first access with a grid;
setter validates size against grid and raises ValueError on mismatch;
None clears (next access lazy-reallocates fresh).
- updateVisibility() now demotes 2->1 then promotes visible cells to 2.
- entity.at(x, y) returns grid.at(x, y) when VISIBLE, else None.
- Fog-of-war rendering in UIGridView and UIGrid reads the 3-state map.
- Removed: UIEntity::gridstate, ensureGridstate(), entity.gridstate getter,
UIGridPointState struct + PyUIGridPointStateType.
- Obsolete tests deleted (test_gridpointstate_point,
issue_265_gridpointstate_dangle); 4 new tests cover lazy allocation,
identity, serialization round-trip, size validation, and the
visible-subset-of-discovered invariant.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-17 23:04:27 -04:00
|
|
|
.SS \f[V]remove_label(label: str) -> None\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Remove a label from this entity.
|
F15: convert frozen binding docstrings to MCRF_* macros (#314)
Convert 289 raw PyMethodDef/PyGetSetDef docstring slots to MCRF_METHOD /
MCRF_PROPERTY across the 20 frozen (non-3D) binding files, bringing the
frozen surface to 100% macro compliance (check_frozen_docstrings.sh PASS).
Done via a one-agent-per-file workflow gated by validate_file_docstrings.sh
and per-wave build/doc-rebuild checks.
- Adds #include "McRFPy_Doc.h" where missing; fills the lone genuine doc
gap (UIGrid.at, which was MISSING a doc field in two arrays).
- McRFPy_Doc.h: comment documenting the MCRF_METHOD_DOC comma rule (the
trap that broke the GridLayers conversion mid-run).
- Rebaseline api_surface golden: property types now resolve to real types
instead of "Any" (e.g. grid_pos: Vector, on_cell_click: Callable | None),
and 11 properties correctly flip rw->ro now that their docstrings carry
"read-only" (collections, grid_size, hovered_cell, texture, view — all
verified against NULL setter slots).
- Regenerate docs/stubs/man page from the new docstrings.
Module-level functions use MCRF_METHOD(<name>, ...) (expands identically to
the intended MCRF_FUNCTION; the audit's compliance set is METHOD/PROPERTY).
Experimental 3D/Voxel bindings (src/3d/) remain exempt from the freeze.
Pre-existing failures unrelated to this change: test_animation_*,
test_constructor_comprehensive (reference the removed mcrfpy.Animation and
old constructor arity).
Refs #314
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 01:20:55 -04:00
|
|
|
No-op if label is not present.
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Arguments:\f[R] - \f[V]label\f[R]: String label to remove
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Returns:\f[R] None
|
2026-01-23 20:49:11 -05:00
|
|
|
.SS \f[V]resize(width, height) or (size) -> None\f[R]
|
2025-10-30 21:20:50 -04:00
|
|
|
.PP
|
|
|
|
|
Resize the element to new dimensions.
|
|
|
|
|
.PP
|
|
|
|
|
Note:
|
|
|
|
|
.PP
|
2026-01-23 20:49:11 -05:00
|
|
|
\f[B]Arguments:\f[R] - \f[V]width\f[R]: New width in pixels (or use
|
|
|
|
|
size) - \f[V]height\f[R]: New height in pixels (or use size) -
|
|
|
|
|
\f[V]size\f[R]: Size as tuple, list, or Vector: (width, height)
|
F15: convert frozen binding docstrings to MCRF_* macros (#314)
Convert 289 raw PyMethodDef/PyGetSetDef docstring slots to MCRF_METHOD /
MCRF_PROPERTY across the 20 frozen (non-3D) binding files, bringing the
frozen surface to 100% macro compliance (check_frozen_docstrings.sh PASS).
Done via a one-agent-per-file workflow gated by validate_file_docstrings.sh
and per-wave build/doc-rebuild checks.
- Adds #include "McRFPy_Doc.h" where missing; fills the lone genuine doc
gap (UIGrid.at, which was MISSING a doc field in two arrays).
- McRFPy_Doc.h: comment documenting the MCRF_METHOD_DOC comma rule (the
trap that broke the GridLayers conversion mid-run).
- Rebaseline api_surface golden: property types now resolve to real types
instead of "Any" (e.g. grid_pos: Vector, on_cell_click: Callable | None),
and 11 properties correctly flip rw->ro now that their docstrings carry
"read-only" (collections, grid_size, hovered_cell, texture, view — all
verified against NULL setter slots).
- Regenerate docs/stubs/man page from the new docstrings.
Module-level functions use MCRF_METHOD(<name>, ...) (expands identically to
the intended MCRF_FUNCTION; the audit's compliance set is METHOD/PROPERTY).
Experimental 3D/Voxel bindings (src/3d/) remain exempt from the freeze.
Pre-existing failures unrelated to this change: test_animation_*,
test_constructor_comprehensive (reference the removed mcrfpy.Animation and
old constructor arity).
Refs #314
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 01:20:55 -04:00
|
|
|
.SS \f[V]set_behavior(type, waypoints=None, turns: int = 0, path=None, pathfinder=None) -> None\f[R]
|
Replace UIEntity gridstate with DiscreteMap perspective_map; closes #294
Per-entity FOV memory moves from std::vector<UIGridPointState> (two-bool
visible/discovered pairs) to a 3-state DiscreteMap (0=UNKNOWN, 1=DISCOVERED,
2=VISIBLE), exposed as entity.perspective_map. The invariant
visible-subset-of-discovered becomes structural (single value per cell), and
the map is a live, serializable, first-class object rather than an implicit
internal array.
Changes:
- New DiscreteMap C++ class with shared ownership; PyDiscreteMapObject now
holds shared_ptr<DiscreteMap>. UIEntity holds the same shared_ptr.
- New mcrfpy.Perspective IntEnum (UNKNOWN/DISCOVERED/VISIBLE), modelled on
PyInputState.
- entity.perspective_map: lazy-allocated on first access with a grid;
setter validates size against grid and raises ValueError on mismatch;
None clears (next access lazy-reallocates fresh).
- updateVisibility() now demotes 2->1 then promotes visible cells to 2.
- entity.at(x, y) returns grid.at(x, y) when VISIBLE, else None.
- Fog-of-war rendering in UIGridView and UIGrid reads the 3-state map.
- Removed: UIEntity::gridstate, ensureGridstate(), entity.gridstate getter,
UIGridPointState struct + PyUIGridPointStateType.
- Obsolete tests deleted (test_gridpointstate_point,
issue_265_gridpointstate_dangle); 4 new tests cover lazy allocation,
identity, serialization round-trip, size validation, and the
visible-subset-of-discovered invariant.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-17 23:04:27 -04:00
|
|
|
.PP
|
|
|
|
|
Configure this entity\[cq]s behavior for grid.step() turn management.
|
F15: convert frozen binding docstrings to MCRF_* macros (#314)
Convert 289 raw PyMethodDef/PyGetSetDef docstring slots to MCRF_METHOD /
MCRF_PROPERTY across the 20 frozen (non-3D) binding files, bringing the
frozen surface to 100% macro compliance (check_frozen_docstrings.sh PASS).
Done via a one-agent-per-file workflow gated by validate_file_docstrings.sh
and per-wave build/doc-rebuild checks.
- Adds #include "McRFPy_Doc.h" where missing; fills the lone genuine doc
gap (UIGrid.at, which was MISSING a doc field in two arrays).
- McRFPy_Doc.h: comment documenting the MCRF_METHOD_DOC comma rule (the
trap that broke the GridLayers conversion mid-run).
- Rebaseline api_surface golden: property types now resolve to real types
instead of "Any" (e.g. grid_pos: Vector, on_cell_click: Callable | None),
and 11 properties correctly flip rw->ro now that their docstrings carry
"read-only" (collections, grid_size, hovered_cell, texture, view — all
verified against NULL setter slots).
- Regenerate docs/stubs/man page from the new docstrings.
Module-level functions use MCRF_METHOD(<name>, ...) (expands identically to
the intended MCRF_FUNCTION; the audit's compliance set is METHOD/PROPERTY).
Experimental 3D/Voxel bindings (src/3d/) remain exempt from the freeze.
Pre-existing failures unrelated to this change: test_animation_*,
test_constructor_comprehensive (reference the removed mcrfpy.Animation and
old constructor arity).
Refs #314
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 01:20:55 -04:00
|
|
|
.PP
|
|
|
|
|
\f[B]Arguments:\f[R] - \f[V]type\f[R]: Behavior type (int or Behavior
|
|
|
|
|
enum, e.g., Behavior.PATROL) - \f[V]waypoints\f[R]: List of (x, y)
|
|
|
|
|
tuples for WAYPOINT/PATROL/LOOP behaviors - \f[V]turns\f[R]: Number of
|
|
|
|
|
turns for SLEEP behavior - \f[V]path\f[R]: Pre-computed path as list of
|
|
|
|
|
(x, y) tuples for PATH behavior - \f[V]pathfinder\f[R]: DijkstraMap,
|
|
|
|
|
AStarPath, or (x, y) target tuple for SEEK behavior
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Returns:\f[R] None
|
2025-10-30 21:20:50 -04:00
|
|
|
.SS \f[V]update_visibility() -> None\f[R]
|
|
|
|
|
.PP
|
F15: convert frozen binding docstrings to MCRF_* macros (#314)
Convert 289 raw PyMethodDef/PyGetSetDef docstring slots to MCRF_METHOD /
MCRF_PROPERTY across the 20 frozen (non-3D) binding files, bringing the
frozen surface to 100% macro compliance (check_frozen_docstrings.sh PASS).
Done via a one-agent-per-file workflow gated by validate_file_docstrings.sh
and per-wave build/doc-rebuild checks.
- Adds #include "McRFPy_Doc.h" where missing; fills the lone genuine doc
gap (UIGrid.at, which was MISSING a doc field in two arrays).
- McRFPy_Doc.h: comment documenting the MCRF_METHOD_DOC comma rule (the
trap that broke the GridLayers conversion mid-run).
- Rebaseline api_surface golden: property types now resolve to real types
instead of "Any" (e.g. grid_pos: Vector, on_cell_click: Callable | None),
and 11 properties correctly flip rw->ro now that their docstrings carry
"read-only" (collections, grid_size, hovered_cell, texture, view — all
verified against NULL setter slots).
- Regenerate docs/stubs/man page from the new docstrings.
Module-level functions use MCRF_METHOD(<name>, ...) (expands identically to
the intended MCRF_FUNCTION; the audit's compliance set is METHOD/PROPERTY).
Experimental 3D/Voxel bindings (src/3d/) remain exempt from the freeze.
Pre-existing failures unrelated to this change: test_animation_*,
test_constructor_comprehensive (reference the removed mcrfpy.Animation and
old constructor arity).
Refs #314
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 01:20:55 -04:00
|
|
|
Recompute which cells are visible from this entity\[cq]s position and
|
|
|
|
|
update perspective_map.
|
|
|
|
|
.PP
|
|
|
|
|
Note:
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Returns:\f[R] None Called automatically when the entity moves if
|
|
|
|
|
the grid has FOV configured.
|
F15: correct docstring accuracy from adversarial verify pass (#314)
Follow-up to the macro conversion: an adversarial verify pass (one agent per
file vs. the C++ implementation + stubs) found 62 content issues; the real
ones are fixed here.
Callbacks (centralized):
- on_click: receives (pos, MouseButton, InputState), not str (8 files).
- on_enter/on_exit/on_move (UIBase.h): hover passes only (pos) -- removed the
fictional button/action args.
- bounds/global_bounds (UIBase.h): mark (tuple, read-only).
Signatures / types:
- Grid.find_path: document heuristic + weight; get_dijkstra_map: document roots;
compute_fov: FOV | int = FOV.BASIC (not the C constant FOV_BASIC) + Returns;
at/is_in_fov: document (pos) and (x, y) call forms.
- get_metrics: document all 16 returned dict keys (was 8); bresenham: drop the
bogus '*' keyword-only separator.
- Nullable defaults typed correctly: BSP seed/size, ColorLayer draw_fov/
apply_perspective Color|None, Entity.visible_entities radius int=-1 (None is
rejected by the 'i' parser -> see #319).
- Type-token fixes: GridView.center -> Vector; GridView.texture -> (None,
read-only) (unimplemented, #318); GridPoint.grid_pos -> (tuple, read-only);
EntityCollection.find -> Entity | list[Entity] | None; extend RuntimeError;
UniformCollection.values -> list[float | tuple | None].
- automation: onScreen (x, y) form documented; scroll notes x is ignored (#317).
Also: correct stale AStarPath/DijkstraMap signatures in docs/api-audit-2026-04.md
(the bindings were right, the audit table was outdated). Rebaseline the API
snapshot golden and regenerate docs/stubs.
Code-level bugs surfaced by the pass are filed as #317, #318, #319.
Refs #314, #317, #318, #319
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 06:43:47 -04:00
|
|
|
.SS \f[V]visible_entities(fov=None, radius: int = -1) -> list[Entity]\f[R]
|
refactor: Rename click kwarg to on_click for API consistency (closes #126)
BREAKING CHANGE: Constructor keyword argument renamed from `click` to
`on_click` for all UIDrawable types (Frame, Caption, Sprite, Grid, Line,
Circle, Arc).
Before: Frame(pos=(0,0), size=(100,100), click=handler)
After: Frame(pos=(0,0), size=(100,100), on_click=handler)
The property name was already `on_click` - this makes the constructor
kwarg match, completing the callback naming standardization from #139.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-28 14:31:22 -05:00
|
|
|
.PP
|
|
|
|
|
Get list of other entities visible from this entity\[cq]s position.
|
|
|
|
|
.PP
|
F15: correct docstring accuracy from adversarial verify pass (#314)
Follow-up to the macro conversion: an adversarial verify pass (one agent per
file vs. the C++ implementation + stubs) found 62 content issues; the real
ones are fixed here.
Callbacks (centralized):
- on_click: receives (pos, MouseButton, InputState), not str (8 files).
- on_enter/on_exit/on_move (UIBase.h): hover passes only (pos) -- removed the
fictional button/action args.
- bounds/global_bounds (UIBase.h): mark (tuple, read-only).
Signatures / types:
- Grid.find_path: document heuristic + weight; get_dijkstra_map: document roots;
compute_fov: FOV | int = FOV.BASIC (not the C constant FOV_BASIC) + Returns;
at/is_in_fov: document (pos) and (x, y) call forms.
- get_metrics: document all 16 returned dict keys (was 8); bresenham: drop the
bogus '*' keyword-only separator.
- Nullable defaults typed correctly: BSP seed/size, ColorLayer draw_fov/
apply_perspective Color|None, Entity.visible_entities radius int=-1 (None is
rejected by the 'i' parser -> see #319).
- Type-token fixes: GridView.center -> Vector; GridView.texture -> (None,
read-only) (unimplemented, #318); GridPoint.grid_pos -> (tuple, read-only);
EntityCollection.find -> Entity | list[Entity] | None; extend RuntimeError;
UniformCollection.values -> list[float | tuple | None].
- automation: onScreen (x, y) form documented; scroll notes x is ignored (#317).
Also: correct stale AStarPath/DijkstraMap signatures in docs/api-audit-2026-04.md
(the bindings were right, the audit table was outdated). Rebaseline the API
snapshot golden and regenerate docs/stubs.
Code-level bugs surfaced by the pass are filed as #317, #318, #319.
Refs #314, #317, #318, #319
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 06:43:47 -04:00
|
|
|
Note:
|
|
|
|
|
.PP
|
F15: convert frozen binding docstrings to MCRF_* macros (#314)
Convert 289 raw PyMethodDef/PyGetSetDef docstring slots to MCRF_METHOD /
MCRF_PROPERTY across the 20 frozen (non-3D) binding files, bringing the
frozen surface to 100% macro compliance (check_frozen_docstrings.sh PASS).
Done via a one-agent-per-file workflow gated by validate_file_docstrings.sh
and per-wave build/doc-rebuild checks.
- Adds #include "McRFPy_Doc.h" where missing; fills the lone genuine doc
gap (UIGrid.at, which was MISSING a doc field in two arrays).
- McRFPy_Doc.h: comment documenting the MCRF_METHOD_DOC comma rule (the
trap that broke the GridLayers conversion mid-run).
- Rebaseline api_surface golden: property types now resolve to real types
instead of "Any" (e.g. grid_pos: Vector, on_cell_click: Callable | None),
and 11 properties correctly flip rw->ro now that their docstrings carry
"read-only" (collections, grid_size, hovered_cell, texture, view — all
verified against NULL setter slots).
- Regenerate docs/stubs/man page from the new docstrings.
Module-level functions use MCRF_METHOD(<name>, ...) (expands identically to
the intended MCRF_FUNCTION; the audit's compliance set is METHOD/PROPERTY).
Experimental 3D/Voxel bindings (src/3d/) remain exempt from the freeze.
Pre-existing failures unrelated to this change: test_animation_*,
test_constructor_comprehensive (reference the removed mcrfpy.Animation and
old constructor arity).
Refs #314
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 01:20:55 -04:00
|
|
|
\f[B]Arguments:\f[R] - \f[V]fov\f[R]: FOV algorithm to use (FOV enum or
|
F15: correct docstring accuracy from adversarial verify pass (#314)
Follow-up to the macro conversion: an adversarial verify pass (one agent per
file vs. the C++ implementation + stubs) found 62 content issues; the real
ones are fixed here.
Callbacks (centralized):
- on_click: receives (pos, MouseButton, InputState), not str (8 files).
- on_enter/on_exit/on_move (UIBase.h): hover passes only (pos) -- removed the
fictional button/action args.
- bounds/global_bounds (UIBase.h): mark (tuple, read-only).
Signatures / types:
- Grid.find_path: document heuristic + weight; get_dijkstra_map: document roots;
compute_fov: FOV | int = FOV.BASIC (not the C constant FOV_BASIC) + Returns;
at/is_in_fov: document (pos) and (x, y) call forms.
- get_metrics: document all 16 returned dict keys (was 8); bresenham: drop the
bogus '*' keyword-only separator.
- Nullable defaults typed correctly: BSP seed/size, ColorLayer draw_fov/
apply_perspective Color|None, Entity.visible_entities radius int=-1 (None is
rejected by the 'i' parser -> see #319).
- Type-token fixes: GridView.center -> Vector; GridView.texture -> (None,
read-only) (unimplemented, #318); GridPoint.grid_pos -> (tuple, read-only);
EntityCollection.find -> Entity | list[Entity] | None; extend RuntimeError;
UniformCollection.values -> list[float | tuple | None].
- automation: onScreen (x, y) form documented; scroll notes x is ignored (#317).
Also: correct stale AStarPath/DijkstraMap signatures in docs/api-audit-2026-04.md
(the bindings were right, the audit table was outdated). Rebaseline the API
snapshot golden and regenerate docs/stubs.
Code-level bugs surfaced by the pass are filed as #317, #318, #319.
Refs #314, #317, #318, #319
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 06:43:47 -04:00
|
|
|
None to use grid.fov) - \f[V]radius\f[R]: FOV radius as int; omit or
|
|
|
|
|
pass -1 to use the grid\[cq]s default fov_radius
|
F15: convert frozen binding docstrings to MCRF_* macros (#314)
Convert 289 raw PyMethodDef/PyGetSetDef docstring slots to MCRF_METHOD /
MCRF_PROPERTY across the 20 frozen (non-3D) binding files, bringing the
frozen surface to 100% macro compliance (check_frozen_docstrings.sh PASS).
Done via a one-agent-per-file workflow gated by validate_file_docstrings.sh
and per-wave build/doc-rebuild checks.
- Adds #include "McRFPy_Doc.h" where missing; fills the lone genuine doc
gap (UIGrid.at, which was MISSING a doc field in two arrays).
- McRFPy_Doc.h: comment documenting the MCRF_METHOD_DOC comma rule (the
trap that broke the GridLayers conversion mid-run).
- Rebaseline api_surface golden: property types now resolve to real types
instead of "Any" (e.g. grid_pos: Vector, on_cell_click: Callable | None),
and 11 properties correctly flip rw->ro now that their docstrings carry
"read-only" (collections, grid_size, hovered_cell, texture, view — all
verified against NULL setter slots).
- Regenerate docs/stubs/man page from the new docstrings.
Module-level functions use MCRF_METHOD(<name>, ...) (expands identically to
the intended MCRF_FUNCTION; the audit's compliance set is METHOD/PROPERTY).
Experimental 3D/Voxel bindings (src/3d/) remain exempt from the freeze.
Pre-existing failures unrelated to this change: test_animation_*,
test_constructor_comprehensive (reference the removed mcrfpy.Animation and
old constructor arity).
Refs #314
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 01:20:55 -04:00
|
|
|
.PP
|
|
|
|
|
\f[B]Returns:\f[R] List of Entity objects within field of view,
|
|
|
|
|
excluding self
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Raises:\f[R] ValueError: If entity is not associated with a grid
|
F15: correct docstring accuracy from adversarial verify pass (#314)
Follow-up to the macro conversion: an adversarial verify pass (one agent per
file vs. the C++ implementation + stubs) found 62 content issues; the real
ones are fixed here.
Callbacks (centralized):
- on_click: receives (pos, MouseButton, InputState), not str (8 files).
- on_enter/on_exit/on_move (UIBase.h): hover passes only (pos) -- removed the
fictional button/action args.
- bounds/global_bounds (UIBase.h): mark (tuple, read-only).
Signatures / types:
- Grid.find_path: document heuristic + weight; get_dijkstra_map: document roots;
compute_fov: FOV | int = FOV.BASIC (not the C constant FOV_BASIC) + Returns;
at/is_in_fov: document (pos) and (x, y) call forms.
- get_metrics: document all 16 returned dict keys (was 8); bresenham: drop the
bogus '*' keyword-only separator.
- Nullable defaults typed correctly: BSP seed/size, ColorLayer draw_fov/
apply_perspective Color|None, Entity.visible_entities radius int=-1 (None is
rejected by the 'i' parser -> see #319).
- Type-token fixes: GridView.center -> Vector; GridView.texture -> (None,
read-only) (unimplemented, #318); GridPoint.grid_pos -> (tuple, read-only);
EntityCollection.find -> Entity | list[Entity] | None; extend RuntimeError;
UniformCollection.values -> list[float | tuple | None].
- automation: onScreen (x, y) form documented; scroll notes x is ignored (#317).
Also: correct stale AStarPath/DijkstraMap signatures in docs/api-audit-2026-04.md
(the bindings were right, the audit table was outdated). Rebaseline the API
snapshot golden and regenerate docs/stubs.
Code-level bugs surfaced by the pass are filed as #317, #318, #319.
Refs #314, #317, #318, #319
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 06:43:47 -04:00
|
|
|
radius does not accept None; omit the argument entirely to use the grid
|
|
|
|
|
default.
|
Replace UIEntity gridstate with DiscreteMap perspective_map; closes #294
Per-entity FOV memory moves from std::vector<UIGridPointState> (two-bool
visible/discovered pairs) to a 3-state DiscreteMap (0=UNKNOWN, 1=DISCOVERED,
2=VISIBLE), exposed as entity.perspective_map. The invariant
visible-subset-of-discovered becomes structural (single value per cell), and
the map is a live, serializable, first-class object rather than an implicit
internal array.
Changes:
- New DiscreteMap C++ class with shared ownership; PyDiscreteMapObject now
holds shared_ptr<DiscreteMap>. UIEntity holds the same shared_ptr.
- New mcrfpy.Perspective IntEnum (UNKNOWN/DISCOVERED/VISIBLE), modelled on
PyInputState.
- entity.perspective_map: lazy-allocated on first access with a grid;
setter validates size against grid and raises ValueError on mismatch;
None clears (next access lazy-reallocates fresh).
- updateVisibility() now demotes 2->1 then promotes visible cells to 2.
- entity.at(x, y) returns grid.at(x, y) when VISIBLE, else None.
- Fog-of-war rendering in UIGridView and UIGrid reads the 3-state map.
- Removed: UIEntity::gridstate, ensureGridstate(), entity.gridstate getter,
UIGridPointState struct + PyUIGridPointStateType.
- Obsolete tests deleted (test_gridpointstate_point,
issue_265_gridpointstate_dangle); 4 new tests cover lazy allocation,
identity, serialization round-trip, size validation, and the
visible-subset-of-discovered invariant.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-17 23:04:27 -04:00
|
|
|
.SS Entity3D
|
refactor: Rename click kwarg to on_click for API consistency (closes #126)
BREAKING CHANGE: Constructor keyword argument renamed from `click` to
`on_click` for all UIDrawable types (Frame, Caption, Sprite, Grid, Line,
Circle, Arc).
Before: Frame(pos=(0,0), size=(100,100), click=handler)
After: Frame(pos=(0,0), size=(100,100), on_click=handler)
The property name was already `on_click` - this makes the constructor
kwarg match, completing the callback naming standardization from #139.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-28 14:31:22 -05:00
|
|
|
.PP
|
Replace UIEntity gridstate with DiscreteMap perspective_map; closes #294
Per-entity FOV memory moves from std::vector<UIGridPointState> (two-bool
visible/discovered pairs) to a 3-state DiscreteMap (0=UNKNOWN, 1=DISCOVERED,
2=VISIBLE), exposed as entity.perspective_map. The invariant
visible-subset-of-discovered becomes structural (single value per cell), and
the map is a live, serializable, first-class object rather than an implicit
internal array.
Changes:
- New DiscreteMap C++ class with shared ownership; PyDiscreteMapObject now
holds shared_ptr<DiscreteMap>. UIEntity holds the same shared_ptr.
- New mcrfpy.Perspective IntEnum (UNKNOWN/DISCOVERED/VISIBLE), modelled on
PyInputState.
- entity.perspective_map: lazy-allocated on first access with a grid;
setter validates size against grid and raises ValueError on mismatch;
None clears (next access lazy-reallocates fresh).
- updateVisibility() now demotes 2->1 then promotes visible cells to 2.
- entity.at(x, y) returns grid.at(x, y) when VISIBLE, else None.
- Fog-of-war rendering in UIGridView and UIGrid reads the 3-state map.
- Removed: UIEntity::gridstate, ensureGridstate(), entity.gridstate getter,
UIGridPointState struct + PyUIGridPointStateType.
- Obsolete tests deleted (test_gridpointstate_point,
issue_265_gridpointstate_dangle); 4 new tests cover lazy allocation,
identity, serialization round-trip, size validation, and the
visible-subset-of-discovered invariant.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-17 23:04:27 -04:00
|
|
|
Entity3D(pos=None, **kwargs)
|
refactor: Rename click kwarg to on_click for API consistency (closes #126)
BREAKING CHANGE: Constructor keyword argument renamed from `click` to
`on_click` for all UIDrawable types (Frame, Caption, Sprite, Grid, Line,
Circle, Arc).
Before: Frame(pos=(0,0), size=(100,100), click=handler)
After: Frame(pos=(0,0), size=(100,100), on_click=handler)
The property name was already `on_click` - this makes the constructor
kwarg match, completing the callback naming standardization from #139.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-28 14:31:22 -05:00
|
|
|
.PP
|
Replace UIEntity gridstate with DiscreteMap perspective_map; closes #294
Per-entity FOV memory moves from std::vector<UIGridPointState> (two-bool
visible/discovered pairs) to a 3-state DiscreteMap (0=UNKNOWN, 1=DISCOVERED,
2=VISIBLE), exposed as entity.perspective_map. The invariant
visible-subset-of-discovered becomes structural (single value per cell), and
the map is a live, serializable, first-class object rather than an implicit
internal array.
Changes:
- New DiscreteMap C++ class with shared ownership; PyDiscreteMapObject now
holds shared_ptr<DiscreteMap>. UIEntity holds the same shared_ptr.
- New mcrfpy.Perspective IntEnum (UNKNOWN/DISCOVERED/VISIBLE), modelled on
PyInputState.
- entity.perspective_map: lazy-allocated on first access with a grid;
setter validates size against grid and raises ValueError on mismatch;
None clears (next access lazy-reallocates fresh).
- updateVisibility() now demotes 2->1 then promotes visible cells to 2.
- entity.at(x, y) returns grid.at(x, y) when VISIBLE, else None.
- Fog-of-war rendering in UIGridView and UIGrid reads the 3-state map.
- Removed: UIEntity::gridstate, ensureGridstate(), entity.gridstate getter,
UIGridPointState struct + PyUIGridPointStateType.
- Obsolete tests deleted (test_gridpointstate_point,
issue_265_gridpointstate_dangle); 4 new tests cover lazy allocation,
identity, serialization round-trip, size validation, and the
visible-subset-of-discovered invariant.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-17 23:04:27 -04:00
|
|
|
A 3D game entity that exists on a Viewport3D\[cq]s navigation grid.
|
|
|
|
|
.PP
|
|
|
|
|
Args: pos (tuple, optional): Grid position as (x, z).
|
|
|
|
|
Default: (0, 0)
|
|
|
|
|
.PP
|
|
|
|
|
Keyword Args: viewport (Viewport3D): Viewport to attach entity to.
|
|
|
|
|
Default: None rotation (float): Y-axis rotation in degrees.
|
|
|
|
|
Default: 0 scale (float or tuple): Scale factor.
|
|
|
|
|
Default: 1.0 visible (bool): Visibility state.
|
|
|
|
|
Default: True color (Color): Entity color.
|
|
|
|
|
Default: orange
|
|
|
|
|
.PP
|
|
|
|
|
Attributes: pos (tuple): Grid position (x, z) - setting triggers
|
|
|
|
|
movement grid_pos (tuple): Same as pos (read-only) world_pos (tuple):
|
|
|
|
|
Current world coordinates (x, y, z) (read-only) rotation (float): Y-axis
|
|
|
|
|
rotation in degrees scale (float): Uniform scale factor visible (bool):
|
|
|
|
|
Visibility state color (Color): Entity render color viewport
|
|
|
|
|
(Viewport3D): Owning viewport (read-only)
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Properties:\f[R] - \f[V]anim_clip\f[R]: Current animation clip
|
|
|
|
|
name.
|
|
|
|
|
Set to play an animation.
|
|
|
|
|
- \f[V]anim_frame\f[R] \f[I](read-only)\f[R]: Current animation frame
|
|
|
|
|
number (read-only, approximate at 30fps).
|
|
|
|
|
- \f[V]anim_loop\f[R]: Whether animation loops when it reaches the end.
|
|
|
|
|
- \f[V]anim_paused\f[R]: Whether animation playback is paused.
|
|
|
|
|
- \f[V]anim_speed\f[R]: Animation playback speed multiplier.
|
|
|
|
|
1.0 = normal speed.
|
|
|
|
|
- \f[V]anim_time\f[R]: Current time position in animation (seconds).
|
|
|
|
|
- \f[V]auto_animate\f[R]: Enable auto-play of walk/idle clips based on
|
|
|
|
|
movement.
|
|
|
|
|
- \f[V]color\f[R]: Entity render color.
|
|
|
|
|
- \f[V]grid_pos\f[R]: Grid position (x, z).
|
|
|
|
|
Same as pos.
|
|
|
|
|
- \f[V]idle_clip\f[R]: Animation clip to play when entity is stationary.
|
|
|
|
|
- \f[V]is_moving\f[R] \f[I](read-only)\f[R]: Whether entity is currently
|
|
|
|
|
moving (read-only).
|
|
|
|
|
- \f[V]model\f[R]: 3D model (Model3D).
|
|
|
|
|
If None, uses placeholder cube.
|
|
|
|
|
- \f[V]name\f[R]: Entity name (str).
|
|
|
|
|
Used for find() lookup.
|
|
|
|
|
- \f[V]on_anim_complete\f[R]: Callback(entity, clip_name) when
|
|
|
|
|
non-looping animation ends.
|
|
|
|
|
- \f[V]pos\f[R]: Grid position (x, z).
|
|
|
|
|
Setting triggers smooth movement.
|
|
|
|
|
- \f[V]rotation\f[R]: Y-axis rotation in degrees.
|
|
|
|
|
- \f[V]scale\f[R]: Uniform scale factor.
|
|
|
|
|
Can also set as (x, y, z) tuple.
|
|
|
|
|
- \f[V]viewport\f[R] \f[I](read-only)\f[R]: Owning Viewport3D
|
|
|
|
|
(read-only).
|
|
|
|
|
- \f[V]visible\f[R]: Visibility state.
|
|
|
|
|
- \f[V]walk_clip\f[R]: Animation clip to play when entity is moving.
|
|
|
|
|
- \f[V]world_pos\f[R] \f[I](read-only)\f[R]: Current world position (x,
|
|
|
|
|
y, z) (read-only).
|
|
|
|
|
Includes animation interpolation.
|
2026-01-23 20:49:11 -05:00
|
|
|
.PP
|
refactor: Rename click kwarg to on_click for API consistency (closes #126)
BREAKING CHANGE: Constructor keyword argument renamed from `click` to
`on_click` for all UIDrawable types (Frame, Caption, Sprite, Grid, Line,
Circle, Arc).
Before: Frame(pos=(0,0), size=(100,100), click=handler)
After: Frame(pos=(0,0), size=(100,100), on_click=handler)
The property name was already `on_click` - this makes the constructor
kwarg match, completing the callback naming standardization from #139.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-28 14:31:22 -05:00
|
|
|
\f[B]Methods:\f[R]
|
Replace UIEntity gridstate with DiscreteMap perspective_map; closes #294
Per-entity FOV memory moves from std::vector<UIGridPointState> (two-bool
visible/discovered pairs) to a 3-state DiscreteMap (0=UNKNOWN, 1=DISCOVERED,
2=VISIBLE), exposed as entity.perspective_map. The invariant
visible-subset-of-discovered becomes structural (single value per cell), and
the map is a live, serializable, first-class object rather than an implicit
internal array.
Changes:
- New DiscreteMap C++ class with shared ownership; PyDiscreteMapObject now
holds shared_ptr<DiscreteMap>. UIEntity holds the same shared_ptr.
- New mcrfpy.Perspective IntEnum (UNKNOWN/DISCOVERED/VISIBLE), modelled on
PyInputState.
- entity.perspective_map: lazy-allocated on first access with a grid;
setter validates size against grid and raises ValueError on mismatch;
None clears (next access lazy-reallocates fresh).
- updateVisibility() now demotes 2->1 then promotes visible cells to 2.
- entity.at(x, y) returns grid.at(x, y) when VISIBLE, else None.
- Fog-of-war rendering in UIGridView and UIGrid reads the 3-state map.
- Removed: UIEntity::gridstate, ensureGridstate(), entity.gridstate getter,
UIGridPointState struct + PyUIGridPointStateType.
- Obsolete tests deleted (test_gridpointstate_point,
issue_265_gridpointstate_dangle); 4 new tests cover lazy allocation,
identity, serialization round-trip, size validation, and the
visible-subset-of-discovered invariant.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-17 23:04:27 -04:00
|
|
|
.SS \f[V]animate(property, target, duration, easing=None, delta=False, callback=None, conflict_mode=None)\f[R]
|
refactor: Rename click kwarg to on_click for API consistency (closes #126)
BREAKING CHANGE: Constructor keyword argument renamed from `click` to
`on_click` for all UIDrawable types (Frame, Caption, Sprite, Grid, Line,
Circle, Arc).
Before: Frame(pos=(0,0), size=(100,100), click=handler)
After: Frame(pos=(0,0), size=(100,100), on_click=handler)
The property name was already `on_click` - this makes the constructor
kwarg match, completing the callback naming standardization from #139.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-28 14:31:22 -05:00
|
|
|
.PP
|
Replace UIEntity gridstate with DiscreteMap perspective_map; closes #294
Per-entity FOV memory moves from std::vector<UIGridPointState> (two-bool
visible/discovered pairs) to a 3-state DiscreteMap (0=UNKNOWN, 1=DISCOVERED,
2=VISIBLE), exposed as entity.perspective_map. The invariant
visible-subset-of-discovered becomes structural (single value per cell), and
the map is a live, serializable, first-class object rather than an implicit
internal array.
Changes:
- New DiscreteMap C++ class with shared ownership; PyDiscreteMapObject now
holds shared_ptr<DiscreteMap>. UIEntity holds the same shared_ptr.
- New mcrfpy.Perspective IntEnum (UNKNOWN/DISCOVERED/VISIBLE), modelled on
PyInputState.
- entity.perspective_map: lazy-allocated on first access with a grid;
setter validates size against grid and raises ValueError on mismatch;
None clears (next access lazy-reallocates fresh).
- updateVisibility() now demotes 2->1 then promotes visible cells to 2.
- entity.at(x, y) returns grid.at(x, y) when VISIBLE, else None.
- Fog-of-war rendering in UIGridView and UIGrid reads the 3-state map.
- Removed: UIEntity::gridstate, ensureGridstate(), entity.gridstate getter,
UIGridPointState struct + PyUIGridPointStateType.
- Obsolete tests deleted (test_gridpointstate_point,
issue_265_gridpointstate_dangle); 4 new tests cover lazy allocation,
identity, serialization round-trip, size validation, and the
visible-subset-of-discovered invariant.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-17 23:04:27 -04:00
|
|
|
Animate a property over time.
|
refactor: Rename click kwarg to on_click for API consistency (closes #126)
BREAKING CHANGE: Constructor keyword argument renamed from `click` to
`on_click` for all UIDrawable types (Frame, Caption, Sprite, Grid, Line,
Circle, Arc).
Before: Frame(pos=(0,0), size=(100,100), click=handler)
After: Frame(pos=(0,0), size=(100,100), on_click=handler)
The property name was already `on_click` - this makes the constructor
kwarg match, completing the callback naming standardization from #139.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-28 14:31:22 -05:00
|
|
|
.PP
|
Replace UIEntity gridstate with DiscreteMap perspective_map; closes #294
Per-entity FOV memory moves from std::vector<UIGridPointState> (two-bool
visible/discovered pairs) to a 3-state DiscreteMap (0=UNKNOWN, 1=DISCOVERED,
2=VISIBLE), exposed as entity.perspective_map. The invariant
visible-subset-of-discovered becomes structural (single value per cell), and
the map is a live, serializable, first-class object rather than an implicit
internal array.
Changes:
- New DiscreteMap C++ class with shared ownership; PyDiscreteMapObject now
holds shared_ptr<DiscreteMap>. UIEntity holds the same shared_ptr.
- New mcrfpy.Perspective IntEnum (UNKNOWN/DISCOVERED/VISIBLE), modelled on
PyInputState.
- entity.perspective_map: lazy-allocated on first access with a grid;
setter validates size against grid and raises ValueError on mismatch;
None clears (next access lazy-reallocates fresh).
- updateVisibility() now demotes 2->1 then promotes visible cells to 2.
- entity.at(x, y) returns grid.at(x, y) when VISIBLE, else None.
- Fog-of-war rendering in UIGridView and UIGrid reads the 3-state map.
- Removed: UIEntity::gridstate, ensureGridstate(), entity.gridstate getter,
UIGridPointState struct + PyUIGridPointStateType.
- Obsolete tests deleted (test_gridpointstate_point,
issue_265_gridpointstate_dangle); 4 new tests cover lazy allocation,
identity, serialization round-trip, size validation, and the
visible-subset-of-discovered invariant.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-17 23:04:27 -04:00
|
|
|
\f[B]Arguments:\f[R] - \f[V]property\f[R]: Property name (x, y, z,
|
|
|
|
|
rotation, scale, etc.)
|
|
|
|
|
- \f[V]target\f[R]: Target value (float or int) - \f[V]duration\f[R]:
|
|
|
|
|
Animation duration in seconds - \f[V]easing\f[R]: Easing function
|
|
|
|
|
(Easing enum or None for linear) - \f[V]delta\f[R]: If True, target is
|
|
|
|
|
relative to current value - \f[V]callback\f[R]: Called with (target,
|
|
|
|
|
property, value) when complete - \f[V]conflict_mode\f[R]: `replace',
|
|
|
|
|
`queue', or `error'
|
|
|
|
|
.SS \f[V]at(x, z) -> dict\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Get visibility state for a cell from this entity\[cq]s perspective.
|
|
|
|
|
Returns dict with `visible' and `discovered' boolean keys.
|
|
|
|
|
.SS \f[V]clear_path()\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Clear the movement queue and stop at current position.
|
|
|
|
|
.SS \f[V]follow_path(path)\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Queue path positions for smooth movement.
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Arguments:\f[R] - \f[V]path\f[R]: List of (x, z) tuples (as
|
|
|
|
|
returned by path_to())
|
|
|
|
|
.SS \f[V]path_to(x, z) or path_to(pos=(x, z)) -> list\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Compute A* path to target position.
|
|
|
|
|
Returns list of (x, z) tuples, or empty list if no path exists.
|
|
|
|
|
.SS \f[V]teleport(x, z) or teleport(pos=(x, z))\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Instantly move to target position without animation.
|
|
|
|
|
.SS \f[V]update_visibility()\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Recompute field of view from current position.
|
|
|
|
|
.SS EntityCollection3D
|
|
|
|
|
.PP
|
|
|
|
|
Collection of Entity3D objects belonging to a Viewport3D.
|
|
|
|
|
.PP
|
|
|
|
|
Supports list-like operations: indexing, iteration, append, remove.
|
|
|
|
|
.PP
|
|
|
|
|
Example: viewport.entities.append(entity) for entity in
|
|
|
|
|
viewport.entities: print(entity.pos)
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Methods:\f[R]
|
|
|
|
|
.SS \f[V]append(entity)\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Add an Entity3D to the collection.
|
|
|
|
|
.SS \f[V]clear()\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Remove all entities from the collection.
|
|
|
|
|
.SS \f[V]extend(iterable)\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Add all Entity3D objects from iterable to the collection.
|
|
|
|
|
.SS \f[V]find(name) -> Entity3D or None\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Find an Entity3D by name.
|
|
|
|
|
Returns None if not found.
|
|
|
|
|
.SS \f[V]pop(index=-1) -> Entity3D\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Remove and return Entity3D at index (default: last).
|
|
|
|
|
.SS \f[V]remove(entity)\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Remove an Entity3D from the collection.
|
|
|
|
|
.SS EntityCollection3DIter
|
|
|
|
|
.PP
|
|
|
|
|
Iterator for EntityCollection3D
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Methods:\f[R]
|
|
|
|
|
.SS FOV
|
|
|
|
|
.PP
|
|
|
|
|
\f[I]Inherits from: IntEnum\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Properties:\f[R] - \f[V]denominator\f[R]: the denominator of a
|
|
|
|
|
rational number in lowest terms - \f[V]imag\f[R]: the imaginary part of
|
|
|
|
|
a complex number - \f[V]numerator\f[R]: the numerator of a rational
|
|
|
|
|
number in lowest terms - \f[V]real\f[R]: the real part of a complex
|
|
|
|
|
number
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Methods:\f[R]
|
|
|
|
|
.SS \f[V]as_integer_ratio(...)\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Return a pair of integers, whose ratio is equal to the original int.
|
|
|
|
|
The ratio is in lowest terms and has a positive denominator.
|
|
|
|
|
>>> (10).as_integer_ratio() (10, 1) >>> (-10).as_integer_ratio() (-10,
|
|
|
|
|
1) >>> (0).as_integer_ratio() (0, 1)
|
|
|
|
|
.SS \f[V]bit_count(...)\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Number of ones in the binary representation of the absolute value of
|
|
|
|
|
self.
|
|
|
|
|
Also known as the population count.
|
|
|
|
|
>>> bin(13) `0b1101' >>> (13).bit_count() 3
|
refactor: Rename click kwarg to on_click for API consistency (closes #126)
BREAKING CHANGE: Constructor keyword argument renamed from `click` to
`on_click` for all UIDrawable types (Frame, Caption, Sprite, Grid, Line,
Circle, Arc).
Before: Frame(pos=(0,0), size=(100,100), click=handler)
After: Frame(pos=(0,0), size=(100,100), on_click=handler)
The property name was already `on_click` - this makes the constructor
kwarg match, completing the callback naming standardization from #139.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-28 14:31:22 -05:00
|
|
|
.SS \f[V]bit_length(...)\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Number of bits necessary to represent self in binary.
|
|
|
|
|
>>> bin(37) `0b100101' >>> (37).bit_length() 6
|
|
|
|
|
.SS \f[V]conjugate(...)\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Returns self, the complex conjugate of any int.
|
|
|
|
|
.SS \f[V]from_bytes(...)\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Return the integer represented by the given array of bytes.
|
|
|
|
|
bytes Holds the array of bytes to convert.
|
|
|
|
|
The argument must either support the buffer protocol or be an iterable
|
|
|
|
|
object producing bytes.
|
|
|
|
|
Bytes and bytearray are examples of built-in objects that support the
|
|
|
|
|
buffer protocol.
|
|
|
|
|
byteorder The byte order used to represent the integer.
|
|
|
|
|
If byteorder is `big', the most significant byte is at the beginning of
|
|
|
|
|
the byte array.
|
|
|
|
|
If byteorder is `little', the most significant byte is at the end of the
|
|
|
|
|
byte array.
|
|
|
|
|
To request the native byte order of the host system, use sys.byteorder
|
|
|
|
|
as the byte order value.
|
|
|
|
|
Default is to use `big'.
|
|
|
|
|
signed Indicates whether two\[cq]s complement is used to represent the
|
|
|
|
|
integer.
|
|
|
|
|
.SS \f[V]is_integer(...)\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Returns True.
|
|
|
|
|
Exists for duck type compatibility with float.is_integer.
|
|
|
|
|
.SS \f[V]to_bytes(...)\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Return an array of bytes representing an integer.
|
|
|
|
|
length Length of bytes object to use.
|
|
|
|
|
An OverflowError is raised if the integer is not representable with the
|
|
|
|
|
given number of bytes.
|
|
|
|
|
Default is length 1.
|
|
|
|
|
byteorder The byte order used to represent the integer.
|
|
|
|
|
If byteorder is `big', the most significant byte is at the beginning of
|
|
|
|
|
the byte array.
|
|
|
|
|
If byteorder is `little', the most significant byte is at the end of the
|
|
|
|
|
byte array.
|
|
|
|
|
To request the native byte order of the host system, use sys.byteorder
|
|
|
|
|
as the byte order value.
|
|
|
|
|
Default is to use `big'.
|
|
|
|
|
signed Determines whether two\[cq]s complement is used to represent the
|
|
|
|
|
integer.
|
|
|
|
|
If signed is False and a negative integer is given, an OverflowError is
|
|
|
|
|
raised.
|
2025-10-30 21:20:50 -04:00
|
|
|
.SS Font
|
|
|
|
|
.PP
|
Replace UIEntity gridstate with DiscreteMap perspective_map; closes #294
Per-entity FOV memory moves from std::vector<UIGridPointState> (two-bool
visible/discovered pairs) to a 3-state DiscreteMap (0=UNKNOWN, 1=DISCOVERED,
2=VISIBLE), exposed as entity.perspective_map. The invariant
visible-subset-of-discovered becomes structural (single value per cell), and
the map is a live, serializable, first-class object rather than an implicit
internal array.
Changes:
- New DiscreteMap C++ class with shared ownership; PyDiscreteMapObject now
holds shared_ptr<DiscreteMap>. UIEntity holds the same shared_ptr.
- New mcrfpy.Perspective IntEnum (UNKNOWN/DISCOVERED/VISIBLE), modelled on
PyInputState.
- entity.perspective_map: lazy-allocated on first access with a grid;
setter validates size against grid and raises ValueError on mismatch;
None clears (next access lazy-reallocates fresh).
- updateVisibility() now demotes 2->1 then promotes visible cells to 2.
- entity.at(x, y) returns grid.at(x, y) when VISIBLE, else None.
- Fog-of-war rendering in UIGridView and UIGrid reads the 3-state map.
- Removed: UIEntity::gridstate, ensureGridstate(), entity.gridstate getter,
UIGridPointState struct + PyUIGridPointStateType.
- Obsolete tests deleted (test_gridpointstate_point,
issue_265_gridpointstate_dangle); 4 new tests cover lazy allocation,
identity, serialization round-trip, size validation, and the
visible-subset-of-discovered invariant.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-17 23:04:27 -04:00
|
|
|
Font(filename: str)
|
|
|
|
|
.PP
|
|
|
|
|
A font resource for rendering text in Caption elements.
|
|
|
|
|
.PP
|
|
|
|
|
Args: filename: Path to a TrueType (.ttf) or OpenType (.otf) font file.
|
|
|
|
|
.PP
|
|
|
|
|
Properties: family (str, read-only): Font family name from metadata.
|
|
|
|
|
source (str, read-only): File path used to load this font.
|
2025-10-30 21:20:50 -04:00
|
|
|
.PP
|
2026-01-23 20:49:11 -05:00
|
|
|
\f[B]Properties:\f[R] - \f[V]family\f[R] \f[I](read-only)\f[R]: Font
|
|
|
|
|
family name (str, read-only).
|
|
|
|
|
Retrieved from font metadata.
|
|
|
|
|
- \f[V]source\f[R] \f[I](read-only)\f[R]: Source filename path (str,
|
|
|
|
|
read-only).
|
|
|
|
|
The path used to load this font.
|
|
|
|
|
.PP
|
2025-10-30 21:20:50 -04:00
|
|
|
\f[B]Methods:\f[R]
|
|
|
|
|
.SS Frame
|
|
|
|
|
.PP
|
|
|
|
|
\f[I]Inherits from: Drawable\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Frame(pos=None, size=None, **kwargs)
|
|
|
|
|
.PP
|
|
|
|
|
A rectangular frame UI element that can contain other drawable elements.
|
|
|
|
|
.PP
|
|
|
|
|
Args: pos (tuple, optional): Position as (x, y) tuple.
|
|
|
|
|
Default: (0, 0) size (tuple, optional): Size as (width, height) tuple.
|
|
|
|
|
Default: (0, 0)
|
|
|
|
|
.PP
|
|
|
|
|
Keyword Args: fill_color (Color): Background fill color.
|
|
|
|
|
Default: (0, 0, 0, 128) outline_color (Color): Border outline color.
|
|
|
|
|
Default: (255, 255, 255, 255) outline (float): Border outline thickness.
|
|
|
|
|
Default: 0 click (callable): Click event handler.
|
|
|
|
|
Default: None children (list): Initial list of child drawable elements.
|
|
|
|
|
Default: None visible (bool): Visibility state.
|
|
|
|
|
Default: True opacity (float): Opacity (0.0-1.0).
|
|
|
|
|
Default: 1.0 z_index (int): Rendering order.
|
|
|
|
|
Default: 0 name (str): Element name for finding.
|
|
|
|
|
Default: None x (float): X position override.
|
|
|
|
|
Default: 0 y (float): Y position override.
|
|
|
|
|
Default: 0 w (float): Width override.
|
|
|
|
|
Default: 0 h (float): Height override.
|
|
|
|
|
Default: 0 clip_children (bool): Whether to clip children to frame
|
|
|
|
|
bounds.
|
2025-12-02 09:21:43 -05:00
|
|
|
Default: False cache_subtree (bool): Cache rendering to texture for
|
|
|
|
|
performance.
|
2026-01-23 20:49:11 -05:00
|
|
|
Default: False align (Alignment): Alignment relative to parent.
|
|
|
|
|
Default: None (manual positioning) margin (float): Margin from parent
|
|
|
|
|
edge when aligned.
|
|
|
|
|
Default: 0 horiz_margin (float): Horizontal margin override.
|
|
|
|
|
Default: 0 (use margin) vert_margin (float): Vertical margin override.
|
|
|
|
|
Default: 0 (use margin)
|
2025-10-30 21:20:50 -04:00
|
|
|
.PP
|
|
|
|
|
Attributes: x, y (float): Position in pixels w, h (float): Size in
|
|
|
|
|
pixels pos (Vector): Position as a Vector object fill_color,
|
|
|
|
|
outline_color (Color): Visual appearance outline (float): Border
|
|
|
|
|
thickness click (callable): Click event handler children (list):
|
|
|
|
|
Collection of child drawable elements visible (bool): Visibility state
|
|
|
|
|
opacity (float): Opacity value z_index (int): Rendering order name
|
|
|
|
|
(str): Element name clip_children (bool): Whether to clip children to
|
2025-12-02 09:21:43 -05:00
|
|
|
frame bounds cache_subtree (bool): Cache subtree rendering to texture
|
2026-01-23 20:49:11 -05:00
|
|
|
align (Alignment): Alignment relative to parent (or None) margin
|
|
|
|
|
(float): General margin for alignment horiz_margin (float): Horizontal
|
|
|
|
|
margin override vert_margin (float): Vertical margin override
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Properties:\f[R] - \f[V]align\f[R]: Alignment relative to parent
|
|
|
|
|
bounds (Alignment enum or None).
|
|
|
|
|
When set, position is automatically calculated when parent is assigned
|
|
|
|
|
or resized.
|
|
|
|
|
Set to None to disable alignment and use manual positioning.
|
F15: correct docstring accuracy from adversarial verify pass (#314)
Follow-up to the macro conversion: an adversarial verify pass (one agent per
file vs. the C++ implementation + stubs) found 62 content issues; the real
ones are fixed here.
Callbacks (centralized):
- on_click: receives (pos, MouseButton, InputState), not str (8 files).
- on_enter/on_exit/on_move (UIBase.h): hover passes only (pos) -- removed the
fictional button/action args.
- bounds/global_bounds (UIBase.h): mark (tuple, read-only).
Signatures / types:
- Grid.find_path: document heuristic + weight; get_dijkstra_map: document roots;
compute_fov: FOV | int = FOV.BASIC (not the C constant FOV_BASIC) + Returns;
at/is_in_fov: document (pos) and (x, y) call forms.
- get_metrics: document all 16 returned dict keys (was 8); bresenham: drop the
bogus '*' keyword-only separator.
- Nullable defaults typed correctly: BSP seed/size, ColorLayer draw_fov/
apply_perspective Color|None, Entity.visible_entities radius int=-1 (None is
rejected by the 'i' parser -> see #319).
- Type-token fixes: GridView.center -> Vector; GridView.texture -> (None,
read-only) (unimplemented, #318); GridPoint.grid_pos -> (tuple, read-only);
EntityCollection.find -> Entity | list[Entity] | None; extend RuntimeError;
UniformCollection.values -> list[float | tuple | None].
- automation: onScreen (x, y) form documented; scroll notes x is ignored (#317).
Also: correct stale AStarPath/DijkstraMap signatures in docs/api-audit-2026-04.md
(the bindings were right, the audit table was outdated). Rebaseline the API
snapshot golden and regenerate docs/stubs.
Code-level bugs surfaced by the pass are filed as #317, #318, #319.
Refs #314, #317, #318, #319
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 06:43:47 -04:00
|
|
|
- \f[V]bounds\f[R] \f[I](read-only)\f[R]: Axis-aligned bounding box
|
|
|
|
|
(tuple, read-only) as a (pos, size) pair of Vectors: (Vector(x, y),
|
|
|
|
|
Vector(width, height)).
|
F15: convert frozen binding docstrings to MCRF_* macros (#314)
Convert 289 raw PyMethodDef/PyGetSetDef docstring slots to MCRF_METHOD /
MCRF_PROPERTY across the 20 frozen (non-3D) binding files, bringing the
frozen surface to 100% macro compliance (check_frozen_docstrings.sh PASS).
Done via a one-agent-per-file workflow gated by validate_file_docstrings.sh
and per-wave build/doc-rebuild checks.
- Adds #include "McRFPy_Doc.h" where missing; fills the lone genuine doc
gap (UIGrid.at, which was MISSING a doc field in two arrays).
- McRFPy_Doc.h: comment documenting the MCRF_METHOD_DOC comma rule (the
trap that broke the GridLayers conversion mid-run).
- Rebaseline api_surface golden: property types now resolve to real types
instead of "Any" (e.g. grid_pos: Vector, on_cell_click: Callable | None),
and 11 properties correctly flip rw->ro now that their docstrings carry
"read-only" (collections, grid_size, hovered_cell, texture, view — all
verified against NULL setter slots).
- Regenerate docs/stubs/man page from the new docstrings.
Module-level functions use MCRF_METHOD(<name>, ...) (expands identically to
the intended MCRF_FUNCTION; the audit's compliance set is METHOD/PROPERTY).
Experimental 3D/Voxel bindings (src/3d/) remain exempt from the freeze.
Pre-existing failures unrelated to this change: test_animation_*,
test_constructor_comprehensive (reference the removed mcrfpy.Animation and
old constructor arity).
Refs #314
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 01:20:55 -04:00
|
|
|
- \f[V]cache_subtree\f[R]: Cache the frame and all children to a render
|
|
|
|
|
texture for performance (bool).
|
|
|
|
|
Useful for complex static subtrees.
|
|
|
|
|
- \f[V]children\f[R] \f[I](read-only)\f[R]: UICollection of child
|
|
|
|
|
drawable objects rendered on top of this frame (UICollection,
|
|
|
|
|
read-only).
|
|
|
|
|
- \f[V]clip_children\f[R]: Whether to clip child elements to the
|
|
|
|
|
frame\[cq]s bounds (bool).
|
|
|
|
|
Enables render-texture mode when True.
|
|
|
|
|
- \f[V]fill_color\f[R]: Fill color of the rectangle (Color).
|
2026-01-23 20:49:11 -05:00
|
|
|
Returns a copy; modifying components requires reassignment.
|
|
|
|
|
For animation, use `fill_color.r', `fill_color.g', etc.
|
F15: correct docstring accuracy from adversarial verify pass (#314)
Follow-up to the macro conversion: an adversarial verify pass (one agent per
file vs. the C++ implementation + stubs) found 62 content issues; the real
ones are fixed here.
Callbacks (centralized):
- on_click: receives (pos, MouseButton, InputState), not str (8 files).
- on_enter/on_exit/on_move (UIBase.h): hover passes only (pos) -- removed the
fictional button/action args.
- bounds/global_bounds (UIBase.h): mark (tuple, read-only).
Signatures / types:
- Grid.find_path: document heuristic + weight; get_dijkstra_map: document roots;
compute_fov: FOV | int = FOV.BASIC (not the C constant FOV_BASIC) + Returns;
at/is_in_fov: document (pos) and (x, y) call forms.
- get_metrics: document all 16 returned dict keys (was 8); bresenham: drop the
bogus '*' keyword-only separator.
- Nullable defaults typed correctly: BSP seed/size, ColorLayer draw_fov/
apply_perspective Color|None, Entity.visible_entities radius int=-1 (None is
rejected by the 'i' parser -> see #319).
- Type-token fixes: GridView.center -> Vector; GridView.texture -> (None,
read-only) (unimplemented, #318); GridPoint.grid_pos -> (tuple, read-only);
EntityCollection.find -> Entity | list[Entity] | None; extend RuntimeError;
UniformCollection.values -> list[float | tuple | None].
- automation: onScreen (x, y) form documented; scroll notes x is ignored (#317).
Also: correct stale AStarPath/DijkstraMap signatures in docs/api-audit-2026-04.md
(the bindings were right, the audit table was outdated). Rebaseline the API
snapshot golden and regenerate docs/stubs.
Code-level bugs surfaced by the pass are filed as #317, #318, #319.
Refs #314, #317, #318, #319
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 06:43:47 -04:00
|
|
|
- \f[V]global_bounds\f[R] \f[I](read-only)\f[R]: Axis-aligned bounding
|
|
|
|
|
box in screen coordinates (tuple, read-only) as a (pos, size) pair of
|
|
|
|
|
Vectors: (Vector(x, y), Vector(width, height)).
|
2026-01-23 20:49:11 -05:00
|
|
|
- \f[V]global_position\f[R] \f[I](read-only)\f[R]: Global screen
|
|
|
|
|
position (read-only).
|
|
|
|
|
Calculates absolute position by walking up the parent chain.
|
F15: convert frozen binding docstrings to MCRF_* macros (#314)
Convert 289 raw PyMethodDef/PyGetSetDef docstring slots to MCRF_METHOD /
MCRF_PROPERTY across the 20 frozen (non-3D) binding files, bringing the
frozen surface to 100% macro compliance (check_frozen_docstrings.sh PASS).
Done via a one-agent-per-file workflow gated by validate_file_docstrings.sh
and per-wave build/doc-rebuild checks.
- Adds #include "McRFPy_Doc.h" where missing; fills the lone genuine doc
gap (UIGrid.at, which was MISSING a doc field in two arrays).
- McRFPy_Doc.h: comment documenting the MCRF_METHOD_DOC comma rule (the
trap that broke the GridLayers conversion mid-run).
- Rebaseline api_surface golden: property types now resolve to real types
instead of "Any" (e.g. grid_pos: Vector, on_cell_click: Callable | None),
and 11 properties correctly flip rw->ro now that their docstrings carry
"read-only" (collections, grid_size, hovered_cell, texture, view — all
verified against NULL setter slots).
- Regenerate docs/stubs/man page from the new docstrings.
Module-level functions use MCRF_METHOD(<name>, ...) (expands identically to
the intended MCRF_FUNCTION; the audit's compliance set is METHOD/PROPERTY).
Experimental 3D/Voxel bindings (src/3d/) remain exempt from the freeze.
Pre-existing failures unrelated to this change: test_animation_*,
test_constructor_comprehensive (reference the removed mcrfpy.Animation and
old constructor arity).
Refs #314
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 01:20:55 -04:00
|
|
|
- \f[V]grid_pos\f[R]: Position in grid tile coordinates (Vector).
|
|
|
|
|
Only meaningful when this element\[cq]s parent is a Grid.
|
|
|
|
|
- \f[V]grid_size\f[R]: Size in grid tile coordinates (Vector).
|
|
|
|
|
Only meaningful when this element\[cq]s parent is a Grid.
|
|
|
|
|
- \f[V]h\f[R]: Height of the rectangle (float).
|
|
|
|
|
- \f[V]horiz_margin\f[R]: Horizontal margin override (float, 0 = use
|
2026-01-23 20:49:11 -05:00
|
|
|
general margin).
|
|
|
|
|
Invalid for vertically-centered alignments (TOP_CENTER, BOTTOM_CENTER,
|
|
|
|
|
CENTER).
|
|
|
|
|
- \f[V]hovered\f[R] \f[I](read-only)\f[R]: Whether mouse is currently
|
|
|
|
|
over this element (read-only).
|
|
|
|
|
Updated automatically by the engine during mouse movement.
|
|
|
|
|
- \f[V]margin\f[R]: General margin from edge when aligned (float).
|
|
|
|
|
Applied to both horizontal and vertical edges unless overridden.
|
|
|
|
|
Invalid for CENTER alignment (raises ValueError).
|
F15: convert frozen binding docstrings to MCRF_* macros (#314)
Convert 289 raw PyMethodDef/PyGetSetDef docstring slots to MCRF_METHOD /
MCRF_PROPERTY across the 20 frozen (non-3D) binding files, bringing the
frozen surface to 100% macro compliance (check_frozen_docstrings.sh PASS).
Done via a one-agent-per-file workflow gated by validate_file_docstrings.sh
and per-wave build/doc-rebuild checks.
- Adds #include "McRFPy_Doc.h" where missing; fills the lone genuine doc
gap (UIGrid.at, which was MISSING a doc field in two arrays).
- McRFPy_Doc.h: comment documenting the MCRF_METHOD_DOC comma rule (the
trap that broke the GridLayers conversion mid-run).
- Rebaseline api_surface golden: property types now resolve to real types
instead of "Any" (e.g. grid_pos: Vector, on_cell_click: Callable | None),
and 11 properties correctly flip rw->ro now that their docstrings carry
"read-only" (collections, grid_size, hovered_cell, texture, view — all
verified against NULL setter slots).
- Regenerate docs/stubs/man page from the new docstrings.
Module-level functions use MCRF_METHOD(<name>, ...) (expands identically to
the intended MCRF_FUNCTION; the audit's compliance set is METHOD/PROPERTY).
Experimental 3D/Voxel bindings (src/3d/) remain exempt from the freeze.
Pre-existing failures unrelated to this change: test_animation_*,
test_constructor_comprehensive (reference the removed mcrfpy.Animation and
old constructor arity).
Refs #314
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 01:20:55 -04:00
|
|
|
- \f[V]name\f[R]: Name for finding elements (str).
|
|
|
|
|
- \f[V]on_click\f[R]: Callable executed when object is clicked.
|
F15: correct docstring accuracy from adversarial verify pass (#314)
Follow-up to the macro conversion: an adversarial verify pass (one agent per
file vs. the C++ implementation + stubs) found 62 content issues; the real
ones are fixed here.
Callbacks (centralized):
- on_click: receives (pos, MouseButton, InputState), not str (8 files).
- on_enter/on_exit/on_move (UIBase.h): hover passes only (pos) -- removed the
fictional button/action args.
- bounds/global_bounds (UIBase.h): mark (tuple, read-only).
Signatures / types:
- Grid.find_path: document heuristic + weight; get_dijkstra_map: document roots;
compute_fov: FOV | int = FOV.BASIC (not the C constant FOV_BASIC) + Returns;
at/is_in_fov: document (pos) and (x, y) call forms.
- get_metrics: document all 16 returned dict keys (was 8); bresenham: drop the
bogus '*' keyword-only separator.
- Nullable defaults typed correctly: BSP seed/size, ColorLayer draw_fov/
apply_perspective Color|None, Entity.visible_entities radius int=-1 (None is
rejected by the 'i' parser -> see #319).
- Type-token fixes: GridView.center -> Vector; GridView.texture -> (None,
read-only) (unimplemented, #318); GridPoint.grid_pos -> (tuple, read-only);
EntityCollection.find -> Entity | list[Entity] | None; extend RuntimeError;
UniformCollection.values -> list[float | tuple | None].
- automation: onScreen (x, y) form documented; scroll notes x is ignored (#317).
Also: correct stale AStarPath/DijkstraMap signatures in docs/api-audit-2026-04.md
(the bindings were right, the audit table was outdated). Rebaseline the API
snapshot golden and regenerate docs/stubs.
Code-level bugs surfaced by the pass are filed as #317, #318, #319.
Refs #314, #317, #318, #319
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 06:43:47 -04:00
|
|
|
Function receives (pos: Vector, button: MouseButton, action:
|
|
|
|
|
InputState).
|
2026-01-23 20:49:11 -05:00
|
|
|
- \f[V]on_enter\f[R]: Callback for mouse enter events.
|
F15: correct docstring accuracy from adversarial verify pass (#314)
Follow-up to the macro conversion: an adversarial verify pass (one agent per
file vs. the C++ implementation + stubs) found 62 content issues; the real
ones are fixed here.
Callbacks (centralized):
- on_click: receives (pos, MouseButton, InputState), not str (8 files).
- on_enter/on_exit/on_move (UIBase.h): hover passes only (pos) -- removed the
fictional button/action args.
- bounds/global_bounds (UIBase.h): mark (tuple, read-only).
Signatures / types:
- Grid.find_path: document heuristic + weight; get_dijkstra_map: document roots;
compute_fov: FOV | int = FOV.BASIC (not the C constant FOV_BASIC) + Returns;
at/is_in_fov: document (pos) and (x, y) call forms.
- get_metrics: document all 16 returned dict keys (was 8); bresenham: drop the
bogus '*' keyword-only separator.
- Nullable defaults typed correctly: BSP seed/size, ColorLayer draw_fov/
apply_perspective Color|None, Entity.visible_entities radius int=-1 (None is
rejected by the 'i' parser -> see #319).
- Type-token fixes: GridView.center -> Vector; GridView.texture -> (None,
read-only) (unimplemented, #318); GridPoint.grid_pos -> (tuple, read-only);
EntityCollection.find -> Entity | list[Entity] | None; extend RuntimeError;
UniformCollection.values -> list[float | tuple | None].
- automation: onScreen (x, y) form documented; scroll notes x is ignored (#317).
Also: correct stale AStarPath/DijkstraMap signatures in docs/api-audit-2026-04.md
(the bindings were right, the audit table was outdated). Rebaseline the API
snapshot golden and regenerate docs/stubs.
Code-level bugs surfaced by the pass are filed as #317, #318, #319.
Refs #314, #317, #318, #319
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 06:43:47 -04:00
|
|
|
Called with (pos: Vector) when mouse enters this element\[cq]s bounds.
|
2026-01-23 20:49:11 -05:00
|
|
|
- \f[V]on_exit\f[R]: Callback for mouse exit events.
|
F15: correct docstring accuracy from adversarial verify pass (#314)
Follow-up to the macro conversion: an adversarial verify pass (one agent per
file vs. the C++ implementation + stubs) found 62 content issues; the real
ones are fixed here.
Callbacks (centralized):
- on_click: receives (pos, MouseButton, InputState), not str (8 files).
- on_enter/on_exit/on_move (UIBase.h): hover passes only (pos) -- removed the
fictional button/action args.
- bounds/global_bounds (UIBase.h): mark (tuple, read-only).
Signatures / types:
- Grid.find_path: document heuristic + weight; get_dijkstra_map: document roots;
compute_fov: FOV | int = FOV.BASIC (not the C constant FOV_BASIC) + Returns;
at/is_in_fov: document (pos) and (x, y) call forms.
- get_metrics: document all 16 returned dict keys (was 8); bresenham: drop the
bogus '*' keyword-only separator.
- Nullable defaults typed correctly: BSP seed/size, ColorLayer draw_fov/
apply_perspective Color|None, Entity.visible_entities radius int=-1 (None is
rejected by the 'i' parser -> see #319).
- Type-token fixes: GridView.center -> Vector; GridView.texture -> (None,
read-only) (unimplemented, #318); GridPoint.grid_pos -> (tuple, read-only);
EntityCollection.find -> Entity | list[Entity] | None; extend RuntimeError;
UniformCollection.values -> list[float | tuple | None].
- automation: onScreen (x, y) form documented; scroll notes x is ignored (#317).
Also: correct stale AStarPath/DijkstraMap signatures in docs/api-audit-2026-04.md
(the bindings were right, the audit table was outdated). Rebaseline the API
snapshot golden and regenerate docs/stubs.
Code-level bugs surfaced by the pass are filed as #317, #318, #319.
Refs #314, #317, #318, #319
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 06:43:47 -04:00
|
|
|
Called with (pos: Vector) when mouse leaves this element\[cq]s bounds.
|
2026-01-23 20:49:11 -05:00
|
|
|
- \f[V]on_move\f[R]: Callback for mouse movement within bounds.
|
F15: correct docstring accuracy from adversarial verify pass (#314)
Follow-up to the macro conversion: an adversarial verify pass (one agent per
file vs. the C++ implementation + stubs) found 62 content issues; the real
ones are fixed here.
Callbacks (centralized):
- on_click: receives (pos, MouseButton, InputState), not str (8 files).
- on_enter/on_exit/on_move (UIBase.h): hover passes only (pos) -- removed the
fictional button/action args.
- bounds/global_bounds (UIBase.h): mark (tuple, read-only).
Signatures / types:
- Grid.find_path: document heuristic + weight; get_dijkstra_map: document roots;
compute_fov: FOV | int = FOV.BASIC (not the C constant FOV_BASIC) + Returns;
at/is_in_fov: document (pos) and (x, y) call forms.
- get_metrics: document all 16 returned dict keys (was 8); bresenham: drop the
bogus '*' keyword-only separator.
- Nullable defaults typed correctly: BSP seed/size, ColorLayer draw_fov/
apply_perspective Color|None, Entity.visible_entities radius int=-1 (None is
rejected by the 'i' parser -> see #319).
- Type-token fixes: GridView.center -> Vector; GridView.texture -> (None,
read-only) (unimplemented, #318); GridPoint.grid_pos -> (tuple, read-only);
EntityCollection.find -> Entity | list[Entity] | None; extend RuntimeError;
UniformCollection.values -> list[float | tuple | None].
- automation: onScreen (x, y) form documented; scroll notes x is ignored (#317).
Also: correct stale AStarPath/DijkstraMap signatures in docs/api-audit-2026-04.md
(the bindings were right, the audit table was outdated). Rebaseline the API
snapshot golden and regenerate docs/stubs.
Code-level bugs surfaced by the pass are filed as #317, #318, #319.
Refs #314, #317, #318, #319
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 06:43:47 -04:00
|
|
|
Called with (pos: Vector) for each mouse movement while inside.
|
2026-01-23 20:49:11 -05:00
|
|
|
Performance note: Called frequently during movement - keep handlers
|
|
|
|
|
fast.
|
|
|
|
|
- \f[V]opacity\f[R]: Opacity level (0.0 = transparent, 1.0 = opaque).
|
|
|
|
|
Automatically clamped to valid range [0.0, 1.0].
|
Update documentation for API changes #229, #230, #184
CLAUDE.md updates:
- Fix Python version 3.12 -> 3.14
- Update keypressScene -> scene.on_key pattern
- Add API examples for new callback signatures
- Document animation callbacks (target, prop, value)
- Document hover callbacks (position-only)
- Document enum types (Key, MouseButton, InputState)
stubs/mcrfpy.pyi updates:
- Add Key, MouseButton, InputState, Easing enum classes
- Fix Drawable hover callback signatures per #230
- Fix Grid cell callback signatures per #230
- Fix Scene.on_key signature to use enums per #184
- Update Animation class with correct callback signature per #229
- Add deprecation notes to keypressScene, setTimer, delTimer
Regenerated docs:
- API_REFERENCE_DYNAMIC.md
- api_reference_dynamic.html
- mcrfpy.3 man page
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-28 19:20:04 -05:00
|
|
|
- \f[V]origin\f[R]: Transform origin as Vector (pivot point for
|
|
|
|
|
rotation).
|
|
|
|
|
Default (0,0) is top-left; set to (w/2, h/2) to rotate around center.
|
F15: convert frozen binding docstrings to MCRF_* macros (#314)
Convert 289 raw PyMethodDef/PyGetSetDef docstring slots to MCRF_METHOD /
MCRF_PROPERTY across the 20 frozen (non-3D) binding files, bringing the
frozen surface to 100% macro compliance (check_frozen_docstrings.sh PASS).
Done via a one-agent-per-file workflow gated by validate_file_docstrings.sh
and per-wave build/doc-rebuild checks.
- Adds #include "McRFPy_Doc.h" where missing; fills the lone genuine doc
gap (UIGrid.at, which was MISSING a doc field in two arrays).
- McRFPy_Doc.h: comment documenting the MCRF_METHOD_DOC comma rule (the
trap that broke the GridLayers conversion mid-run).
- Rebaseline api_surface golden: property types now resolve to real types
instead of "Any" (e.g. grid_pos: Vector, on_cell_click: Callable | None),
and 11 properties correctly flip rw->ro now that their docstrings carry
"read-only" (collections, grid_size, hovered_cell, texture, view — all
verified against NULL setter slots).
- Regenerate docs/stubs/man page from the new docstrings.
Module-level functions use MCRF_METHOD(<name>, ...) (expands identically to
the intended MCRF_FUNCTION; the audit's compliance set is METHOD/PROPERTY).
Experimental 3D/Voxel bindings (src/3d/) remain exempt from the freeze.
Pre-existing failures unrelated to this change: test_animation_*,
test_constructor_comprehensive (reference the removed mcrfpy.Animation and
old constructor arity).
Refs #314
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 01:20:55 -04:00
|
|
|
- \f[V]outline\f[R]: Thickness of the border in pixels (float).
|
|
|
|
|
- \f[V]outline_color\f[R]: Outline color of the rectangle (Color).
|
2026-01-23 20:49:11 -05:00
|
|
|
Returns a copy; modifying components requires reassignment.
|
|
|
|
|
For animation, use `outline_color.r', `outline_color.g', etc.
|
|
|
|
|
- \f[V]parent\f[R]: Parent drawable.
|
|
|
|
|
Get: Returns the parent Frame/Grid if nested, or None if at scene level.
|
|
|
|
|
Set: Assign a Frame/Grid to reparent, or None to remove from parent.
|
F15: convert frozen binding docstrings to MCRF_* macros (#314)
Convert 289 raw PyMethodDef/PyGetSetDef docstring slots to MCRF_METHOD /
MCRF_PROPERTY across the 20 frozen (non-3D) binding files, bringing the
frozen surface to 100% macro compliance (check_frozen_docstrings.sh PASS).
Done via a one-agent-per-file workflow gated by validate_file_docstrings.sh
and per-wave build/doc-rebuild checks.
- Adds #include "McRFPy_Doc.h" where missing; fills the lone genuine doc
gap (UIGrid.at, which was MISSING a doc field in two arrays).
- McRFPy_Doc.h: comment documenting the MCRF_METHOD_DOC comma rule (the
trap that broke the GridLayers conversion mid-run).
- Rebaseline api_surface golden: property types now resolve to real types
instead of "Any" (e.g. grid_pos: Vector, on_cell_click: Callable | None),
and 11 properties correctly flip rw->ro now that their docstrings carry
"read-only" (collections, grid_size, hovered_cell, texture, view — all
verified against NULL setter slots).
- Regenerate docs/stubs/man page from the new docstrings.
Module-level functions use MCRF_METHOD(<name>, ...) (expands identically to
the intended MCRF_FUNCTION; the audit's compliance set is METHOD/PROPERTY).
Experimental 3D/Voxel bindings (src/3d/) remain exempt from the freeze.
Pre-existing failures unrelated to this change: test_animation_*,
test_constructor_comprehensive (reference the removed mcrfpy.Animation and
old constructor arity).
Refs #314
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 01:20:55 -04:00
|
|
|
- \f[V]pos\f[R]: Position as a Vector (Vector).
|
|
|
|
|
- \f[V]rotate_with_camera\f[R]: Whether to rotate visually with parent
|
|
|
|
|
Grid\[cq]s camera_rotation (bool).
|
Update documentation for API changes #229, #230, #184
CLAUDE.md updates:
- Fix Python version 3.12 -> 3.14
- Update keypressScene -> scene.on_key pattern
- Add API examples for new callback signatures
- Document animation callbacks (target, prop, value)
- Document hover callbacks (position-only)
- Document enum types (Key, MouseButton, InputState)
stubs/mcrfpy.pyi updates:
- Add Key, MouseButton, InputState, Easing enum classes
- Fix Drawable hover callback signatures per #230
- Fix Grid cell callback signatures per #230
- Fix Scene.on_key signature to use enums per #184
- Update Animation class with correct callback signature per #229
- Add deprecation notes to keypressScene, setTimer, delTimer
Regenerated docs:
- API_REFERENCE_DYNAMIC.md
- api_reference_dynamic.html
- mcrfpy.3 man page
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-28 19:20:04 -05:00
|
|
|
False (default): stay screen-aligned.
|
|
|
|
|
True: tilt with camera.
|
|
|
|
|
Only affects children of UIGrid; ignored for other parents.
|
|
|
|
|
- \f[V]rotation\f[R]: Rotation angle in degrees (clockwise around
|
|
|
|
|
origin).
|
|
|
|
|
Animatable property.
|
|
|
|
|
- \f[V]shader\f[R]: Shader for GPU visual effects (Shader or None).
|
|
|
|
|
When set, the drawable is rendered through the shader program.
|
|
|
|
|
Set to None to disable shader effects.
|
|
|
|
|
- \f[V]uniforms\f[R] \f[I](read-only)\f[R]: Collection of shader
|
|
|
|
|
uniforms (read-only access to collection).
|
|
|
|
|
Set uniforms via dict-like syntax: drawable.uniforms[`name'] = value.
|
|
|
|
|
Supports float, vec2/3/4 tuples, PropertyBinding, and CallableBinding.
|
|
|
|
|
- \f[V]vert_margin\f[R]: Vertical margin override (float, 0 = use
|
|
|
|
|
general margin).
|
2026-01-23 20:49:11 -05:00
|
|
|
Invalid for horizontally-centered alignments (CENTER_LEFT, CENTER_RIGHT,
|
|
|
|
|
CENTER).
|
|
|
|
|
- \f[V]visible\f[R]: Whether the object is visible (bool).
|
|
|
|
|
Invisible objects are not rendered or clickable.
|
F15: convert frozen binding docstrings to MCRF_* macros (#314)
Convert 289 raw PyMethodDef/PyGetSetDef docstring slots to MCRF_METHOD /
MCRF_PROPERTY across the 20 frozen (non-3D) binding files, bringing the
frozen surface to 100% macro compliance (check_frozen_docstrings.sh PASS).
Done via a one-agent-per-file workflow gated by validate_file_docstrings.sh
and per-wave build/doc-rebuild checks.
- Adds #include "McRFPy_Doc.h" where missing; fills the lone genuine doc
gap (UIGrid.at, which was MISSING a doc field in two arrays).
- McRFPy_Doc.h: comment documenting the MCRF_METHOD_DOC comma rule (the
trap that broke the GridLayers conversion mid-run).
- Rebaseline api_surface golden: property types now resolve to real types
instead of "Any" (e.g. grid_pos: Vector, on_cell_click: Callable | None),
and 11 properties correctly flip rw->ro now that their docstrings carry
"read-only" (collections, grid_size, hovered_cell, texture, view — all
verified against NULL setter slots).
- Regenerate docs/stubs/man page from the new docstrings.
Module-level functions use MCRF_METHOD(<name>, ...) (expands identically to
the intended MCRF_FUNCTION; the audit's compliance set is METHOD/PROPERTY).
Experimental 3D/Voxel bindings (src/3d/) remain exempt from the freeze.
Pre-existing failures unrelated to this change: test_animation_*,
test_constructor_comprehensive (reference the removed mcrfpy.Animation and
old constructor arity).
Refs #314
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 01:20:55 -04:00
|
|
|
- \f[V]w\f[R]: Width of the rectangle (float).
|
|
|
|
|
- \f[V]x\f[R]: X coordinate of the top-left corner (float).
|
|
|
|
|
- \f[V]y\f[R]: Y coordinate of the top-left corner (float).
|
|
|
|
|
- \f[V]z_index\f[R]: Z-order for rendering (lower values rendered
|
|
|
|
|
first).
|
2026-01-23 20:49:11 -05:00
|
|
|
Automatically triggers scene resort when changed.
|
2025-10-30 21:20:50 -04:00
|
|
|
.PP
|
|
|
|
|
\f[B]Methods:\f[R]
|
Replace UIEntity gridstate with DiscreteMap perspective_map; closes #294
Per-entity FOV memory moves from std::vector<UIGridPointState> (two-bool
visible/discovered pairs) to a 3-state DiscreteMap (0=UNKNOWN, 1=DISCOVERED,
2=VISIBLE), exposed as entity.perspective_map. The invariant
visible-subset-of-discovered becomes structural (single value per cell), and
the map is a live, serializable, first-class object rather than an implicit
internal array.
Changes:
- New DiscreteMap C++ class with shared ownership; PyDiscreteMapObject now
holds shared_ptr<DiscreteMap>. UIEntity holds the same shared_ptr.
- New mcrfpy.Perspective IntEnum (UNKNOWN/DISCOVERED/VISIBLE), modelled on
PyInputState.
- entity.perspective_map: lazy-allocated on first access with a grid;
setter validates size against grid and raises ValueError on mismatch;
None clears (next access lazy-reallocates fresh).
- updateVisibility() now demotes 2->1 then promotes visible cells to 2.
- entity.at(x, y) returns grid.at(x, y) when VISIBLE, else None.
- Fog-of-war rendering in UIGridView and UIGrid reads the 3-state map.
- Removed: UIEntity::gridstate, ensureGridstate(), entity.gridstate getter,
UIGridPointState struct + PyUIGridPointStateType.
- Obsolete tests deleted (test_gridpointstate_point,
issue_265_gridpointstate_dangle); 4 new tests cover lazy allocation,
identity, serialization round-trip, size validation, and the
visible-subset-of-discovered invariant.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-17 23:04:27 -04:00
|
|
|
.SS \f[V]animate(property: str, target: Any, duration: float, easing=None, delta=False, loop=False, callback=None, conflict_mode=\[aq]replace\[aq]) -> Animation\f[R]
|
2025-10-30 21:20:50 -04:00
|
|
|
.PP
|
2026-01-23 20:49:11 -05:00
|
|
|
Create and start an animation on this drawable\[cq]s property.
|
2025-10-30 21:20:50 -04:00
|
|
|
.PP
|
|
|
|
|
Note:
|
|
|
|
|
.PP
|
2026-01-23 20:49:11 -05:00
|
|
|
\f[B]Arguments:\f[R] - \f[V]property\f[R]: Name of the property to
|
|
|
|
|
animate (e.g., `x', `fill_color', `opacity') - \f[V]target\f[R]: Target
|
|
|
|
|
value - type depends on property (float, tuple for color/vector, etc.)
|
|
|
|
|
- \f[V]duration\f[R]: Animation duration in seconds - \f[V]easing\f[R]:
|
|
|
|
|
Easing function: Easing enum value, string name, or None for linear -
|
|
|
|
|
\f[V]delta\f[R]: If True, target is relative to current value; if False,
|
Replace UIEntity gridstate with DiscreteMap perspective_map; closes #294
Per-entity FOV memory moves from std::vector<UIGridPointState> (two-bool
visible/discovered pairs) to a 3-state DiscreteMap (0=UNKNOWN, 1=DISCOVERED,
2=VISIBLE), exposed as entity.perspective_map. The invariant
visible-subset-of-discovered becomes structural (single value per cell), and
the map is a live, serializable, first-class object rather than an implicit
internal array.
Changes:
- New DiscreteMap C++ class with shared ownership; PyDiscreteMapObject now
holds shared_ptr<DiscreteMap>. UIEntity holds the same shared_ptr.
- New mcrfpy.Perspective IntEnum (UNKNOWN/DISCOVERED/VISIBLE), modelled on
PyInputState.
- entity.perspective_map: lazy-allocated on first access with a grid;
setter validates size against grid and raises ValueError on mismatch;
None clears (next access lazy-reallocates fresh).
- updateVisibility() now demotes 2->1 then promotes visible cells to 2.
- entity.at(x, y) returns grid.at(x, y) when VISIBLE, else None.
- Fog-of-war rendering in UIGridView and UIGrid reads the 3-state map.
- Removed: UIEntity::gridstate, ensureGridstate(), entity.gridstate getter,
UIGridPointState struct + PyUIGridPointStateType.
- Obsolete tests deleted (test_gridpointstate_point,
issue_265_gridpointstate_dangle); 4 new tests cover lazy allocation,
identity, serialization round-trip, size validation, and the
visible-subset-of-discovered invariant.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-17 23:04:27 -04:00
|
|
|
target is absolute - \f[V]loop\f[R]: If True, animation repeats from
|
|
|
|
|
start when it reaches the end (default False) - \f[V]callback\f[R]:
|
|
|
|
|
Optional callable invoked when animation completes (not called for
|
|
|
|
|
looping animations) - \f[V]conflict_mode\f[R]: `replace' (default),
|
2026-01-23 20:49:11 -05:00
|
|
|
`queue', or `error' if property already animating
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Returns:\f[R] Animation object for monitoring progress
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Raises:\f[R] ValueError: If property name is not valid for this
|
|
|
|
|
drawable type This is a convenience method that creates an Animation,
|
|
|
|
|
starts it, and adds it to the AnimationManager.
|
|
|
|
|
.SS \f[V]move(dx, dy) or (delta) -> None\f[R]
|
2025-10-30 21:20:50 -04:00
|
|
|
.PP
|
|
|
|
|
Move the element by a relative offset.
|
|
|
|
|
.PP
|
|
|
|
|
Note:
|
|
|
|
|
.PP
|
2026-01-23 20:49:11 -05:00
|
|
|
\f[B]Arguments:\f[R] - \f[V]dx\f[R]: Horizontal offset in pixels (or use
|
|
|
|
|
delta) - \f[V]dy\f[R]: Vertical offset in pixels (or use delta) -
|
|
|
|
|
\f[V]delta\f[R]: Offset as tuple, list, or Vector: (dx, dy)
|
|
|
|
|
.SS \f[V]realign() -> None\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Reapply alignment relative to parent, useful for responsive layouts.
|
|
|
|
|
.PP
|
|
|
|
|
Note: Call this to recalculate position after parent changes size.
|
|
|
|
|
For elements with align=None, this has no effect.
|
|
|
|
|
.SS \f[V]resize(width, height) or (size) -> None\f[R]
|
2025-10-30 21:20:50 -04:00
|
|
|
.PP
|
|
|
|
|
Resize the element to new dimensions.
|
|
|
|
|
.PP
|
|
|
|
|
Note:
|
|
|
|
|
.PP
|
2026-01-23 20:49:11 -05:00
|
|
|
\f[B]Arguments:\f[R] - \f[V]width\f[R]: New width in pixels (or use
|
|
|
|
|
size) - \f[V]height\f[R]: New height in pixels (or use size) -
|
|
|
|
|
\f[V]size\f[R]: Size as tuple, list, or Vector: (width, height)
|
2025-10-30 21:20:50 -04:00
|
|
|
.SS Grid
|
|
|
|
|
.PP
|
|
|
|
|
\f[I]Inherits from: Drawable\f[R]
|
|
|
|
|
.PP
|
Replace UIEntity gridstate with DiscreteMap perspective_map; closes #294
Per-entity FOV memory moves from std::vector<UIGridPointState> (two-bool
visible/discovered pairs) to a 3-state DiscreteMap (0=UNKNOWN, 1=DISCOVERED,
2=VISIBLE), exposed as entity.perspective_map. The invariant
visible-subset-of-discovered becomes structural (single value per cell), and
the map is a live, serializable, first-class object rather than an implicit
internal array.
Changes:
- New DiscreteMap C++ class with shared ownership; PyDiscreteMapObject now
holds shared_ptr<DiscreteMap>. UIEntity holds the same shared_ptr.
- New mcrfpy.Perspective IntEnum (UNKNOWN/DISCOVERED/VISIBLE), modelled on
PyInputState.
- entity.perspective_map: lazy-allocated on first access with a grid;
setter validates size against grid and raises ValueError on mismatch;
None clears (next access lazy-reallocates fresh).
- updateVisibility() now demotes 2->1 then promotes visible cells to 2.
- entity.at(x, y) returns grid.at(x, y) when VISIBLE, else None.
- Fog-of-war rendering in UIGridView and UIGrid reads the 3-state map.
- Removed: UIEntity::gridstate, ensureGridstate(), entity.gridstate getter,
UIGridPointState struct + PyUIGridPointStateType.
- Obsolete tests deleted (test_gridpointstate_point,
issue_265_gridpointstate_dangle); 4 new tests cover lazy allocation,
identity, serialization round-trip, size validation, and the
visible-subset-of-discovered invariant.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-17 23:04:27 -04:00
|
|
|
Grid(grid_size=None, pos=None, size=None, texture=None, **kwargs)
|
2025-10-30 21:20:50 -04:00
|
|
|
.PP
|
|
|
|
|
A grid-based UI element for tile-based rendering and entity management.
|
Replace UIEntity gridstate with DiscreteMap perspective_map; closes #294
Per-entity FOV memory moves from std::vector<UIGridPointState> (two-bool
visible/discovered pairs) to a 3-state DiscreteMap (0=UNKNOWN, 1=DISCOVERED,
2=VISIBLE), exposed as entity.perspective_map. The invariant
visible-subset-of-discovered becomes structural (single value per cell), and
the map is a live, serializable, first-class object rather than an implicit
internal array.
Changes:
- New DiscreteMap C++ class with shared ownership; PyDiscreteMapObject now
holds shared_ptr<DiscreteMap>. UIEntity holds the same shared_ptr.
- New mcrfpy.Perspective IntEnum (UNKNOWN/DISCOVERED/VISIBLE), modelled on
PyInputState.
- entity.perspective_map: lazy-allocated on first access with a grid;
setter validates size against grid and raises ValueError on mismatch;
None clears (next access lazy-reallocates fresh).
- updateVisibility() now demotes 2->1 then promotes visible cells to 2.
- entity.at(x, y) returns grid.at(x, y) when VISIBLE, else None.
- Fog-of-war rendering in UIGridView and UIGrid reads the 3-state map.
- Removed: UIEntity::gridstate, ensureGridstate(), entity.gridstate getter,
UIGridPointState struct + PyUIGridPointStateType.
- Obsolete tests deleted (test_gridpointstate_point,
issue_265_gridpointstate_dangle); 4 new tests cover lazy allocation,
identity, serialization round-trip, size validation, and the
visible-subset-of-discovered invariant.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-17 23:04:27 -04:00
|
|
|
Creates and owns grid data (cells, entities, layers) with an integrated
|
|
|
|
|
rendering view (camera, zoom, perspective).
|
2025-10-30 21:20:50 -04:00
|
|
|
.PP
|
Replace UIEntity gridstate with DiscreteMap perspective_map; closes #294
Per-entity FOV memory moves from std::vector<UIGridPointState> (two-bool
visible/discovered pairs) to a 3-state DiscreteMap (0=UNKNOWN, 1=DISCOVERED,
2=VISIBLE), exposed as entity.perspective_map. The invariant
visible-subset-of-discovered becomes structural (single value per cell), and
the map is a live, serializable, first-class object rather than an implicit
internal array.
Changes:
- New DiscreteMap C++ class with shared ownership; PyDiscreteMapObject now
holds shared_ptr<DiscreteMap>. UIEntity holds the same shared_ptr.
- New mcrfpy.Perspective IntEnum (UNKNOWN/DISCOVERED/VISIBLE), modelled on
PyInputState.
- entity.perspective_map: lazy-allocated on first access with a grid;
setter validates size against grid and raises ValueError on mismatch;
None clears (next access lazy-reallocates fresh).
- updateVisibility() now demotes 2->1 then promotes visible cells to 2.
- entity.at(x, y) returns grid.at(x, y) when VISIBLE, else None.
- Fog-of-war rendering in UIGridView and UIGrid reads the 3-state map.
- Removed: UIEntity::gridstate, ensureGridstate(), entity.gridstate getter,
UIGridPointState struct + PyUIGridPointStateType.
- Obsolete tests deleted (test_gridpointstate_point,
issue_265_gridpointstate_dangle); 4 new tests cover lazy allocation,
identity, serialization round-trip, size validation, and the
visible-subset-of-discovered invariant.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-17 23:04:27 -04:00
|
|
|
Can also be constructed as a view of existing grid data:
|
|
|
|
|
Grid(grid=existing_grid, pos=\&..., size=\&...)
|
|
|
|
|
.PP
|
|
|
|
|
Args: grid_size (tuple): Grid dimensions as (grid_w, grid_h).
|
|
|
|
|
Default: (2, 2) pos (tuple): Position as (x, y).
|
|
|
|
|
Default: (0, 0) size (tuple): Size as (w, h).
|
|
|
|
|
Default: auto-calculated texture (Texture): Tile texture atlas.
|
2025-10-30 21:20:50 -04:00
|
|
|
Default: default texture
|
|
|
|
|
.PP
|
Replace UIEntity gridstate with DiscreteMap perspective_map; closes #294
Per-entity FOV memory moves from std::vector<UIGridPointState> (two-bool
visible/discovered pairs) to a 3-state DiscreteMap (0=UNKNOWN, 1=DISCOVERED,
2=VISIBLE), exposed as entity.perspective_map. The invariant
visible-subset-of-discovered becomes structural (single value per cell), and
the map is a live, serializable, first-class object rather than an implicit
internal array.
Changes:
- New DiscreteMap C++ class with shared ownership; PyDiscreteMapObject now
holds shared_ptr<DiscreteMap>. UIEntity holds the same shared_ptr.
- New mcrfpy.Perspective IntEnum (UNKNOWN/DISCOVERED/VISIBLE), modelled on
PyInputState.
- entity.perspective_map: lazy-allocated on first access with a grid;
setter validates size against grid and raises ValueError on mismatch;
None clears (next access lazy-reallocates fresh).
- updateVisibility() now demotes 2->1 then promotes visible cells to 2.
- entity.at(x, y) returns grid.at(x, y) when VISIBLE, else None.
- Fog-of-war rendering in UIGridView and UIGrid reads the 3-state map.
- Removed: UIEntity::gridstate, ensureGridstate(), entity.gridstate getter,
UIGridPointState struct + PyUIGridPointStateType.
- Obsolete tests deleted (test_gridpointstate_point,
issue_265_gridpointstate_dangle); 4 new tests cover lazy allocation,
identity, serialization round-trip, size validation, and the
visible-subset-of-discovered invariant.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-17 23:04:27 -04:00
|
|
|
Keyword Args: grid (Grid): Existing Grid to view (creates view of shared
|
|
|
|
|
data).
|
|
|
|
|
fill_color (Color): Background fill color.
|
|
|
|
|
on_click (callable): Click event handler.
|
|
|
|
|
center_x, center_y (float): Camera center coordinates.
|
|
|
|
|
zoom (float): Zoom level.
|
|
|
|
|
Default: 1.0 visible (bool): Visibility.
|
2025-10-30 21:20:50 -04:00
|
|
|
Default: True opacity (float): Opacity (0.0-1.0).
|
|
|
|
|
Default: 1.0 z_index (int): Rendering order.
|
Replace UIEntity gridstate with DiscreteMap perspective_map; closes #294
Per-entity FOV memory moves from std::vector<UIGridPointState> (two-bool
visible/discovered pairs) to a 3-state DiscreteMap (0=UNKNOWN, 1=DISCOVERED,
2=VISIBLE), exposed as entity.perspective_map. The invariant
visible-subset-of-discovered becomes structural (single value per cell), and
the map is a live, serializable, first-class object rather than an implicit
internal array.
Changes:
- New DiscreteMap C++ class with shared ownership; PyDiscreteMapObject now
holds shared_ptr<DiscreteMap>. UIEntity holds the same shared_ptr.
- New mcrfpy.Perspective IntEnum (UNKNOWN/DISCOVERED/VISIBLE), modelled on
PyInputState.
- entity.perspective_map: lazy-allocated on first access with a grid;
setter validates size against grid and raises ValueError on mismatch;
None clears (next access lazy-reallocates fresh).
- updateVisibility() now demotes 2->1 then promotes visible cells to 2.
- entity.at(x, y) returns grid.at(x, y) when VISIBLE, else None.
- Fog-of-war rendering in UIGridView and UIGrid reads the 3-state map.
- Removed: UIEntity::gridstate, ensureGridstate(), entity.gridstate getter,
UIGridPointState struct + PyUIGridPointStateType.
- Obsolete tests deleted (test_gridpointstate_point,
issue_265_gridpointstate_dangle); 4 new tests cover lazy allocation,
identity, serialization round-trip, size validation, and the
visible-subset-of-discovered invariant.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-17 23:04:27 -04:00
|
|
|
Default: 0 name (str): Element name.
|
|
|
|
|
layers (list): List of ColorLayer/TileLayer objects.
|
2026-01-23 20:49:11 -05:00
|
|
|
.PP
|
|
|
|
|
\f[B]Properties:\f[R] - \f[V]align\f[R]: Alignment relative to parent
|
|
|
|
|
bounds (Alignment enum or None).
|
|
|
|
|
When set, position is automatically calculated when parent is assigned
|
|
|
|
|
or resized.
|
|
|
|
|
Set to None to disable alignment and use manual positioning.
|
F15: correct docstring accuracy from adversarial verify pass (#314)
Follow-up to the macro conversion: an adversarial verify pass (one agent per
file vs. the C++ implementation + stubs) found 62 content issues; the real
ones are fixed here.
Callbacks (centralized):
- on_click: receives (pos, MouseButton, InputState), not str (8 files).
- on_enter/on_exit/on_move (UIBase.h): hover passes only (pos) -- removed the
fictional button/action args.
- bounds/global_bounds (UIBase.h): mark (tuple, read-only).
Signatures / types:
- Grid.find_path: document heuristic + weight; get_dijkstra_map: document roots;
compute_fov: FOV | int = FOV.BASIC (not the C constant FOV_BASIC) + Returns;
at/is_in_fov: document (pos) and (x, y) call forms.
- get_metrics: document all 16 returned dict keys (was 8); bresenham: drop the
bogus '*' keyword-only separator.
- Nullable defaults typed correctly: BSP seed/size, ColorLayer draw_fov/
apply_perspective Color|None, Entity.visible_entities radius int=-1 (None is
rejected by the 'i' parser -> see #319).
- Type-token fixes: GridView.center -> Vector; GridView.texture -> (None,
read-only) (unimplemented, #318); GridPoint.grid_pos -> (tuple, read-only);
EntityCollection.find -> Entity | list[Entity] | None; extend RuntimeError;
UniformCollection.values -> list[float | tuple | None].
- automation: onScreen (x, y) form documented; scroll notes x is ignored (#317).
Also: correct stale AStarPath/DijkstraMap signatures in docs/api-audit-2026-04.md
(the bindings were right, the audit table was outdated). Rebaseline the API
snapshot golden and regenerate docs/stubs.
Code-level bugs surfaced by the pass are filed as #317, #318, #319.
Refs #314, #317, #318, #319
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 06:43:47 -04:00
|
|
|
- \f[V]bounds\f[R] \f[I](read-only)\f[R]: Axis-aligned bounding box
|
|
|
|
|
(tuple, read-only) as a (pos, size) pair of Vectors: (Vector(x, y),
|
|
|
|
|
Vector(width, height)).
|
Update documentation for API changes #229, #230, #184
CLAUDE.md updates:
- Fix Python version 3.12 -> 3.14
- Update keypressScene -> scene.on_key pattern
- Add API examples for new callback signatures
- Document animation callbacks (target, prop, value)
- Document hover callbacks (position-only)
- Document enum types (Key, MouseButton, InputState)
stubs/mcrfpy.pyi updates:
- Add Key, MouseButton, InputState, Easing enum classes
- Fix Drawable hover callback signatures per #230
- Fix Grid cell callback signatures per #230
- Fix Scene.on_key signature to use enums per #184
- Update Animation class with correct callback signature per #229
- Add deprecation notes to keypressScene, setTimer, delTimer
Regenerated docs:
- API_REFERENCE_DYNAMIC.md
- api_reference_dynamic.html
- mcrfpy.3 man page
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-28 19:20:04 -05:00
|
|
|
- \f[V]camera_rotation\f[R]: Rotation of grid contents around camera
|
F15: convert frozen binding docstrings to MCRF_* macros (#314)
Convert 289 raw PyMethodDef/PyGetSetDef docstring slots to MCRF_METHOD /
MCRF_PROPERTY across the 20 frozen (non-3D) binding files, bringing the
frozen surface to 100% macro compliance (check_frozen_docstrings.sh PASS).
Done via a one-agent-per-file workflow gated by validate_file_docstrings.sh
and per-wave build/doc-rebuild checks.
- Adds #include "McRFPy_Doc.h" where missing; fills the lone genuine doc
gap (UIGrid.at, which was MISSING a doc field in two arrays).
- McRFPy_Doc.h: comment documenting the MCRF_METHOD_DOC comma rule (the
trap that broke the GridLayers conversion mid-run).
- Rebaseline api_surface golden: property types now resolve to real types
instead of "Any" (e.g. grid_pos: Vector, on_cell_click: Callable | None),
and 11 properties correctly flip rw->ro now that their docstrings carry
"read-only" (collections, grid_size, hovered_cell, texture, view — all
verified against NULL setter slots).
- Regenerate docs/stubs/man page from the new docstrings.
Module-level functions use MCRF_METHOD(<name>, ...) (expands identically to
the intended MCRF_FUNCTION; the audit's compliance set is METHOD/PROPERTY).
Experimental 3D/Voxel bindings (src/3d/) remain exempt from the freeze.
Pre-existing failures unrelated to this change: test_animation_*,
test_constructor_comprehensive (reference the removed mcrfpy.Animation and
old constructor arity).
Refs #314
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 01:20:55 -04:00
|
|
|
center in degrees (float).
|
F15: correct docstring accuracy from adversarial verify pass (#314)
Follow-up to the macro conversion: an adversarial verify pass (one agent per
file vs. the C++ implementation + stubs) found 62 content issues; the real
ones are fixed here.
Callbacks (centralized):
- on_click: receives (pos, MouseButton, InputState), not str (8 files).
- on_enter/on_exit/on_move (UIBase.h): hover passes only (pos) -- removed the
fictional button/action args.
- bounds/global_bounds (UIBase.h): mark (tuple, read-only).
Signatures / types:
- Grid.find_path: document heuristic + weight; get_dijkstra_map: document roots;
compute_fov: FOV | int = FOV.BASIC (not the C constant FOV_BASIC) + Returns;
at/is_in_fov: document (pos) and (x, y) call forms.
- get_metrics: document all 16 returned dict keys (was 8); bresenham: drop the
bogus '*' keyword-only separator.
- Nullable defaults typed correctly: BSP seed/size, ColorLayer draw_fov/
apply_perspective Color|None, Entity.visible_entities radius int=-1 (None is
rejected by the 'i' parser -> see #319).
- Type-token fixes: GridView.center -> Vector; GridView.texture -> (None,
read-only) (unimplemented, #318); GridPoint.grid_pos -> (tuple, read-only);
EntityCollection.find -> Entity | list[Entity] | None; extend RuntimeError;
UniformCollection.values -> list[float | tuple | None].
- automation: onScreen (x, y) form documented; scroll notes x is ignored (#317).
Also: correct stale AStarPath/DijkstraMap signatures in docs/api-audit-2026-04.md
(the bindings were right, the audit table was outdated). Rebaseline the API
snapshot golden and regenerate docs/stubs.
Code-level bugs surfaced by the pass are filed as #317, #318, #319.
Refs #314, #317, #318, #319
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 06:43:47 -04:00
|
|
|
- \f[V]center\f[R]: Camera center point in pixel coordinates (Vector).
|
F15: convert frozen binding docstrings to MCRF_* macros (#314)
Convert 289 raw PyMethodDef/PyGetSetDef docstring slots to MCRF_METHOD /
MCRF_PROPERTY across the 20 frozen (non-3D) binding files, bringing the
frozen surface to 100% macro compliance (check_frozen_docstrings.sh PASS).
Done via a one-agent-per-file workflow gated by validate_file_docstrings.sh
and per-wave build/doc-rebuild checks.
- Adds #include "McRFPy_Doc.h" where missing; fills the lone genuine doc
gap (UIGrid.at, which was MISSING a doc field in two arrays).
- McRFPy_Doc.h: comment documenting the MCRF_METHOD_DOC comma rule (the
trap that broke the GridLayers conversion mid-run).
- Rebaseline api_surface golden: property types now resolve to real types
instead of "Any" (e.g. grid_pos: Vector, on_cell_click: Callable | None),
and 11 properties correctly flip rw->ro now that their docstrings carry
"read-only" (collections, grid_size, hovered_cell, texture, view — all
verified against NULL setter slots).
- Regenerate docs/stubs/man page from the new docstrings.
Module-level functions use MCRF_METHOD(<name>, ...) (expands identically to
the intended MCRF_FUNCTION; the audit's compliance set is METHOD/PROPERTY).
Experimental 3D/Voxel bindings (src/3d/) remain exempt from the freeze.
Pre-existing failures unrelated to this change: test_animation_*,
test_constructor_comprehensive (reference the removed mcrfpy.Animation and
old constructor arity).
Refs #314
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 01:20:55 -04:00
|
|
|
- \f[V]center_x\f[R]: Camera center X-coordinate in pixel space (float).
|
|
|
|
|
- \f[V]center_y\f[R]: Camera center Y-coordinate in pixel space (float).
|
|
|
|
|
- \f[V]fill_color\f[R]: Background fill color (Color).
|
|
|
|
|
Drawn behind all tiles and entities.
|
F15: correct docstring accuracy from adversarial verify pass (#314)
Follow-up to the macro conversion: an adversarial verify pass (one agent per
file vs. the C++ implementation + stubs) found 62 content issues; the real
ones are fixed here.
Callbacks (centralized):
- on_click: receives (pos, MouseButton, InputState), not str (8 files).
- on_enter/on_exit/on_move (UIBase.h): hover passes only (pos) -- removed the
fictional button/action args.
- bounds/global_bounds (UIBase.h): mark (tuple, read-only).
Signatures / types:
- Grid.find_path: document heuristic + weight; get_dijkstra_map: document roots;
compute_fov: FOV | int = FOV.BASIC (not the C constant FOV_BASIC) + Returns;
at/is_in_fov: document (pos) and (x, y) call forms.
- get_metrics: document all 16 returned dict keys (was 8); bresenham: drop the
bogus '*' keyword-only separator.
- Nullable defaults typed correctly: BSP seed/size, ColorLayer draw_fov/
apply_perspective Color|None, Entity.visible_entities radius int=-1 (None is
rejected by the 'i' parser -> see #319).
- Type-token fixes: GridView.center -> Vector; GridView.texture -> (None,
read-only) (unimplemented, #318); GridPoint.grid_pos -> (tuple, read-only);
EntityCollection.find -> Entity | list[Entity] | None; extend RuntimeError;
UniformCollection.values -> list[float | tuple | None].
- automation: onScreen (x, y) form documented; scroll notes x is ignored (#317).
Also: correct stale AStarPath/DijkstraMap signatures in docs/api-audit-2026-04.md
(the bindings were right, the audit table was outdated). Rebaseline the API
snapshot golden and regenerate docs/stubs.
Code-level bugs surfaced by the pass are filed as #317, #318, #319.
Refs #314, #317, #318, #319
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 06:43:47 -04:00
|
|
|
- \f[V]global_bounds\f[R] \f[I](read-only)\f[R]: Axis-aligned bounding
|
|
|
|
|
box in screen coordinates (tuple, read-only) as a (pos, size) pair of
|
|
|
|
|
Vectors: (Vector(x, y), Vector(width, height)).
|
2026-01-23 20:49:11 -05:00
|
|
|
- \f[V]global_position\f[R] \f[I](read-only)\f[R]: Global screen
|
|
|
|
|
position (read-only).
|
|
|
|
|
Calculates absolute position by walking up the parent chain.
|
F15: convert frozen binding docstrings to MCRF_* macros (#314)
Convert 289 raw PyMethodDef/PyGetSetDef docstring slots to MCRF_METHOD /
MCRF_PROPERTY across the 20 frozen (non-3D) binding files, bringing the
frozen surface to 100% macro compliance (check_frozen_docstrings.sh PASS).
Done via a one-agent-per-file workflow gated by validate_file_docstrings.sh
and per-wave build/doc-rebuild checks.
- Adds #include "McRFPy_Doc.h" where missing; fills the lone genuine doc
gap (UIGrid.at, which was MISSING a doc field in two arrays).
- McRFPy_Doc.h: comment documenting the MCRF_METHOD_DOC comma rule (the
trap that broke the GridLayers conversion mid-run).
- Rebaseline api_surface golden: property types now resolve to real types
instead of "Any" (e.g. grid_pos: Vector, on_cell_click: Callable | None),
and 11 properties correctly flip rw->ro now that their docstrings carry
"read-only" (collections, grid_size, hovered_cell, texture, view — all
verified against NULL setter slots).
- Regenerate docs/stubs/man page from the new docstrings.
Module-level functions use MCRF_METHOD(<name>, ...) (expands identically to
the intended MCRF_FUNCTION; the audit's compliance set is METHOD/PROPERTY).
Experimental 3D/Voxel bindings (src/3d/) remain exempt from the freeze.
Pre-existing failures unrelated to this change: test_animation_*,
test_constructor_comprehensive (reference the removed mcrfpy.Animation and
old constructor arity).
Refs #314
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 01:20:55 -04:00
|
|
|
- \f[V]grid_data\f[R]: The underlying grid data object (Grid | None).
|
|
|
|
|
Used for multi-view scenarios where multiple GridViews share one Grid.
|
|
|
|
|
- \f[V]h\f[R]: Visible widget height (float).
|
|
|
|
|
- \f[V]horiz_margin\f[R]: Horizontal margin override (float, 0 = use
|
|
|
|
|
general margin).
|
2026-01-23 20:49:11 -05:00
|
|
|
Invalid for vertically-centered alignments (TOP_CENTER, BOTTOM_CENTER,
|
|
|
|
|
CENTER).
|
|
|
|
|
- \f[V]hovered\f[R] \f[I](read-only)\f[R]: Whether mouse is currently
|
|
|
|
|
over this element (read-only).
|
|
|
|
|
Updated automatically by the engine during mouse movement.
|
Replace UIEntity gridstate with DiscreteMap perspective_map; closes #294
Per-entity FOV memory moves from std::vector<UIGridPointState> (two-bool
visible/discovered pairs) to a 3-state DiscreteMap (0=UNKNOWN, 1=DISCOVERED,
2=VISIBLE), exposed as entity.perspective_map. The invariant
visible-subset-of-discovered becomes structural (single value per cell), and
the map is a live, serializable, first-class object rather than an implicit
internal array.
Changes:
- New DiscreteMap C++ class with shared ownership; PyDiscreteMapObject now
holds shared_ptr<DiscreteMap>. UIEntity holds the same shared_ptr.
- New mcrfpy.Perspective IntEnum (UNKNOWN/DISCOVERED/VISIBLE), modelled on
PyInputState.
- entity.perspective_map: lazy-allocated on first access with a grid;
setter validates size against grid and raises ValueError on mismatch;
None clears (next access lazy-reallocates fresh).
- updateVisibility() now demotes 2->1 then promotes visible cells to 2.
- entity.at(x, y) returns grid.at(x, y) when VISIBLE, else None.
- Fog-of-war rendering in UIGridView and UIGrid reads the 3-state map.
- Removed: UIEntity::gridstate, ensureGridstate(), entity.gridstate getter,
UIGridPointState struct + PyUIGridPointStateType.
- Obsolete tests deleted (test_gridpointstate_point,
issue_265_gridpointstate_dangle); 4 new tests cover lazy allocation,
identity, serialization round-trip, size validation, and the
visible-subset-of-discovered invariant.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-17 23:04:27 -04:00
|
|
|
- \f[V]margin\f[R]: General margin from edge when aligned (float).
|
2026-01-23 20:49:11 -05:00
|
|
|
Applied to both horizontal and vertical edges unless overridden.
|
|
|
|
|
Invalid for CENTER alignment (raises ValueError).
|
F15: convert frozen binding docstrings to MCRF_* macros (#314)
Convert 289 raw PyMethodDef/PyGetSetDef docstring slots to MCRF_METHOD /
MCRF_PROPERTY across the 20 frozen (non-3D) binding files, bringing the
frozen surface to 100% macro compliance (check_frozen_docstrings.sh PASS).
Done via a one-agent-per-file workflow gated by validate_file_docstrings.sh
and per-wave build/doc-rebuild checks.
- Adds #include "McRFPy_Doc.h" where missing; fills the lone genuine doc
gap (UIGrid.at, which was MISSING a doc field in two arrays).
- McRFPy_Doc.h: comment documenting the MCRF_METHOD_DOC comma rule (the
trap that broke the GridLayers conversion mid-run).
- Rebaseline api_surface golden: property types now resolve to real types
instead of "Any" (e.g. grid_pos: Vector, on_cell_click: Callable | None),
and 11 properties correctly flip rw->ro now that their docstrings carry
"read-only" (collections, grid_size, hovered_cell, texture, view — all
verified against NULL setter slots).
- Regenerate docs/stubs/man page from the new docstrings.
Module-level functions use MCRF_METHOD(<name>, ...) (expands identically to
the intended MCRF_FUNCTION; the audit's compliance set is METHOD/PROPERTY).
Experimental 3D/Voxel bindings (src/3d/) remain exempt from the freeze.
Pre-existing failures unrelated to this change: test_animation_*,
test_constructor_comprehensive (reference the removed mcrfpy.Animation and
old constructor arity).
Refs #314
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 01:20:55 -04:00
|
|
|
- \f[V]name\f[R]: Name for finding elements (str).
|
|
|
|
|
- \f[V]on_click\f[R]: Callable executed when object is clicked (Callable
|
|
|
|
|
| None).
|
2026-01-23 20:49:11 -05:00
|
|
|
- \f[V]on_enter\f[R]: Callback for mouse enter events.
|
F15: correct docstring accuracy from adversarial verify pass (#314)
Follow-up to the macro conversion: an adversarial verify pass (one agent per
file vs. the C++ implementation + stubs) found 62 content issues; the real
ones are fixed here.
Callbacks (centralized):
- on_click: receives (pos, MouseButton, InputState), not str (8 files).
- on_enter/on_exit/on_move (UIBase.h): hover passes only (pos) -- removed the
fictional button/action args.
- bounds/global_bounds (UIBase.h): mark (tuple, read-only).
Signatures / types:
- Grid.find_path: document heuristic + weight; get_dijkstra_map: document roots;
compute_fov: FOV | int = FOV.BASIC (not the C constant FOV_BASIC) + Returns;
at/is_in_fov: document (pos) and (x, y) call forms.
- get_metrics: document all 16 returned dict keys (was 8); bresenham: drop the
bogus '*' keyword-only separator.
- Nullable defaults typed correctly: BSP seed/size, ColorLayer draw_fov/
apply_perspective Color|None, Entity.visible_entities radius int=-1 (None is
rejected by the 'i' parser -> see #319).
- Type-token fixes: GridView.center -> Vector; GridView.texture -> (None,
read-only) (unimplemented, #318); GridPoint.grid_pos -> (tuple, read-only);
EntityCollection.find -> Entity | list[Entity] | None; extend RuntimeError;
UniformCollection.values -> list[float | tuple | None].
- automation: onScreen (x, y) form documented; scroll notes x is ignored (#317).
Also: correct stale AStarPath/DijkstraMap signatures in docs/api-audit-2026-04.md
(the bindings were right, the audit table was outdated). Rebaseline the API
snapshot golden and regenerate docs/stubs.
Code-level bugs surfaced by the pass are filed as #317, #318, #319.
Refs #314, #317, #318, #319
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 06:43:47 -04:00
|
|
|
Called with (pos: Vector) when mouse enters this element\[cq]s bounds.
|
2026-01-23 20:49:11 -05:00
|
|
|
- \f[V]on_exit\f[R]: Callback for mouse exit events.
|
F15: correct docstring accuracy from adversarial verify pass (#314)
Follow-up to the macro conversion: an adversarial verify pass (one agent per
file vs. the C++ implementation + stubs) found 62 content issues; the real
ones are fixed here.
Callbacks (centralized):
- on_click: receives (pos, MouseButton, InputState), not str (8 files).
- on_enter/on_exit/on_move (UIBase.h): hover passes only (pos) -- removed the
fictional button/action args.
- bounds/global_bounds (UIBase.h): mark (tuple, read-only).
Signatures / types:
- Grid.find_path: document heuristic + weight; get_dijkstra_map: document roots;
compute_fov: FOV | int = FOV.BASIC (not the C constant FOV_BASIC) + Returns;
at/is_in_fov: document (pos) and (x, y) call forms.
- get_metrics: document all 16 returned dict keys (was 8); bresenham: drop the
bogus '*' keyword-only separator.
- Nullable defaults typed correctly: BSP seed/size, ColorLayer draw_fov/
apply_perspective Color|None, Entity.visible_entities radius int=-1 (None is
rejected by the 'i' parser -> see #319).
- Type-token fixes: GridView.center -> Vector; GridView.texture -> (None,
read-only) (unimplemented, #318); GridPoint.grid_pos -> (tuple, read-only);
EntityCollection.find -> Entity | list[Entity] | None; extend RuntimeError;
UniformCollection.values -> list[float | tuple | None].
- automation: onScreen (x, y) form documented; scroll notes x is ignored (#317).
Also: correct stale AStarPath/DijkstraMap signatures in docs/api-audit-2026-04.md
(the bindings were right, the audit table was outdated). Rebaseline the API
snapshot golden and regenerate docs/stubs.
Code-level bugs surfaced by the pass are filed as #317, #318, #319.
Refs #314, #317, #318, #319
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 06:43:47 -04:00
|
|
|
Called with (pos: Vector) when mouse leaves this element\[cq]s bounds.
|
2026-01-23 20:49:11 -05:00
|
|
|
- \f[V]on_move\f[R]: Callback for mouse movement within bounds.
|
F15: correct docstring accuracy from adversarial verify pass (#314)
Follow-up to the macro conversion: an adversarial verify pass (one agent per
file vs. the C++ implementation + stubs) found 62 content issues; the real
ones are fixed here.
Callbacks (centralized):
- on_click: receives (pos, MouseButton, InputState), not str (8 files).
- on_enter/on_exit/on_move (UIBase.h): hover passes only (pos) -- removed the
fictional button/action args.
- bounds/global_bounds (UIBase.h): mark (tuple, read-only).
Signatures / types:
- Grid.find_path: document heuristic + weight; get_dijkstra_map: document roots;
compute_fov: FOV | int = FOV.BASIC (not the C constant FOV_BASIC) + Returns;
at/is_in_fov: document (pos) and (x, y) call forms.
- get_metrics: document all 16 returned dict keys (was 8); bresenham: drop the
bogus '*' keyword-only separator.
- Nullable defaults typed correctly: BSP seed/size, ColorLayer draw_fov/
apply_perspective Color|None, Entity.visible_entities radius int=-1 (None is
rejected by the 'i' parser -> see #319).
- Type-token fixes: GridView.center -> Vector; GridView.texture -> (None,
read-only) (unimplemented, #318); GridPoint.grid_pos -> (tuple, read-only);
EntityCollection.find -> Entity | list[Entity] | None; extend RuntimeError;
UniformCollection.values -> list[float | tuple | None].
- automation: onScreen (x, y) form documented; scroll notes x is ignored (#317).
Also: correct stale AStarPath/DijkstraMap signatures in docs/api-audit-2026-04.md
(the bindings were right, the audit table was outdated). Rebaseline the API
snapshot golden and regenerate docs/stubs.
Code-level bugs surfaced by the pass are filed as #317, #318, #319.
Refs #314, #317, #318, #319
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 06:43:47 -04:00
|
|
|
Called with (pos: Vector) for each mouse movement while inside.
|
2026-01-23 20:49:11 -05:00
|
|
|
Performance note: Called frequently during movement - keep handlers
|
|
|
|
|
fast.
|
|
|
|
|
- \f[V]opacity\f[R]: Opacity level (0.0 = transparent, 1.0 = opaque).
|
|
|
|
|
Automatically clamped to valid range [0.0, 1.0].
|
Update documentation for API changes #229, #230, #184
CLAUDE.md updates:
- Fix Python version 3.12 -> 3.14
- Update keypressScene -> scene.on_key pattern
- Add API examples for new callback signatures
- Document animation callbacks (target, prop, value)
- Document hover callbacks (position-only)
- Document enum types (Key, MouseButton, InputState)
stubs/mcrfpy.pyi updates:
- Add Key, MouseButton, InputState, Easing enum classes
- Fix Drawable hover callback signatures per #230
- Fix Grid cell callback signatures per #230
- Fix Scene.on_key signature to use enums per #184
- Update Animation class with correct callback signature per #229
- Add deprecation notes to keypressScene, setTimer, delTimer
Regenerated docs:
- API_REFERENCE_DYNAMIC.md
- api_reference_dynamic.html
- mcrfpy.3 man page
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-28 19:20:04 -05:00
|
|
|
- \f[V]origin\f[R]: Transform origin as Vector (pivot point for
|
|
|
|
|
rotation).
|
|
|
|
|
Default (0,0) is top-left; set to (w/2, h/2) to rotate around center.
|
2026-01-23 20:49:11 -05:00
|
|
|
- \f[V]parent\f[R]: Parent drawable.
|
|
|
|
|
Get: Returns the parent Frame/Grid if nested, or None if at scene level.
|
|
|
|
|
Set: Assign a Frame/Grid to reparent, or None to remove from parent.
|
F15: convert frozen binding docstrings to MCRF_* macros (#314)
Convert 289 raw PyMethodDef/PyGetSetDef docstring slots to MCRF_METHOD /
MCRF_PROPERTY across the 20 frozen (non-3D) binding files, bringing the
frozen surface to 100% macro compliance (check_frozen_docstrings.sh PASS).
Done via a one-agent-per-file workflow gated by validate_file_docstrings.sh
and per-wave build/doc-rebuild checks.
- Adds #include "McRFPy_Doc.h" where missing; fills the lone genuine doc
gap (UIGrid.at, which was MISSING a doc field in two arrays).
- McRFPy_Doc.h: comment documenting the MCRF_METHOD_DOC comma rule (the
trap that broke the GridLayers conversion mid-run).
- Rebaseline api_surface golden: property types now resolve to real types
instead of "Any" (e.g. grid_pos: Vector, on_cell_click: Callable | None),
and 11 properties correctly flip rw->ro now that their docstrings carry
"read-only" (collections, grid_size, hovered_cell, texture, view — all
verified against NULL setter slots).
- Regenerate docs/stubs/man page from the new docstrings.
Module-level functions use MCRF_METHOD(<name>, ...) (expands identically to
the intended MCRF_FUNCTION; the audit's compliance set is METHOD/PROPERTY).
Experimental 3D/Voxel bindings (src/3d/) remain exempt from the freeze.
Pre-existing failures unrelated to this change: test_animation_*,
test_constructor_comprehensive (reference the removed mcrfpy.Animation and
old constructor arity).
Refs #314
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 01:20:55 -04:00
|
|
|
- \f[V]pos\f[R]: Position of the grid as Vector (Vector).
|
|
|
|
|
- \f[V]rotate_with_camera\f[R]: Whether to rotate visually with parent
|
Replace UIEntity gridstate with DiscreteMap perspective_map; closes #294
Per-entity FOV memory moves from std::vector<UIGridPointState> (two-bool
visible/discovered pairs) to a 3-state DiscreteMap (0=UNKNOWN, 1=DISCOVERED,
2=VISIBLE), exposed as entity.perspective_map. The invariant
visible-subset-of-discovered becomes structural (single value per cell), and
the map is a live, serializable, first-class object rather than an implicit
internal array.
Changes:
- New DiscreteMap C++ class with shared ownership; PyDiscreteMapObject now
holds shared_ptr<DiscreteMap>. UIEntity holds the same shared_ptr.
- New mcrfpy.Perspective IntEnum (UNKNOWN/DISCOVERED/VISIBLE), modelled on
PyInputState.
- entity.perspective_map: lazy-allocated on first access with a grid;
setter validates size against grid and raises ValueError on mismatch;
None clears (next access lazy-reallocates fresh).
- updateVisibility() now demotes 2->1 then promotes visible cells to 2.
- entity.at(x, y) returns grid.at(x, y) when VISIBLE, else None.
- Fog-of-war rendering in UIGridView and UIGrid reads the 3-state map.
- Removed: UIEntity::gridstate, ensureGridstate(), entity.gridstate getter,
UIGridPointState struct + PyUIGridPointStateType.
- Obsolete tests deleted (test_gridpointstate_point,
issue_265_gridpointstate_dangle); 4 new tests cover lazy allocation,
identity, serialization round-trip, size validation, and the
visible-subset-of-discovered invariant.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-17 23:04:27 -04:00
|
|
|
Grid\[cq]s camera_rotation (bool).
|
Update documentation for API changes #229, #230, #184
CLAUDE.md updates:
- Fix Python version 3.12 -> 3.14
- Update keypressScene -> scene.on_key pattern
- Add API examples for new callback signatures
- Document animation callbacks (target, prop, value)
- Document hover callbacks (position-only)
- Document enum types (Key, MouseButton, InputState)
stubs/mcrfpy.pyi updates:
- Add Key, MouseButton, InputState, Easing enum classes
- Fix Drawable hover callback signatures per #230
- Fix Grid cell callback signatures per #230
- Fix Scene.on_key signature to use enums per #184
- Update Animation class with correct callback signature per #229
- Add deprecation notes to keypressScene, setTimer, delTimer
Regenerated docs:
- API_REFERENCE_DYNAMIC.md
- api_reference_dynamic.html
- mcrfpy.3 man page
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-28 19:20:04 -05:00
|
|
|
False (default): stay screen-aligned.
|
|
|
|
|
True: tilt with camera.
|
|
|
|
|
Only affects children of UIGrid; ignored for other parents.
|
|
|
|
|
- \f[V]rotation\f[R]: Rotation angle in degrees (clockwise around
|
|
|
|
|
origin).
|
|
|
|
|
Animatable property.
|
|
|
|
|
- \f[V]shader\f[R]: Shader for GPU visual effects (Shader or None).
|
|
|
|
|
When set, the drawable is rendered through the shader program.
|
|
|
|
|
Set to None to disable shader effects.
|
Replace UIEntity gridstate with DiscreteMap perspective_map; closes #294
Per-entity FOV memory moves from std::vector<UIGridPointState> (two-bool
visible/discovered pairs) to a 3-state DiscreteMap (0=UNKNOWN, 1=DISCOVERED,
2=VISIBLE), exposed as entity.perspective_map. The invariant
visible-subset-of-discovered becomes structural (single value per cell), and
the map is a live, serializable, first-class object rather than an implicit
internal array.
Changes:
- New DiscreteMap C++ class with shared ownership; PyDiscreteMapObject now
holds shared_ptr<DiscreteMap>. UIEntity holds the same shared_ptr.
- New mcrfpy.Perspective IntEnum (UNKNOWN/DISCOVERED/VISIBLE), modelled on
PyInputState.
- entity.perspective_map: lazy-allocated on first access with a grid;
setter validates size against grid and raises ValueError on mismatch;
None clears (next access lazy-reallocates fresh).
- updateVisibility() now demotes 2->1 then promotes visible cells to 2.
- entity.at(x, y) returns grid.at(x, y) when VISIBLE, else None.
- Fog-of-war rendering in UIGridView and UIGrid reads the 3-state map.
- Removed: UIEntity::gridstate, ensureGridstate(), entity.gridstate getter,
UIGridPointState struct + PyUIGridPointStateType.
- Obsolete tests deleted (test_gridpointstate_point,
issue_265_gridpointstate_dangle); 4 new tests cover lazy allocation,
identity, serialization round-trip, size validation, and the
visible-subset-of-discovered invariant.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-17 23:04:27 -04:00
|
|
|
- \f[V]texture\f[R] \f[I](read-only)\f[R]: Texture used for tile
|
F15: correct docstring accuracy from adversarial verify pass (#314)
Follow-up to the macro conversion: an adversarial verify pass (one agent per
file vs. the C++ implementation + stubs) found 62 content issues; the real
ones are fixed here.
Callbacks (centralized):
- on_click: receives (pos, MouseButton, InputState), not str (8 files).
- on_enter/on_exit/on_move (UIBase.h): hover passes only (pos) -- removed the
fictional button/action args.
- bounds/global_bounds (UIBase.h): mark (tuple, read-only).
Signatures / types:
- Grid.find_path: document heuristic + weight; get_dijkstra_map: document roots;
compute_fov: FOV | int = FOV.BASIC (not the C constant FOV_BASIC) + Returns;
at/is_in_fov: document (pos) and (x, y) call forms.
- get_metrics: document all 16 returned dict keys (was 8); bresenham: drop the
bogus '*' keyword-only separator.
- Nullable defaults typed correctly: BSP seed/size, ColorLayer draw_fov/
apply_perspective Color|None, Entity.visible_entities radius int=-1 (None is
rejected by the 'i' parser -> see #319).
- Type-token fixes: GridView.center -> Vector; GridView.texture -> (None,
read-only) (unimplemented, #318); GridPoint.grid_pos -> (tuple, read-only);
EntityCollection.find -> Entity | list[Entity] | None; extend RuntimeError;
UniformCollection.values -> list[float | tuple | None].
- automation: onScreen (x, y) form documented; scroll notes x is ignored (#317).
Also: correct stale AStarPath/DijkstraMap signatures in docs/api-audit-2026-04.md
(the bindings were right, the audit table was outdated). Rebaseline the API
snapshot golden and regenerate docs/stubs.
Code-level bugs surfaced by the pass are filed as #317, #318, #319.
Refs #314, #317, #318, #319
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 06:43:47 -04:00
|
|
|
rendering (None, read-only).
|
|
|
|
|
Texture return is not yet implemented; always returns None.
|
Replace UIEntity gridstate with DiscreteMap perspective_map; closes #294
Per-entity FOV memory moves from std::vector<UIGridPointState> (two-bool
visible/discovered pairs) to a 3-state DiscreteMap (0=UNKNOWN, 1=DISCOVERED,
2=VISIBLE), exposed as entity.perspective_map. The invariant
visible-subset-of-discovered becomes structural (single value per cell), and
the map is a live, serializable, first-class object rather than an implicit
internal array.
Changes:
- New DiscreteMap C++ class with shared ownership; PyDiscreteMapObject now
holds shared_ptr<DiscreteMap>. UIEntity holds the same shared_ptr.
- New mcrfpy.Perspective IntEnum (UNKNOWN/DISCOVERED/VISIBLE), modelled on
PyInputState.
- entity.perspective_map: lazy-allocated on first access with a grid;
setter validates size against grid and raises ValueError on mismatch;
None clears (next access lazy-reallocates fresh).
- updateVisibility() now demotes 2->1 then promotes visible cells to 2.
- entity.at(x, y) returns grid.at(x, y) when VISIBLE, else None.
- Fog-of-war rendering in UIGridView and UIGrid reads the 3-state map.
- Removed: UIEntity::gridstate, ensureGridstate(), entity.gridstate getter,
UIGridPointState struct + PyUIGridPointStateType.
- Obsolete tests deleted (test_gridpointstate_point,
issue_265_gridpointstate_dangle); 4 new tests cover lazy allocation,
identity, serialization round-trip, size validation, and the
visible-subset-of-discovered invariant.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-17 23:04:27 -04:00
|
|
|
- \f[V]uniforms\f[R] \f[I](read-only)\f[R]: Collection of shader
|
|
|
|
|
uniforms (read-only access to collection).
|
Update documentation for API changes #229, #230, #184
CLAUDE.md updates:
- Fix Python version 3.12 -> 3.14
- Update keypressScene -> scene.on_key pattern
- Add API examples for new callback signatures
- Document animation callbacks (target, prop, value)
- Document hover callbacks (position-only)
- Document enum types (Key, MouseButton, InputState)
stubs/mcrfpy.pyi updates:
- Add Key, MouseButton, InputState, Easing enum classes
- Fix Drawable hover callback signatures per #230
- Fix Grid cell callback signatures per #230
- Fix Scene.on_key signature to use enums per #184
- Update Animation class with correct callback signature per #229
- Add deprecation notes to keypressScene, setTimer, delTimer
Regenerated docs:
- API_REFERENCE_DYNAMIC.md
- api_reference_dynamic.html
- mcrfpy.3 man page
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-28 19:20:04 -05:00
|
|
|
Set uniforms via dict-like syntax: drawable.uniforms[`name'] = value.
|
|
|
|
|
Supports float, vec2/3/4 tuples, PropertyBinding, and CallableBinding.
|
|
|
|
|
- \f[V]vert_margin\f[R]: Vertical margin override (float, 0 = use
|
|
|
|
|
general margin).
|
2026-01-23 20:49:11 -05:00
|
|
|
Invalid for horizontally-centered alignments (CENTER_LEFT, CENTER_RIGHT,
|
|
|
|
|
CENTER).
|
|
|
|
|
- \f[V]visible\f[R]: Whether the object is visible (bool).
|
|
|
|
|
Invisible objects are not rendered or clickable.
|
F15: convert frozen binding docstrings to MCRF_* macros (#314)
Convert 289 raw PyMethodDef/PyGetSetDef docstring slots to MCRF_METHOD /
MCRF_PROPERTY across the 20 frozen (non-3D) binding files, bringing the
frozen surface to 100% macro compliance (check_frozen_docstrings.sh PASS).
Done via a one-agent-per-file workflow gated by validate_file_docstrings.sh
and per-wave build/doc-rebuild checks.
- Adds #include "McRFPy_Doc.h" where missing; fills the lone genuine doc
gap (UIGrid.at, which was MISSING a doc field in two arrays).
- McRFPy_Doc.h: comment documenting the MCRF_METHOD_DOC comma rule (the
trap that broke the GridLayers conversion mid-run).
- Rebaseline api_surface golden: property types now resolve to real types
instead of "Any" (e.g. grid_pos: Vector, on_cell_click: Callable | None),
and 11 properties correctly flip rw->ro now that their docstrings carry
"read-only" (collections, grid_size, hovered_cell, texture, view — all
verified against NULL setter slots).
- Regenerate docs/stubs/man page from the new docstrings.
Module-level functions use MCRF_METHOD(<name>, ...) (expands identically to
the intended MCRF_FUNCTION; the audit's compliance set is METHOD/PROPERTY).
Experimental 3D/Voxel bindings (src/3d/) remain exempt from the freeze.
Pre-existing failures unrelated to this change: test_animation_*,
test_constructor_comprehensive (reference the removed mcrfpy.Animation and
old constructor arity).
Refs #314
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 01:20:55 -04:00
|
|
|
- \f[V]w\f[R]: Visible widget width (float).
|
|
|
|
|
- \f[V]x\f[R]: Top-left corner X-coordinate (float).
|
|
|
|
|
- \f[V]y\f[R]: Top-left corner Y-coordinate (float).
|
|
|
|
|
- \f[V]z_index\f[R]: Z-order for rendering (int).
|
|
|
|
|
Lower values are rendered first.
|
|
|
|
|
- \f[V]zoom\f[R]: Zoom level for rendering (float).
|
|
|
|
|
Values greater than 1.0 magnify; less than 1.0 shrink.
|
2025-10-30 21:20:50 -04:00
|
|
|
.PP
|
|
|
|
|
\f[B]Methods:\f[R]
|
Replace UIEntity gridstate with DiscreteMap perspective_map; closes #294
Per-entity FOV memory moves from std::vector<UIGridPointState> (two-bool
visible/discovered pairs) to a 3-state DiscreteMap (0=UNKNOWN, 1=DISCOVERED,
2=VISIBLE), exposed as entity.perspective_map. The invariant
visible-subset-of-discovered becomes structural (single value per cell), and
the map is a live, serializable, first-class object rather than an implicit
internal array.
Changes:
- New DiscreteMap C++ class with shared ownership; PyDiscreteMapObject now
holds shared_ptr<DiscreteMap>. UIEntity holds the same shared_ptr.
- New mcrfpy.Perspective IntEnum (UNKNOWN/DISCOVERED/VISIBLE), modelled on
PyInputState.
- entity.perspective_map: lazy-allocated on first access with a grid;
setter validates size against grid and raises ValueError on mismatch;
None clears (next access lazy-reallocates fresh).
- updateVisibility() now demotes 2->1 then promotes visible cells to 2.
- entity.at(x, y) returns grid.at(x, y) when VISIBLE, else None.
- Fog-of-war rendering in UIGridView and UIGrid reads the 3-state map.
- Removed: UIEntity::gridstate, ensureGridstate(), entity.gridstate getter,
UIGridPointState struct + PyUIGridPointStateType.
- Obsolete tests deleted (test_gridpointstate_point,
issue_265_gridpointstate_dangle); 4 new tests cover lazy allocation,
identity, serialization round-trip, size validation, and the
visible-subset-of-discovered invariant.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-17 23:04:27 -04:00
|
|
|
.SS \f[V]animate(property: str, target: Any, duration: float, easing=None, delta=False, loop=False, callback=None, conflict_mode=\[aq]replace\[aq]) -> Animation\f[R]
|
2025-10-30 21:20:50 -04:00
|
|
|
.PP
|
2026-01-23 20:49:11 -05:00
|
|
|
Create and start an animation on this drawable\[cq]s property.
|
|
|
|
|
.PP
|
|
|
|
|
Note:
|
2025-10-30 21:20:50 -04:00
|
|
|
.PP
|
2026-01-23 20:49:11 -05:00
|
|
|
\f[B]Arguments:\f[R] - \f[V]property\f[R]: Name of the property to
|
|
|
|
|
animate (e.g., `x', `fill_color', `opacity') - \f[V]target\f[R]: Target
|
|
|
|
|
value - type depends on property (float, tuple for color/vector, etc.)
|
|
|
|
|
- \f[V]duration\f[R]: Animation duration in seconds - \f[V]easing\f[R]:
|
|
|
|
|
Easing function: Easing enum value, string name, or None for linear -
|
|
|
|
|
\f[V]delta\f[R]: If True, target is relative to current value; if False,
|
Replace UIEntity gridstate with DiscreteMap perspective_map; closes #294
Per-entity FOV memory moves from std::vector<UIGridPointState> (two-bool
visible/discovered pairs) to a 3-state DiscreteMap (0=UNKNOWN, 1=DISCOVERED,
2=VISIBLE), exposed as entity.perspective_map. The invariant
visible-subset-of-discovered becomes structural (single value per cell), and
the map is a live, serializable, first-class object rather than an implicit
internal array.
Changes:
- New DiscreteMap C++ class with shared ownership; PyDiscreteMapObject now
holds shared_ptr<DiscreteMap>. UIEntity holds the same shared_ptr.
- New mcrfpy.Perspective IntEnum (UNKNOWN/DISCOVERED/VISIBLE), modelled on
PyInputState.
- entity.perspective_map: lazy-allocated on first access with a grid;
setter validates size against grid and raises ValueError on mismatch;
None clears (next access lazy-reallocates fresh).
- updateVisibility() now demotes 2->1 then promotes visible cells to 2.
- entity.at(x, y) returns grid.at(x, y) when VISIBLE, else None.
- Fog-of-war rendering in UIGridView and UIGrid reads the 3-state map.
- Removed: UIEntity::gridstate, ensureGridstate(), entity.gridstate getter,
UIGridPointState struct + PyUIGridPointStateType.
- Obsolete tests deleted (test_gridpointstate_point,
issue_265_gridpointstate_dangle); 4 new tests cover lazy allocation,
identity, serialization round-trip, size validation, and the
visible-subset-of-discovered invariant.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-17 23:04:27 -04:00
|
|
|
target is absolute - \f[V]loop\f[R]: If True, animation repeats from
|
|
|
|
|
start when it reaches the end (default False) - \f[V]callback\f[R]:
|
|
|
|
|
Optional callable invoked when animation completes (not called for
|
|
|
|
|
looping animations) - \f[V]conflict_mode\f[R]: `replace' (default),
|
2026-01-23 20:49:11 -05:00
|
|
|
`queue', or `error' if property already animating
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Returns:\f[R] Animation object for monitoring progress
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Raises:\f[R] ValueError: If property name is not valid for this
|
|
|
|
|
drawable type This is a convenience method that creates an Animation,
|
|
|
|
|
starts it, and adds it to the AnimationManager.
|
Replace UIEntity gridstate with DiscreteMap perspective_map; closes #294
Per-entity FOV memory moves from std::vector<UIGridPointState> (two-bool
visible/discovered pairs) to a 3-state DiscreteMap (0=UNKNOWN, 1=DISCOVERED,
2=VISIBLE), exposed as entity.perspective_map. The invariant
visible-subset-of-discovered becomes structural (single value per cell), and
the map is a live, serializable, first-class object rather than an implicit
internal array.
Changes:
- New DiscreteMap C++ class with shared ownership; PyDiscreteMapObject now
holds shared_ptr<DiscreteMap>. UIEntity holds the same shared_ptr.
- New mcrfpy.Perspective IntEnum (UNKNOWN/DISCOVERED/VISIBLE), modelled on
PyInputState.
- entity.perspective_map: lazy-allocated on first access with a grid;
setter validates size against grid and raises ValueError on mismatch;
None clears (next access lazy-reallocates fresh).
- updateVisibility() now demotes 2->1 then promotes visible cells to 2.
- entity.at(x, y) returns grid.at(x, y) when VISIBLE, else None.
- Fog-of-war rendering in UIGridView and UIGrid reads the 3-state map.
- Removed: UIEntity::gridstate, ensureGridstate(), entity.gridstate getter,
UIGridPointState struct + PyUIGridPointStateType.
- Obsolete tests deleted (test_gridpointstate_point,
issue_265_gridpointstate_dangle); 4 new tests cover lazy allocation,
identity, serialization round-trip, size validation, and the
visible-subset-of-discovered invariant.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-17 23:04:27 -04:00
|
|
|
.SS \f[V]move(dx, dy) or (delta) -> None\f[R]
|
2026-01-23 20:49:11 -05:00
|
|
|
.PP
|
Replace UIEntity gridstate with DiscreteMap perspective_map; closes #294
Per-entity FOV memory moves from std::vector<UIGridPointState> (two-bool
visible/discovered pairs) to a 3-state DiscreteMap (0=UNKNOWN, 1=DISCOVERED,
2=VISIBLE), exposed as entity.perspective_map. The invariant
visible-subset-of-discovered becomes structural (single value per cell), and
the map is a live, serializable, first-class object rather than an implicit
internal array.
Changes:
- New DiscreteMap C++ class with shared ownership; PyDiscreteMapObject now
holds shared_ptr<DiscreteMap>. UIEntity holds the same shared_ptr.
- New mcrfpy.Perspective IntEnum (UNKNOWN/DISCOVERED/VISIBLE), modelled on
PyInputState.
- entity.perspective_map: lazy-allocated on first access with a grid;
setter validates size against grid and raises ValueError on mismatch;
None clears (next access lazy-reallocates fresh).
- updateVisibility() now demotes 2->1 then promotes visible cells to 2.
- entity.at(x, y) returns grid.at(x, y) when VISIBLE, else None.
- Fog-of-war rendering in UIGridView and UIGrid reads the 3-state map.
- Removed: UIEntity::gridstate, ensureGridstate(), entity.gridstate getter,
UIGridPointState struct + PyUIGridPointStateType.
- Obsolete tests deleted (test_gridpointstate_point,
issue_265_gridpointstate_dangle); 4 new tests cover lazy allocation,
identity, serialization round-trip, size validation, and the
visible-subset-of-discovered invariant.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-17 23:04:27 -04:00
|
|
|
Move the element by a relative offset.
|
2025-10-30 21:20:50 -04:00
|
|
|
.PP
|
Replace UIEntity gridstate with DiscreteMap perspective_map; closes #294
Per-entity FOV memory moves from std::vector<UIGridPointState> (two-bool
visible/discovered pairs) to a 3-state DiscreteMap (0=UNKNOWN, 1=DISCOVERED,
2=VISIBLE), exposed as entity.perspective_map. The invariant
visible-subset-of-discovered becomes structural (single value per cell), and
the map is a live, serializable, first-class object rather than an implicit
internal array.
Changes:
- New DiscreteMap C++ class with shared ownership; PyDiscreteMapObject now
holds shared_ptr<DiscreteMap>. UIEntity holds the same shared_ptr.
- New mcrfpy.Perspective IntEnum (UNKNOWN/DISCOVERED/VISIBLE), modelled on
PyInputState.
- entity.perspective_map: lazy-allocated on first access with a grid;
setter validates size against grid and raises ValueError on mismatch;
None clears (next access lazy-reallocates fresh).
- updateVisibility() now demotes 2->1 then promotes visible cells to 2.
- entity.at(x, y) returns grid.at(x, y) when VISIBLE, else None.
- Fog-of-war rendering in UIGridView and UIGrid reads the 3-state map.
- Removed: UIEntity::gridstate, ensureGridstate(), entity.gridstate getter,
UIGridPointState struct + PyUIGridPointStateType.
- Obsolete tests deleted (test_gridpointstate_point,
issue_265_gridpointstate_dangle); 4 new tests cover lazy allocation,
identity, serialization round-trip, size validation, and the
visible-subset-of-discovered invariant.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-17 23:04:27 -04:00
|
|
|
Note:
|
2025-10-30 21:20:50 -04:00
|
|
|
.PP
|
Replace UIEntity gridstate with DiscreteMap perspective_map; closes #294
Per-entity FOV memory moves from std::vector<UIGridPointState> (two-bool
visible/discovered pairs) to a 3-state DiscreteMap (0=UNKNOWN, 1=DISCOVERED,
2=VISIBLE), exposed as entity.perspective_map. The invariant
visible-subset-of-discovered becomes structural (single value per cell), and
the map is a live, serializable, first-class object rather than an implicit
internal array.
Changes:
- New DiscreteMap C++ class with shared ownership; PyDiscreteMapObject now
holds shared_ptr<DiscreteMap>. UIEntity holds the same shared_ptr.
- New mcrfpy.Perspective IntEnum (UNKNOWN/DISCOVERED/VISIBLE), modelled on
PyInputState.
- entity.perspective_map: lazy-allocated on first access with a grid;
setter validates size against grid and raises ValueError on mismatch;
None clears (next access lazy-reallocates fresh).
- updateVisibility() now demotes 2->1 then promotes visible cells to 2.
- entity.at(x, y) returns grid.at(x, y) when VISIBLE, else None.
- Fog-of-war rendering in UIGridView and UIGrid reads the 3-state map.
- Removed: UIEntity::gridstate, ensureGridstate(), entity.gridstate getter,
UIGridPointState struct + PyUIGridPointStateType.
- Obsolete tests deleted (test_gridpointstate_point,
issue_265_gridpointstate_dangle); 4 new tests cover lazy allocation,
identity, serialization round-trip, size validation, and the
visible-subset-of-discovered invariant.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-17 23:04:27 -04:00
|
|
|
\f[B]Arguments:\f[R] - \f[V]dx\f[R]: Horizontal offset in pixels (or use
|
|
|
|
|
delta) - \f[V]dy\f[R]: Vertical offset in pixels (or use delta) -
|
|
|
|
|
\f[V]delta\f[R]: Offset as tuple, list, or Vector: (dx, dy)
|
|
|
|
|
.SS \f[V]realign() -> None\f[R]
|
2025-10-30 21:20:50 -04:00
|
|
|
.PP
|
Replace UIEntity gridstate with DiscreteMap perspective_map; closes #294
Per-entity FOV memory moves from std::vector<UIGridPointState> (two-bool
visible/discovered pairs) to a 3-state DiscreteMap (0=UNKNOWN, 1=DISCOVERED,
2=VISIBLE), exposed as entity.perspective_map. The invariant
visible-subset-of-discovered becomes structural (single value per cell), and
the map is a live, serializable, first-class object rather than an implicit
internal array.
Changes:
- New DiscreteMap C++ class with shared ownership; PyDiscreteMapObject now
holds shared_ptr<DiscreteMap>. UIEntity holds the same shared_ptr.
- New mcrfpy.Perspective IntEnum (UNKNOWN/DISCOVERED/VISIBLE), modelled on
PyInputState.
- entity.perspective_map: lazy-allocated on first access with a grid;
setter validates size against grid and raises ValueError on mismatch;
None clears (next access lazy-reallocates fresh).
- updateVisibility() now demotes 2->1 then promotes visible cells to 2.
- entity.at(x, y) returns grid.at(x, y) when VISIBLE, else None.
- Fog-of-war rendering in UIGridView and UIGrid reads the 3-state map.
- Removed: UIEntity::gridstate, ensureGridstate(), entity.gridstate getter,
UIGridPointState struct + PyUIGridPointStateType.
- Obsolete tests deleted (test_gridpointstate_point,
issue_265_gridpointstate_dangle); 4 new tests cover lazy allocation,
identity, serialization round-trip, size validation, and the
visible-subset-of-discovered invariant.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-17 23:04:27 -04:00
|
|
|
Reapply alignment relative to parent, useful for responsive layouts.
|
2025-10-30 21:20:50 -04:00
|
|
|
.PP
|
Replace UIEntity gridstate with DiscreteMap perspective_map; closes #294
Per-entity FOV memory moves from std::vector<UIGridPointState> (two-bool
visible/discovered pairs) to a 3-state DiscreteMap (0=UNKNOWN, 1=DISCOVERED,
2=VISIBLE), exposed as entity.perspective_map. The invariant
visible-subset-of-discovered becomes structural (single value per cell), and
the map is a live, serializable, first-class object rather than an implicit
internal array.
Changes:
- New DiscreteMap C++ class with shared ownership; PyDiscreteMapObject now
holds shared_ptr<DiscreteMap>. UIEntity holds the same shared_ptr.
- New mcrfpy.Perspective IntEnum (UNKNOWN/DISCOVERED/VISIBLE), modelled on
PyInputState.
- entity.perspective_map: lazy-allocated on first access with a grid;
setter validates size against grid and raises ValueError on mismatch;
None clears (next access lazy-reallocates fresh).
- updateVisibility() now demotes 2->1 then promotes visible cells to 2.
- entity.at(x, y) returns grid.at(x, y) when VISIBLE, else None.
- Fog-of-war rendering in UIGridView and UIGrid reads the 3-state map.
- Removed: UIEntity::gridstate, ensureGridstate(), entity.gridstate getter,
UIGridPointState struct + PyUIGridPointStateType.
- Obsolete tests deleted (test_gridpointstate_point,
issue_265_gridpointstate_dangle); 4 new tests cover lazy allocation,
identity, serialization round-trip, size validation, and the
visible-subset-of-discovered invariant.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-17 23:04:27 -04:00
|
|
|
Note: Call this to recalculate position after parent changes size.
|
|
|
|
|
For elements with align=None, this has no effect.
|
|
|
|
|
.SS \f[V]resize(width, height) or (size) -> None\f[R]
|
2025-10-30 21:20:50 -04:00
|
|
|
.PP
|
Replace UIEntity gridstate with DiscreteMap perspective_map; closes #294
Per-entity FOV memory moves from std::vector<UIGridPointState> (two-bool
visible/discovered pairs) to a 3-state DiscreteMap (0=UNKNOWN, 1=DISCOVERED,
2=VISIBLE), exposed as entity.perspective_map. The invariant
visible-subset-of-discovered becomes structural (single value per cell), and
the map is a live, serializable, first-class object rather than an implicit
internal array.
Changes:
- New DiscreteMap C++ class with shared ownership; PyDiscreteMapObject now
holds shared_ptr<DiscreteMap>. UIEntity holds the same shared_ptr.
- New mcrfpy.Perspective IntEnum (UNKNOWN/DISCOVERED/VISIBLE), modelled on
PyInputState.
- entity.perspective_map: lazy-allocated on first access with a grid;
setter validates size against grid and raises ValueError on mismatch;
None clears (next access lazy-reallocates fresh).
- updateVisibility() now demotes 2->1 then promotes visible cells to 2.
- entity.at(x, y) returns grid.at(x, y) when VISIBLE, else None.
- Fog-of-war rendering in UIGridView and UIGrid reads the 3-state map.
- Removed: UIEntity::gridstate, ensureGridstate(), entity.gridstate getter,
UIGridPointState struct + PyUIGridPointStateType.
- Obsolete tests deleted (test_gridpointstate_point,
issue_265_gridpointstate_dangle); 4 new tests cover lazy allocation,
identity, serialization round-trip, size validation, and the
visible-subset-of-discovered invariant.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-17 23:04:27 -04:00
|
|
|
Resize the element to new dimensions.
|
refactor: Rename click kwarg to on_click for API consistency (closes #126)
BREAKING CHANGE: Constructor keyword argument renamed from `click` to
`on_click` for all UIDrawable types (Frame, Caption, Sprite, Grid, Line,
Circle, Arc).
Before: Frame(pos=(0,0), size=(100,100), click=handler)
After: Frame(pos=(0,0), size=(100,100), on_click=handler)
The property name was already `on_click` - this makes the constructor
kwarg match, completing the callback naming standardization from #139.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-28 14:31:22 -05:00
|
|
|
.PP
|
Replace UIEntity gridstate with DiscreteMap perspective_map; closes #294
Per-entity FOV memory moves from std::vector<UIGridPointState> (two-bool
visible/discovered pairs) to a 3-state DiscreteMap (0=UNKNOWN, 1=DISCOVERED,
2=VISIBLE), exposed as entity.perspective_map. The invariant
visible-subset-of-discovered becomes structural (single value per cell), and
the map is a live, serializable, first-class object rather than an implicit
internal array.
Changes:
- New DiscreteMap C++ class with shared ownership; PyDiscreteMapObject now
holds shared_ptr<DiscreteMap>. UIEntity holds the same shared_ptr.
- New mcrfpy.Perspective IntEnum (UNKNOWN/DISCOVERED/VISIBLE), modelled on
PyInputState.
- entity.perspective_map: lazy-allocated on first access with a grid;
setter validates size against grid and raises ValueError on mismatch;
None clears (next access lazy-reallocates fresh).
- updateVisibility() now demotes 2->1 then promotes visible cells to 2.
- entity.at(x, y) returns grid.at(x, y) when VISIBLE, else None.
- Fog-of-war rendering in UIGridView and UIGrid reads the 3-state map.
- Removed: UIEntity::gridstate, ensureGridstate(), entity.gridstate getter,
UIGridPointState struct + PyUIGridPointStateType.
- Obsolete tests deleted (test_gridpointstate_point,
issue_265_gridpointstate_dangle); 4 new tests cover lazy allocation,
identity, serialization round-trip, size validation, and the
visible-subset-of-discovered invariant.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-17 23:04:27 -04:00
|
|
|
Note:
|
refactor: Rename click kwarg to on_click for API consistency (closes #126)
BREAKING CHANGE: Constructor keyword argument renamed from `click` to
`on_click` for all UIDrawable types (Frame, Caption, Sprite, Grid, Line,
Circle, Arc).
Before: Frame(pos=(0,0), size=(100,100), click=handler)
After: Frame(pos=(0,0), size=(100,100), on_click=handler)
The property name was already `on_click` - this makes the constructor
kwarg match, completing the callback naming standardization from #139.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-28 14:31:22 -05:00
|
|
|
.PP
|
Replace UIEntity gridstate with DiscreteMap perspective_map; closes #294
Per-entity FOV memory moves from std::vector<UIGridPointState> (two-bool
visible/discovered pairs) to a 3-state DiscreteMap (0=UNKNOWN, 1=DISCOVERED,
2=VISIBLE), exposed as entity.perspective_map. The invariant
visible-subset-of-discovered becomes structural (single value per cell), and
the map is a live, serializable, first-class object rather than an implicit
internal array.
Changes:
- New DiscreteMap C++ class with shared ownership; PyDiscreteMapObject now
holds shared_ptr<DiscreteMap>. UIEntity holds the same shared_ptr.
- New mcrfpy.Perspective IntEnum (UNKNOWN/DISCOVERED/VISIBLE), modelled on
PyInputState.
- entity.perspective_map: lazy-allocated on first access with a grid;
setter validates size against grid and raises ValueError on mismatch;
None clears (next access lazy-reallocates fresh).
- updateVisibility() now demotes 2->1 then promotes visible cells to 2.
- entity.at(x, y) returns grid.at(x, y) when VISIBLE, else None.
- Fog-of-war rendering in UIGridView and UIGrid reads the 3-state map.
- Removed: UIEntity::gridstate, ensureGridstate(), entity.gridstate getter,
UIGridPointState struct + PyUIGridPointStateType.
- Obsolete tests deleted (test_gridpointstate_point,
issue_265_gridpointstate_dangle); 4 new tests cover lazy allocation,
identity, serialization round-trip, size validation, and the
visible-subset-of-discovered invariant.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-17 23:04:27 -04:00
|
|
|
\f[B]Arguments:\f[R] - \f[V]width\f[R]: New width in pixels (or use
|
|
|
|
|
size) - \f[V]height\f[R]: New height in pixels (or use size) -
|
|
|
|
|
\f[V]size\f[R]: Size as tuple, list, or Vector: (width, height)
|
|
|
|
|
.SS GridView
|
refactor: Rename click kwarg to on_click for API consistency (closes #126)
BREAKING CHANGE: Constructor keyword argument renamed from `click` to
`on_click` for all UIDrawable types (Frame, Caption, Sprite, Grid, Line,
Circle, Arc).
Before: Frame(pos=(0,0), size=(100,100), click=handler)
After: Frame(pos=(0,0), size=(100,100), on_click=handler)
The property name was already `on_click` - this makes the constructor
kwarg match, completing the callback naming standardization from #139.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-28 14:31:22 -05:00
|
|
|
.PP
|
Replace UIEntity gridstate with DiscreteMap perspective_map; closes #294
Per-entity FOV memory moves from std::vector<UIGridPointState> (two-bool
visible/discovered pairs) to a 3-state DiscreteMap (0=UNKNOWN, 1=DISCOVERED,
2=VISIBLE), exposed as entity.perspective_map. The invariant
visible-subset-of-discovered becomes structural (single value per cell), and
the map is a live, serializable, first-class object rather than an implicit
internal array.
Changes:
- New DiscreteMap C++ class with shared ownership; PyDiscreteMapObject now
holds shared_ptr<DiscreteMap>. UIEntity holds the same shared_ptr.
- New mcrfpy.Perspective IntEnum (UNKNOWN/DISCOVERED/VISIBLE), modelled on
PyInputState.
- entity.perspective_map: lazy-allocated on first access with a grid;
setter validates size against grid and raises ValueError on mismatch;
None clears (next access lazy-reallocates fresh).
- updateVisibility() now demotes 2->1 then promotes visible cells to 2.
- entity.at(x, y) returns grid.at(x, y) when VISIBLE, else None.
- Fog-of-war rendering in UIGridView and UIGrid reads the 3-state map.
- Removed: UIEntity::gridstate, ensureGridstate(), entity.gridstate getter,
UIGridPointState struct + PyUIGridPointStateType.
- Obsolete tests deleted (test_gridpointstate_point,
issue_265_gridpointstate_dangle); 4 new tests cover lazy allocation,
identity, serialization round-trip, size validation, and the
visible-subset-of-discovered invariant.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-17 23:04:27 -04:00
|
|
|
\f[I]Inherits from: Drawable\f[R]
|
2025-10-30 21:20:50 -04:00
|
|
|
.PP
|
Replace UIEntity gridstate with DiscreteMap perspective_map; closes #294
Per-entity FOV memory moves from std::vector<UIGridPointState> (two-bool
visible/discovered pairs) to a 3-state DiscreteMap (0=UNKNOWN, 1=DISCOVERED,
2=VISIBLE), exposed as entity.perspective_map. The invariant
visible-subset-of-discovered becomes structural (single value per cell), and
the map is a live, serializable, first-class object rather than an implicit
internal array.
Changes:
- New DiscreteMap C++ class with shared ownership; PyDiscreteMapObject now
holds shared_ptr<DiscreteMap>. UIEntity holds the same shared_ptr.
- New mcrfpy.Perspective IntEnum (UNKNOWN/DISCOVERED/VISIBLE), modelled on
PyInputState.
- entity.perspective_map: lazy-allocated on first access with a grid;
setter validates size against grid and raises ValueError on mismatch;
None clears (next access lazy-reallocates fresh).
- updateVisibility() now demotes 2->1 then promotes visible cells to 2.
- entity.at(x, y) returns grid.at(x, y) when VISIBLE, else None.
- Fog-of-war rendering in UIGridView and UIGrid reads the 3-state map.
- Removed: UIEntity::gridstate, ensureGridstate(), entity.gridstate getter,
UIGridPointState struct + PyUIGridPointStateType.
- Obsolete tests deleted (test_gridpointstate_point,
issue_265_gridpointstate_dangle); 4 new tests cover lazy allocation,
identity, serialization round-trip, size validation, and the
visible-subset-of-discovered invariant.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-17 23:04:27 -04:00
|
|
|
Grid(grid_size=None, pos=None, size=None, texture=None, **kwargs)
|
2025-10-30 21:20:50 -04:00
|
|
|
.PP
|
Replace UIEntity gridstate with DiscreteMap perspective_map; closes #294
Per-entity FOV memory moves from std::vector<UIGridPointState> (two-bool
visible/discovered pairs) to a 3-state DiscreteMap (0=UNKNOWN, 1=DISCOVERED,
2=VISIBLE), exposed as entity.perspective_map. The invariant
visible-subset-of-discovered becomes structural (single value per cell), and
the map is a live, serializable, first-class object rather than an implicit
internal array.
Changes:
- New DiscreteMap C++ class with shared ownership; PyDiscreteMapObject now
holds shared_ptr<DiscreteMap>. UIEntity holds the same shared_ptr.
- New mcrfpy.Perspective IntEnum (UNKNOWN/DISCOVERED/VISIBLE), modelled on
PyInputState.
- entity.perspective_map: lazy-allocated on first access with a grid;
setter validates size against grid and raises ValueError on mismatch;
None clears (next access lazy-reallocates fresh).
- updateVisibility() now demotes 2->1 then promotes visible cells to 2.
- entity.at(x, y) returns grid.at(x, y) when VISIBLE, else None.
- Fog-of-war rendering in UIGridView and UIGrid reads the 3-state map.
- Removed: UIEntity::gridstate, ensureGridstate(), entity.gridstate getter,
UIGridPointState struct + PyUIGridPointStateType.
- Obsolete tests deleted (test_gridpointstate_point,
issue_265_gridpointstate_dangle); 4 new tests cover lazy allocation,
identity, serialization round-trip, size validation, and the
visible-subset-of-discovered invariant.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-17 23:04:27 -04:00
|
|
|
A grid-based UI element for tile-based rendering and entity management.
|
|
|
|
|
Creates and owns grid data (cells, entities, layers) with an integrated
|
|
|
|
|
rendering view (camera, zoom, perspective).
|
2025-10-30 21:20:50 -04:00
|
|
|
.PP
|
Replace UIEntity gridstate with DiscreteMap perspective_map; closes #294
Per-entity FOV memory moves from std::vector<UIGridPointState> (two-bool
visible/discovered pairs) to a 3-state DiscreteMap (0=UNKNOWN, 1=DISCOVERED,
2=VISIBLE), exposed as entity.perspective_map. The invariant
visible-subset-of-discovered becomes structural (single value per cell), and
the map is a live, serializable, first-class object rather than an implicit
internal array.
Changes:
- New DiscreteMap C++ class with shared ownership; PyDiscreteMapObject now
holds shared_ptr<DiscreteMap>. UIEntity holds the same shared_ptr.
- New mcrfpy.Perspective IntEnum (UNKNOWN/DISCOVERED/VISIBLE), modelled on
PyInputState.
- entity.perspective_map: lazy-allocated on first access with a grid;
setter validates size against grid and raises ValueError on mismatch;
None clears (next access lazy-reallocates fresh).
- updateVisibility() now demotes 2->1 then promotes visible cells to 2.
- entity.at(x, y) returns grid.at(x, y) when VISIBLE, else None.
- Fog-of-war rendering in UIGridView and UIGrid reads the 3-state map.
- Removed: UIEntity::gridstate, ensureGridstate(), entity.gridstate getter,
UIGridPointState struct + PyUIGridPointStateType.
- Obsolete tests deleted (test_gridpointstate_point,
issue_265_gridpointstate_dangle); 4 new tests cover lazy allocation,
identity, serialization round-trip, size validation, and the
visible-subset-of-discovered invariant.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-17 23:04:27 -04:00
|
|
|
Can also be constructed as a view of existing grid data:
|
|
|
|
|
Grid(grid=existing_grid, pos=\&..., size=\&...)
|
2025-10-30 21:20:50 -04:00
|
|
|
.PP
|
Replace UIEntity gridstate with DiscreteMap perspective_map; closes #294
Per-entity FOV memory moves from std::vector<UIGridPointState> (two-bool
visible/discovered pairs) to a 3-state DiscreteMap (0=UNKNOWN, 1=DISCOVERED,
2=VISIBLE), exposed as entity.perspective_map. The invariant
visible-subset-of-discovered becomes structural (single value per cell), and
the map is a live, serializable, first-class object rather than an implicit
internal array.
Changes:
- New DiscreteMap C++ class with shared ownership; PyDiscreteMapObject now
holds shared_ptr<DiscreteMap>. UIEntity holds the same shared_ptr.
- New mcrfpy.Perspective IntEnum (UNKNOWN/DISCOVERED/VISIBLE), modelled on
PyInputState.
- entity.perspective_map: lazy-allocated on first access with a grid;
setter validates size against grid and raises ValueError on mismatch;
None clears (next access lazy-reallocates fresh).
- updateVisibility() now demotes 2->1 then promotes visible cells to 2.
- entity.at(x, y) returns grid.at(x, y) when VISIBLE, else None.
- Fog-of-war rendering in UIGridView and UIGrid reads the 3-state map.
- Removed: UIEntity::gridstate, ensureGridstate(), entity.gridstate getter,
UIGridPointState struct + PyUIGridPointStateType.
- Obsolete tests deleted (test_gridpointstate_point,
issue_265_gridpointstate_dangle); 4 new tests cover lazy allocation,
identity, serialization round-trip, size validation, and the
visible-subset-of-discovered invariant.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-17 23:04:27 -04:00
|
|
|
Args: grid_size (tuple): Grid dimensions as (grid_w, grid_h).
|
|
|
|
|
Default: (2, 2) pos (tuple): Position as (x, y).
|
|
|
|
|
Default: (0, 0) size (tuple): Size as (w, h).
|
|
|
|
|
Default: auto-calculated texture (Texture): Tile texture atlas.
|
|
|
|
|
Default: default texture
|
2025-10-30 21:20:50 -04:00
|
|
|
.PP
|
Replace UIEntity gridstate with DiscreteMap perspective_map; closes #294
Per-entity FOV memory moves from std::vector<UIGridPointState> (two-bool
visible/discovered pairs) to a 3-state DiscreteMap (0=UNKNOWN, 1=DISCOVERED,
2=VISIBLE), exposed as entity.perspective_map. The invariant
visible-subset-of-discovered becomes structural (single value per cell), and
the map is a live, serializable, first-class object rather than an implicit
internal array.
Changes:
- New DiscreteMap C++ class with shared ownership; PyDiscreteMapObject now
holds shared_ptr<DiscreteMap>. UIEntity holds the same shared_ptr.
- New mcrfpy.Perspective IntEnum (UNKNOWN/DISCOVERED/VISIBLE), modelled on
PyInputState.
- entity.perspective_map: lazy-allocated on first access with a grid;
setter validates size against grid and raises ValueError on mismatch;
None clears (next access lazy-reallocates fresh).
- updateVisibility() now demotes 2->1 then promotes visible cells to 2.
- entity.at(x, y) returns grid.at(x, y) when VISIBLE, else None.
- Fog-of-war rendering in UIGridView and UIGrid reads the 3-state map.
- Removed: UIEntity::gridstate, ensureGridstate(), entity.gridstate getter,
UIGridPointState struct + PyUIGridPointStateType.
- Obsolete tests deleted (test_gridpointstate_point,
issue_265_gridpointstate_dangle); 4 new tests cover lazy allocation,
identity, serialization round-trip, size validation, and the
visible-subset-of-discovered invariant.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-17 23:04:27 -04:00
|
|
|
Keyword Args: grid (Grid): Existing Grid to view (creates view of shared
|
|
|
|
|
data).
|
|
|
|
|
fill_color (Color): Background fill color.
|
|
|
|
|
on_click (callable): Click event handler.
|
|
|
|
|
center_x, center_y (float): Camera center coordinates.
|
|
|
|
|
zoom (float): Zoom level.
|
|
|
|
|
Default: 1.0 visible (bool): Visibility.
|
|
|
|
|
Default: True opacity (float): Opacity (0.0-1.0).
|
|
|
|
|
Default: 1.0 z_index (int): Rendering order.
|
|
|
|
|
Default: 0 name (str): Element name.
|
|
|
|
|
layers (list): List of ColorLayer/TileLayer objects.
|
2025-10-30 21:20:50 -04:00
|
|
|
.PP
|
Replace UIEntity gridstate with DiscreteMap perspective_map; closes #294
Per-entity FOV memory moves from std::vector<UIGridPointState> (two-bool
visible/discovered pairs) to a 3-state DiscreteMap (0=UNKNOWN, 1=DISCOVERED,
2=VISIBLE), exposed as entity.perspective_map. The invariant
visible-subset-of-discovered becomes structural (single value per cell), and
the map is a live, serializable, first-class object rather than an implicit
internal array.
Changes:
- New DiscreteMap C++ class with shared ownership; PyDiscreteMapObject now
holds shared_ptr<DiscreteMap>. UIEntity holds the same shared_ptr.
- New mcrfpy.Perspective IntEnum (UNKNOWN/DISCOVERED/VISIBLE), modelled on
PyInputState.
- entity.perspective_map: lazy-allocated on first access with a grid;
setter validates size against grid and raises ValueError on mismatch;
None clears (next access lazy-reallocates fresh).
- updateVisibility() now demotes 2->1 then promotes visible cells to 2.
- entity.at(x, y) returns grid.at(x, y) when VISIBLE, else None.
- Fog-of-war rendering in UIGridView and UIGrid reads the 3-state map.
- Removed: UIEntity::gridstate, ensureGridstate(), entity.gridstate getter,
UIGridPointState struct + PyUIGridPointStateType.
- Obsolete tests deleted (test_gridpointstate_point,
issue_265_gridpointstate_dangle); 4 new tests cover lazy allocation,
identity, serialization round-trip, size validation, and the
visible-subset-of-discovered invariant.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-17 23:04:27 -04:00
|
|
|
\f[B]Properties:\f[R] - \f[V]align\f[R]: Alignment relative to parent
|
|
|
|
|
bounds (Alignment enum or None).
|
|
|
|
|
When set, position is automatically calculated when parent is assigned
|
|
|
|
|
or resized.
|
|
|
|
|
Set to None to disable alignment and use manual positioning.
|
F15: correct docstring accuracy from adversarial verify pass (#314)
Follow-up to the macro conversion: an adversarial verify pass (one agent per
file vs. the C++ implementation + stubs) found 62 content issues; the real
ones are fixed here.
Callbacks (centralized):
- on_click: receives (pos, MouseButton, InputState), not str (8 files).
- on_enter/on_exit/on_move (UIBase.h): hover passes only (pos) -- removed the
fictional button/action args.
- bounds/global_bounds (UIBase.h): mark (tuple, read-only).
Signatures / types:
- Grid.find_path: document heuristic + weight; get_dijkstra_map: document roots;
compute_fov: FOV | int = FOV.BASIC (not the C constant FOV_BASIC) + Returns;
at/is_in_fov: document (pos) and (x, y) call forms.
- get_metrics: document all 16 returned dict keys (was 8); bresenham: drop the
bogus '*' keyword-only separator.
- Nullable defaults typed correctly: BSP seed/size, ColorLayer draw_fov/
apply_perspective Color|None, Entity.visible_entities radius int=-1 (None is
rejected by the 'i' parser -> see #319).
- Type-token fixes: GridView.center -> Vector; GridView.texture -> (None,
read-only) (unimplemented, #318); GridPoint.grid_pos -> (tuple, read-only);
EntityCollection.find -> Entity | list[Entity] | None; extend RuntimeError;
UniformCollection.values -> list[float | tuple | None].
- automation: onScreen (x, y) form documented; scroll notes x is ignored (#317).
Also: correct stale AStarPath/DijkstraMap signatures in docs/api-audit-2026-04.md
(the bindings were right, the audit table was outdated). Rebaseline the API
snapshot golden and regenerate docs/stubs.
Code-level bugs surfaced by the pass are filed as #317, #318, #319.
Refs #314, #317, #318, #319
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 06:43:47 -04:00
|
|
|
- \f[V]bounds\f[R] \f[I](read-only)\f[R]: Axis-aligned bounding box
|
|
|
|
|
(tuple, read-only) as a (pos, size) pair of Vectors: (Vector(x, y),
|
|
|
|
|
Vector(width, height)).
|
Replace UIEntity gridstate with DiscreteMap perspective_map; closes #294
Per-entity FOV memory moves from std::vector<UIGridPointState> (two-bool
visible/discovered pairs) to a 3-state DiscreteMap (0=UNKNOWN, 1=DISCOVERED,
2=VISIBLE), exposed as entity.perspective_map. The invariant
visible-subset-of-discovered becomes structural (single value per cell), and
the map is a live, serializable, first-class object rather than an implicit
internal array.
Changes:
- New DiscreteMap C++ class with shared ownership; PyDiscreteMapObject now
holds shared_ptr<DiscreteMap>. UIEntity holds the same shared_ptr.
- New mcrfpy.Perspective IntEnum (UNKNOWN/DISCOVERED/VISIBLE), modelled on
PyInputState.
- entity.perspective_map: lazy-allocated on first access with a grid;
setter validates size against grid and raises ValueError on mismatch;
None clears (next access lazy-reallocates fresh).
- updateVisibility() now demotes 2->1 then promotes visible cells to 2.
- entity.at(x, y) returns grid.at(x, y) when VISIBLE, else None.
- Fog-of-war rendering in UIGridView and UIGrid reads the 3-state map.
- Removed: UIEntity::gridstate, ensureGridstate(), entity.gridstate getter,
UIGridPointState struct + PyUIGridPointStateType.
- Obsolete tests deleted (test_gridpointstate_point,
issue_265_gridpointstate_dangle); 4 new tests cover lazy allocation,
identity, serialization round-trip, size validation, and the
visible-subset-of-discovered invariant.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-17 23:04:27 -04:00
|
|
|
- \f[V]camera_rotation\f[R]: Rotation of grid contents around camera
|
F15: convert frozen binding docstrings to MCRF_* macros (#314)
Convert 289 raw PyMethodDef/PyGetSetDef docstring slots to MCRF_METHOD /
MCRF_PROPERTY across the 20 frozen (non-3D) binding files, bringing the
frozen surface to 100% macro compliance (check_frozen_docstrings.sh PASS).
Done via a one-agent-per-file workflow gated by validate_file_docstrings.sh
and per-wave build/doc-rebuild checks.
- Adds #include "McRFPy_Doc.h" where missing; fills the lone genuine doc
gap (UIGrid.at, which was MISSING a doc field in two arrays).
- McRFPy_Doc.h: comment documenting the MCRF_METHOD_DOC comma rule (the
trap that broke the GridLayers conversion mid-run).
- Rebaseline api_surface golden: property types now resolve to real types
instead of "Any" (e.g. grid_pos: Vector, on_cell_click: Callable | None),
and 11 properties correctly flip rw->ro now that their docstrings carry
"read-only" (collections, grid_size, hovered_cell, texture, view — all
verified against NULL setter slots).
- Regenerate docs/stubs/man page from the new docstrings.
Module-level functions use MCRF_METHOD(<name>, ...) (expands identically to
the intended MCRF_FUNCTION; the audit's compliance set is METHOD/PROPERTY).
Experimental 3D/Voxel bindings (src/3d/) remain exempt from the freeze.
Pre-existing failures unrelated to this change: test_animation_*,
test_constructor_comprehensive (reference the removed mcrfpy.Animation and
old constructor arity).
Refs #314
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 01:20:55 -04:00
|
|
|
center in degrees (float).
|
F15: correct docstring accuracy from adversarial verify pass (#314)
Follow-up to the macro conversion: an adversarial verify pass (one agent per
file vs. the C++ implementation + stubs) found 62 content issues; the real
ones are fixed here.
Callbacks (centralized):
- on_click: receives (pos, MouseButton, InputState), not str (8 files).
- on_enter/on_exit/on_move (UIBase.h): hover passes only (pos) -- removed the
fictional button/action args.
- bounds/global_bounds (UIBase.h): mark (tuple, read-only).
Signatures / types:
- Grid.find_path: document heuristic + weight; get_dijkstra_map: document roots;
compute_fov: FOV | int = FOV.BASIC (not the C constant FOV_BASIC) + Returns;
at/is_in_fov: document (pos) and (x, y) call forms.
- get_metrics: document all 16 returned dict keys (was 8); bresenham: drop the
bogus '*' keyword-only separator.
- Nullable defaults typed correctly: BSP seed/size, ColorLayer draw_fov/
apply_perspective Color|None, Entity.visible_entities radius int=-1 (None is
rejected by the 'i' parser -> see #319).
- Type-token fixes: GridView.center -> Vector; GridView.texture -> (None,
read-only) (unimplemented, #318); GridPoint.grid_pos -> (tuple, read-only);
EntityCollection.find -> Entity | list[Entity] | None; extend RuntimeError;
UniformCollection.values -> list[float | tuple | None].
- automation: onScreen (x, y) form documented; scroll notes x is ignored (#317).
Also: correct stale AStarPath/DijkstraMap signatures in docs/api-audit-2026-04.md
(the bindings were right, the audit table was outdated). Rebaseline the API
snapshot golden and regenerate docs/stubs.
Code-level bugs surfaced by the pass are filed as #317, #318, #319.
Refs #314, #317, #318, #319
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 06:43:47 -04:00
|
|
|
- \f[V]center\f[R]: Camera center point in pixel coordinates (Vector).
|
F15: convert frozen binding docstrings to MCRF_* macros (#314)
Convert 289 raw PyMethodDef/PyGetSetDef docstring slots to MCRF_METHOD /
MCRF_PROPERTY across the 20 frozen (non-3D) binding files, bringing the
frozen surface to 100% macro compliance (check_frozen_docstrings.sh PASS).
Done via a one-agent-per-file workflow gated by validate_file_docstrings.sh
and per-wave build/doc-rebuild checks.
- Adds #include "McRFPy_Doc.h" where missing; fills the lone genuine doc
gap (UIGrid.at, which was MISSING a doc field in two arrays).
- McRFPy_Doc.h: comment documenting the MCRF_METHOD_DOC comma rule (the
trap that broke the GridLayers conversion mid-run).
- Rebaseline api_surface golden: property types now resolve to real types
instead of "Any" (e.g. grid_pos: Vector, on_cell_click: Callable | None),
and 11 properties correctly flip rw->ro now that their docstrings carry
"read-only" (collections, grid_size, hovered_cell, texture, view — all
verified against NULL setter slots).
- Regenerate docs/stubs/man page from the new docstrings.
Module-level functions use MCRF_METHOD(<name>, ...) (expands identically to
the intended MCRF_FUNCTION; the audit's compliance set is METHOD/PROPERTY).
Experimental 3D/Voxel bindings (src/3d/) remain exempt from the freeze.
Pre-existing failures unrelated to this change: test_animation_*,
test_constructor_comprehensive (reference the removed mcrfpy.Animation and
old constructor arity).
Refs #314
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 01:20:55 -04:00
|
|
|
- \f[V]center_x\f[R]: Camera center X-coordinate in pixel space (float).
|
|
|
|
|
- \f[V]center_y\f[R]: Camera center Y-coordinate in pixel space (float).
|
|
|
|
|
- \f[V]fill_color\f[R]: Background fill color (Color).
|
|
|
|
|
Drawn behind all tiles and entities.
|
F15: correct docstring accuracy from adversarial verify pass (#314)
Follow-up to the macro conversion: an adversarial verify pass (one agent per
file vs. the C++ implementation + stubs) found 62 content issues; the real
ones are fixed here.
Callbacks (centralized):
- on_click: receives (pos, MouseButton, InputState), not str (8 files).
- on_enter/on_exit/on_move (UIBase.h): hover passes only (pos) -- removed the
fictional button/action args.
- bounds/global_bounds (UIBase.h): mark (tuple, read-only).
Signatures / types:
- Grid.find_path: document heuristic + weight; get_dijkstra_map: document roots;
compute_fov: FOV | int = FOV.BASIC (not the C constant FOV_BASIC) + Returns;
at/is_in_fov: document (pos) and (x, y) call forms.
- get_metrics: document all 16 returned dict keys (was 8); bresenham: drop the
bogus '*' keyword-only separator.
- Nullable defaults typed correctly: BSP seed/size, ColorLayer draw_fov/
apply_perspective Color|None, Entity.visible_entities radius int=-1 (None is
rejected by the 'i' parser -> see #319).
- Type-token fixes: GridView.center -> Vector; GridView.texture -> (None,
read-only) (unimplemented, #318); GridPoint.grid_pos -> (tuple, read-only);
EntityCollection.find -> Entity | list[Entity] | None; extend RuntimeError;
UniformCollection.values -> list[float | tuple | None].
- automation: onScreen (x, y) form documented; scroll notes x is ignored (#317).
Also: correct stale AStarPath/DijkstraMap signatures in docs/api-audit-2026-04.md
(the bindings were right, the audit table was outdated). Rebaseline the API
snapshot golden and regenerate docs/stubs.
Code-level bugs surfaced by the pass are filed as #317, #318, #319.
Refs #314, #317, #318, #319
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 06:43:47 -04:00
|
|
|
- \f[V]global_bounds\f[R] \f[I](read-only)\f[R]: Axis-aligned bounding
|
|
|
|
|
box in screen coordinates (tuple, read-only) as a (pos, size) pair of
|
|
|
|
|
Vectors: (Vector(x, y), Vector(width, height)).
|
Replace UIEntity gridstate with DiscreteMap perspective_map; closes #294
Per-entity FOV memory moves from std::vector<UIGridPointState> (two-bool
visible/discovered pairs) to a 3-state DiscreteMap (0=UNKNOWN, 1=DISCOVERED,
2=VISIBLE), exposed as entity.perspective_map. The invariant
visible-subset-of-discovered becomes structural (single value per cell), and
the map is a live, serializable, first-class object rather than an implicit
internal array.
Changes:
- New DiscreteMap C++ class with shared ownership; PyDiscreteMapObject now
holds shared_ptr<DiscreteMap>. UIEntity holds the same shared_ptr.
- New mcrfpy.Perspective IntEnum (UNKNOWN/DISCOVERED/VISIBLE), modelled on
PyInputState.
- entity.perspective_map: lazy-allocated on first access with a grid;
setter validates size against grid and raises ValueError on mismatch;
None clears (next access lazy-reallocates fresh).
- updateVisibility() now demotes 2->1 then promotes visible cells to 2.
- entity.at(x, y) returns grid.at(x, y) when VISIBLE, else None.
- Fog-of-war rendering in UIGridView and UIGrid reads the 3-state map.
- Removed: UIEntity::gridstate, ensureGridstate(), entity.gridstate getter,
UIGridPointState struct + PyUIGridPointStateType.
- Obsolete tests deleted (test_gridpointstate_point,
issue_265_gridpointstate_dangle); 4 new tests cover lazy allocation,
identity, serialization round-trip, size validation, and the
visible-subset-of-discovered invariant.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-17 23:04:27 -04:00
|
|
|
- \f[V]global_position\f[R] \f[I](read-only)\f[R]: Global screen
|
|
|
|
|
position (read-only).
|
|
|
|
|
Calculates absolute position by walking up the parent chain.
|
F15: convert frozen binding docstrings to MCRF_* macros (#314)
Convert 289 raw PyMethodDef/PyGetSetDef docstring slots to MCRF_METHOD /
MCRF_PROPERTY across the 20 frozen (non-3D) binding files, bringing the
frozen surface to 100% macro compliance (check_frozen_docstrings.sh PASS).
Done via a one-agent-per-file workflow gated by validate_file_docstrings.sh
and per-wave build/doc-rebuild checks.
- Adds #include "McRFPy_Doc.h" where missing; fills the lone genuine doc
gap (UIGrid.at, which was MISSING a doc field in two arrays).
- McRFPy_Doc.h: comment documenting the MCRF_METHOD_DOC comma rule (the
trap that broke the GridLayers conversion mid-run).
- Rebaseline api_surface golden: property types now resolve to real types
instead of "Any" (e.g. grid_pos: Vector, on_cell_click: Callable | None),
and 11 properties correctly flip rw->ro now that their docstrings carry
"read-only" (collections, grid_size, hovered_cell, texture, view — all
verified against NULL setter slots).
- Regenerate docs/stubs/man page from the new docstrings.
Module-level functions use MCRF_METHOD(<name>, ...) (expands identically to
the intended MCRF_FUNCTION; the audit's compliance set is METHOD/PROPERTY).
Experimental 3D/Voxel bindings (src/3d/) remain exempt from the freeze.
Pre-existing failures unrelated to this change: test_animation_*,
test_constructor_comprehensive (reference the removed mcrfpy.Animation and
old constructor arity).
Refs #314
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 01:20:55 -04:00
|
|
|
- \f[V]grid_data\f[R]: The underlying grid data object (Grid | None).
|
|
|
|
|
Used for multi-view scenarios where multiple GridViews share one Grid.
|
|
|
|
|
- \f[V]h\f[R]: Visible widget height (float).
|
|
|
|
|
- \f[V]horiz_margin\f[R]: Horizontal margin override (float, 0 = use
|
|
|
|
|
general margin).
|
Replace UIEntity gridstate with DiscreteMap perspective_map; closes #294
Per-entity FOV memory moves from std::vector<UIGridPointState> (two-bool
visible/discovered pairs) to a 3-state DiscreteMap (0=UNKNOWN, 1=DISCOVERED,
2=VISIBLE), exposed as entity.perspective_map. The invariant
visible-subset-of-discovered becomes structural (single value per cell), and
the map is a live, serializable, first-class object rather than an implicit
internal array.
Changes:
- New DiscreteMap C++ class with shared ownership; PyDiscreteMapObject now
holds shared_ptr<DiscreteMap>. UIEntity holds the same shared_ptr.
- New mcrfpy.Perspective IntEnum (UNKNOWN/DISCOVERED/VISIBLE), modelled on
PyInputState.
- entity.perspective_map: lazy-allocated on first access with a grid;
setter validates size against grid and raises ValueError on mismatch;
None clears (next access lazy-reallocates fresh).
- updateVisibility() now demotes 2->1 then promotes visible cells to 2.
- entity.at(x, y) returns grid.at(x, y) when VISIBLE, else None.
- Fog-of-war rendering in UIGridView and UIGrid reads the 3-state map.
- Removed: UIEntity::gridstate, ensureGridstate(), entity.gridstate getter,
UIGridPointState struct + PyUIGridPointStateType.
- Obsolete tests deleted (test_gridpointstate_point,
issue_265_gridpointstate_dangle); 4 new tests cover lazy allocation,
identity, serialization round-trip, size validation, and the
visible-subset-of-discovered invariant.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-17 23:04:27 -04:00
|
|
|
Invalid for vertically-centered alignments (TOP_CENTER, BOTTOM_CENTER,
|
|
|
|
|
CENTER).
|
|
|
|
|
- \f[V]hovered\f[R] \f[I](read-only)\f[R]: Whether mouse is currently
|
|
|
|
|
over this element (read-only).
|
|
|
|
|
Updated automatically by the engine during mouse movement.
|
|
|
|
|
- \f[V]margin\f[R]: General margin from edge when aligned (float).
|
|
|
|
|
Applied to both horizontal and vertical edges unless overridden.
|
|
|
|
|
Invalid for CENTER alignment (raises ValueError).
|
F15: convert frozen binding docstrings to MCRF_* macros (#314)
Convert 289 raw PyMethodDef/PyGetSetDef docstring slots to MCRF_METHOD /
MCRF_PROPERTY across the 20 frozen (non-3D) binding files, bringing the
frozen surface to 100% macro compliance (check_frozen_docstrings.sh PASS).
Done via a one-agent-per-file workflow gated by validate_file_docstrings.sh
and per-wave build/doc-rebuild checks.
- Adds #include "McRFPy_Doc.h" where missing; fills the lone genuine doc
gap (UIGrid.at, which was MISSING a doc field in two arrays).
- McRFPy_Doc.h: comment documenting the MCRF_METHOD_DOC comma rule (the
trap that broke the GridLayers conversion mid-run).
- Rebaseline api_surface golden: property types now resolve to real types
instead of "Any" (e.g. grid_pos: Vector, on_cell_click: Callable | None),
and 11 properties correctly flip rw->ro now that their docstrings carry
"read-only" (collections, grid_size, hovered_cell, texture, view — all
verified against NULL setter slots).
- Regenerate docs/stubs/man page from the new docstrings.
Module-level functions use MCRF_METHOD(<name>, ...) (expands identically to
the intended MCRF_FUNCTION; the audit's compliance set is METHOD/PROPERTY).
Experimental 3D/Voxel bindings (src/3d/) remain exempt from the freeze.
Pre-existing failures unrelated to this change: test_animation_*,
test_constructor_comprehensive (reference the removed mcrfpy.Animation and
old constructor arity).
Refs #314
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 01:20:55 -04:00
|
|
|
- \f[V]name\f[R]: Name for finding elements (str).
|
|
|
|
|
- \f[V]on_click\f[R]: Callable executed when object is clicked (Callable
|
|
|
|
|
| None).
|
Replace UIEntity gridstate with DiscreteMap perspective_map; closes #294
Per-entity FOV memory moves from std::vector<UIGridPointState> (two-bool
visible/discovered pairs) to a 3-state DiscreteMap (0=UNKNOWN, 1=DISCOVERED,
2=VISIBLE), exposed as entity.perspective_map. The invariant
visible-subset-of-discovered becomes structural (single value per cell), and
the map is a live, serializable, first-class object rather than an implicit
internal array.
Changes:
- New DiscreteMap C++ class with shared ownership; PyDiscreteMapObject now
holds shared_ptr<DiscreteMap>. UIEntity holds the same shared_ptr.
- New mcrfpy.Perspective IntEnum (UNKNOWN/DISCOVERED/VISIBLE), modelled on
PyInputState.
- entity.perspective_map: lazy-allocated on first access with a grid;
setter validates size against grid and raises ValueError on mismatch;
None clears (next access lazy-reallocates fresh).
- updateVisibility() now demotes 2->1 then promotes visible cells to 2.
- entity.at(x, y) returns grid.at(x, y) when VISIBLE, else None.
- Fog-of-war rendering in UIGridView and UIGrid reads the 3-state map.
- Removed: UIEntity::gridstate, ensureGridstate(), entity.gridstate getter,
UIGridPointState struct + PyUIGridPointStateType.
- Obsolete tests deleted (test_gridpointstate_point,
issue_265_gridpointstate_dangle); 4 new tests cover lazy allocation,
identity, serialization round-trip, size validation, and the
visible-subset-of-discovered invariant.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-17 23:04:27 -04:00
|
|
|
- \f[V]on_enter\f[R]: Callback for mouse enter events.
|
F15: correct docstring accuracy from adversarial verify pass (#314)
Follow-up to the macro conversion: an adversarial verify pass (one agent per
file vs. the C++ implementation + stubs) found 62 content issues; the real
ones are fixed here.
Callbacks (centralized):
- on_click: receives (pos, MouseButton, InputState), not str (8 files).
- on_enter/on_exit/on_move (UIBase.h): hover passes only (pos) -- removed the
fictional button/action args.
- bounds/global_bounds (UIBase.h): mark (tuple, read-only).
Signatures / types:
- Grid.find_path: document heuristic + weight; get_dijkstra_map: document roots;
compute_fov: FOV | int = FOV.BASIC (not the C constant FOV_BASIC) + Returns;
at/is_in_fov: document (pos) and (x, y) call forms.
- get_metrics: document all 16 returned dict keys (was 8); bresenham: drop the
bogus '*' keyword-only separator.
- Nullable defaults typed correctly: BSP seed/size, ColorLayer draw_fov/
apply_perspective Color|None, Entity.visible_entities radius int=-1 (None is
rejected by the 'i' parser -> see #319).
- Type-token fixes: GridView.center -> Vector; GridView.texture -> (None,
read-only) (unimplemented, #318); GridPoint.grid_pos -> (tuple, read-only);
EntityCollection.find -> Entity | list[Entity] | None; extend RuntimeError;
UniformCollection.values -> list[float | tuple | None].
- automation: onScreen (x, y) form documented; scroll notes x is ignored (#317).
Also: correct stale AStarPath/DijkstraMap signatures in docs/api-audit-2026-04.md
(the bindings were right, the audit table was outdated). Rebaseline the API
snapshot golden and regenerate docs/stubs.
Code-level bugs surfaced by the pass are filed as #317, #318, #319.
Refs #314, #317, #318, #319
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 06:43:47 -04:00
|
|
|
Called with (pos: Vector) when mouse enters this element\[cq]s bounds.
|
Replace UIEntity gridstate with DiscreteMap perspective_map; closes #294
Per-entity FOV memory moves from std::vector<UIGridPointState> (two-bool
visible/discovered pairs) to a 3-state DiscreteMap (0=UNKNOWN, 1=DISCOVERED,
2=VISIBLE), exposed as entity.perspective_map. The invariant
visible-subset-of-discovered becomes structural (single value per cell), and
the map is a live, serializable, first-class object rather than an implicit
internal array.
Changes:
- New DiscreteMap C++ class with shared ownership; PyDiscreteMapObject now
holds shared_ptr<DiscreteMap>. UIEntity holds the same shared_ptr.
- New mcrfpy.Perspective IntEnum (UNKNOWN/DISCOVERED/VISIBLE), modelled on
PyInputState.
- entity.perspective_map: lazy-allocated on first access with a grid;
setter validates size against grid and raises ValueError on mismatch;
None clears (next access lazy-reallocates fresh).
- updateVisibility() now demotes 2->1 then promotes visible cells to 2.
- entity.at(x, y) returns grid.at(x, y) when VISIBLE, else None.
- Fog-of-war rendering in UIGridView and UIGrid reads the 3-state map.
- Removed: UIEntity::gridstate, ensureGridstate(), entity.gridstate getter,
UIGridPointState struct + PyUIGridPointStateType.
- Obsolete tests deleted (test_gridpointstate_point,
issue_265_gridpointstate_dangle); 4 new tests cover lazy allocation,
identity, serialization round-trip, size validation, and the
visible-subset-of-discovered invariant.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-17 23:04:27 -04:00
|
|
|
- \f[V]on_exit\f[R]: Callback for mouse exit events.
|
F15: correct docstring accuracy from adversarial verify pass (#314)
Follow-up to the macro conversion: an adversarial verify pass (one agent per
file vs. the C++ implementation + stubs) found 62 content issues; the real
ones are fixed here.
Callbacks (centralized):
- on_click: receives (pos, MouseButton, InputState), not str (8 files).
- on_enter/on_exit/on_move (UIBase.h): hover passes only (pos) -- removed the
fictional button/action args.
- bounds/global_bounds (UIBase.h): mark (tuple, read-only).
Signatures / types:
- Grid.find_path: document heuristic + weight; get_dijkstra_map: document roots;
compute_fov: FOV | int = FOV.BASIC (not the C constant FOV_BASIC) + Returns;
at/is_in_fov: document (pos) and (x, y) call forms.
- get_metrics: document all 16 returned dict keys (was 8); bresenham: drop the
bogus '*' keyword-only separator.
- Nullable defaults typed correctly: BSP seed/size, ColorLayer draw_fov/
apply_perspective Color|None, Entity.visible_entities radius int=-1 (None is
rejected by the 'i' parser -> see #319).
- Type-token fixes: GridView.center -> Vector; GridView.texture -> (None,
read-only) (unimplemented, #318); GridPoint.grid_pos -> (tuple, read-only);
EntityCollection.find -> Entity | list[Entity] | None; extend RuntimeError;
UniformCollection.values -> list[float | tuple | None].
- automation: onScreen (x, y) form documented; scroll notes x is ignored (#317).
Also: correct stale AStarPath/DijkstraMap signatures in docs/api-audit-2026-04.md
(the bindings were right, the audit table was outdated). Rebaseline the API
snapshot golden and regenerate docs/stubs.
Code-level bugs surfaced by the pass are filed as #317, #318, #319.
Refs #314, #317, #318, #319
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 06:43:47 -04:00
|
|
|
Called with (pos: Vector) when mouse leaves this element\[cq]s bounds.
|
Replace UIEntity gridstate with DiscreteMap perspective_map; closes #294
Per-entity FOV memory moves from std::vector<UIGridPointState> (two-bool
visible/discovered pairs) to a 3-state DiscreteMap (0=UNKNOWN, 1=DISCOVERED,
2=VISIBLE), exposed as entity.perspective_map. The invariant
visible-subset-of-discovered becomes structural (single value per cell), and
the map is a live, serializable, first-class object rather than an implicit
internal array.
Changes:
- New DiscreteMap C++ class with shared ownership; PyDiscreteMapObject now
holds shared_ptr<DiscreteMap>. UIEntity holds the same shared_ptr.
- New mcrfpy.Perspective IntEnum (UNKNOWN/DISCOVERED/VISIBLE), modelled on
PyInputState.
- entity.perspective_map: lazy-allocated on first access with a grid;
setter validates size against grid and raises ValueError on mismatch;
None clears (next access lazy-reallocates fresh).
- updateVisibility() now demotes 2->1 then promotes visible cells to 2.
- entity.at(x, y) returns grid.at(x, y) when VISIBLE, else None.
- Fog-of-war rendering in UIGridView and UIGrid reads the 3-state map.
- Removed: UIEntity::gridstate, ensureGridstate(), entity.gridstate getter,
UIGridPointState struct + PyUIGridPointStateType.
- Obsolete tests deleted (test_gridpointstate_point,
issue_265_gridpointstate_dangle); 4 new tests cover lazy allocation,
identity, serialization round-trip, size validation, and the
visible-subset-of-discovered invariant.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-17 23:04:27 -04:00
|
|
|
- \f[V]on_move\f[R]: Callback for mouse movement within bounds.
|
F15: correct docstring accuracy from adversarial verify pass (#314)
Follow-up to the macro conversion: an adversarial verify pass (one agent per
file vs. the C++ implementation + stubs) found 62 content issues; the real
ones are fixed here.
Callbacks (centralized):
- on_click: receives (pos, MouseButton, InputState), not str (8 files).
- on_enter/on_exit/on_move (UIBase.h): hover passes only (pos) -- removed the
fictional button/action args.
- bounds/global_bounds (UIBase.h): mark (tuple, read-only).
Signatures / types:
- Grid.find_path: document heuristic + weight; get_dijkstra_map: document roots;
compute_fov: FOV | int = FOV.BASIC (not the C constant FOV_BASIC) + Returns;
at/is_in_fov: document (pos) and (x, y) call forms.
- get_metrics: document all 16 returned dict keys (was 8); bresenham: drop the
bogus '*' keyword-only separator.
- Nullable defaults typed correctly: BSP seed/size, ColorLayer draw_fov/
apply_perspective Color|None, Entity.visible_entities radius int=-1 (None is
rejected by the 'i' parser -> see #319).
- Type-token fixes: GridView.center -> Vector; GridView.texture -> (None,
read-only) (unimplemented, #318); GridPoint.grid_pos -> (tuple, read-only);
EntityCollection.find -> Entity | list[Entity] | None; extend RuntimeError;
UniformCollection.values -> list[float | tuple | None].
- automation: onScreen (x, y) form documented; scroll notes x is ignored (#317).
Also: correct stale AStarPath/DijkstraMap signatures in docs/api-audit-2026-04.md
(the bindings were right, the audit table was outdated). Rebaseline the API
snapshot golden and regenerate docs/stubs.
Code-level bugs surfaced by the pass are filed as #317, #318, #319.
Refs #314, #317, #318, #319
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 06:43:47 -04:00
|
|
|
Called with (pos: Vector) for each mouse movement while inside.
|
Replace UIEntity gridstate with DiscreteMap perspective_map; closes #294
Per-entity FOV memory moves from std::vector<UIGridPointState> (two-bool
visible/discovered pairs) to a 3-state DiscreteMap (0=UNKNOWN, 1=DISCOVERED,
2=VISIBLE), exposed as entity.perspective_map. The invariant
visible-subset-of-discovered becomes structural (single value per cell), and
the map is a live, serializable, first-class object rather than an implicit
internal array.
Changes:
- New DiscreteMap C++ class with shared ownership; PyDiscreteMapObject now
holds shared_ptr<DiscreteMap>. UIEntity holds the same shared_ptr.
- New mcrfpy.Perspective IntEnum (UNKNOWN/DISCOVERED/VISIBLE), modelled on
PyInputState.
- entity.perspective_map: lazy-allocated on first access with a grid;
setter validates size against grid and raises ValueError on mismatch;
None clears (next access lazy-reallocates fresh).
- updateVisibility() now demotes 2->1 then promotes visible cells to 2.
- entity.at(x, y) returns grid.at(x, y) when VISIBLE, else None.
- Fog-of-war rendering in UIGridView and UIGrid reads the 3-state map.
- Removed: UIEntity::gridstate, ensureGridstate(), entity.gridstate getter,
UIGridPointState struct + PyUIGridPointStateType.
- Obsolete tests deleted (test_gridpointstate_point,
issue_265_gridpointstate_dangle); 4 new tests cover lazy allocation,
identity, serialization round-trip, size validation, and the
visible-subset-of-discovered invariant.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-17 23:04:27 -04:00
|
|
|
Performance note: Called frequently during movement - keep handlers
|
|
|
|
|
fast.
|
|
|
|
|
- \f[V]opacity\f[R]: Opacity level (0.0 = transparent, 1.0 = opaque).
|
|
|
|
|
Automatically clamped to valid range [0.0, 1.0].
|
|
|
|
|
- \f[V]origin\f[R]: Transform origin as Vector (pivot point for
|
|
|
|
|
rotation).
|
|
|
|
|
Default (0,0) is top-left; set to (w/2, h/2) to rotate around center.
|
|
|
|
|
- \f[V]parent\f[R]: Parent drawable.
|
|
|
|
|
Get: Returns the parent Frame/Grid if nested, or None if at scene level.
|
|
|
|
|
Set: Assign a Frame/Grid to reparent, or None to remove from parent.
|
F15: convert frozen binding docstrings to MCRF_* macros (#314)
Convert 289 raw PyMethodDef/PyGetSetDef docstring slots to MCRF_METHOD /
MCRF_PROPERTY across the 20 frozen (non-3D) binding files, bringing the
frozen surface to 100% macro compliance (check_frozen_docstrings.sh PASS).
Done via a one-agent-per-file workflow gated by validate_file_docstrings.sh
and per-wave build/doc-rebuild checks.
- Adds #include "McRFPy_Doc.h" where missing; fills the lone genuine doc
gap (UIGrid.at, which was MISSING a doc field in two arrays).
- McRFPy_Doc.h: comment documenting the MCRF_METHOD_DOC comma rule (the
trap that broke the GridLayers conversion mid-run).
- Rebaseline api_surface golden: property types now resolve to real types
instead of "Any" (e.g. grid_pos: Vector, on_cell_click: Callable | None),
and 11 properties correctly flip rw->ro now that their docstrings carry
"read-only" (collections, grid_size, hovered_cell, texture, view — all
verified against NULL setter slots).
- Regenerate docs/stubs/man page from the new docstrings.
Module-level functions use MCRF_METHOD(<name>, ...) (expands identically to
the intended MCRF_FUNCTION; the audit's compliance set is METHOD/PROPERTY).
Experimental 3D/Voxel bindings (src/3d/) remain exempt from the freeze.
Pre-existing failures unrelated to this change: test_animation_*,
test_constructor_comprehensive (reference the removed mcrfpy.Animation and
old constructor arity).
Refs #314
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 01:20:55 -04:00
|
|
|
- \f[V]pos\f[R]: Position of the grid as Vector (Vector).
|
|
|
|
|
- \f[V]rotate_with_camera\f[R]: Whether to rotate visually with parent
|
Replace UIEntity gridstate with DiscreteMap perspective_map; closes #294
Per-entity FOV memory moves from std::vector<UIGridPointState> (two-bool
visible/discovered pairs) to a 3-state DiscreteMap (0=UNKNOWN, 1=DISCOVERED,
2=VISIBLE), exposed as entity.perspective_map. The invariant
visible-subset-of-discovered becomes structural (single value per cell), and
the map is a live, serializable, first-class object rather than an implicit
internal array.
Changes:
- New DiscreteMap C++ class with shared ownership; PyDiscreteMapObject now
holds shared_ptr<DiscreteMap>. UIEntity holds the same shared_ptr.
- New mcrfpy.Perspective IntEnum (UNKNOWN/DISCOVERED/VISIBLE), modelled on
PyInputState.
- entity.perspective_map: lazy-allocated on first access with a grid;
setter validates size against grid and raises ValueError on mismatch;
None clears (next access lazy-reallocates fresh).
- updateVisibility() now demotes 2->1 then promotes visible cells to 2.
- entity.at(x, y) returns grid.at(x, y) when VISIBLE, else None.
- Fog-of-war rendering in UIGridView and UIGrid reads the 3-state map.
- Removed: UIEntity::gridstate, ensureGridstate(), entity.gridstate getter,
UIGridPointState struct + PyUIGridPointStateType.
- Obsolete tests deleted (test_gridpointstate_point,
issue_265_gridpointstate_dangle); 4 new tests cover lazy allocation,
identity, serialization round-trip, size validation, and the
visible-subset-of-discovered invariant.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-17 23:04:27 -04:00
|
|
|
Grid\[cq]s camera_rotation (bool).
|
|
|
|
|
False (default): stay screen-aligned.
|
|
|
|
|
True: tilt with camera.
|
|
|
|
|
Only affects children of UIGrid; ignored for other parents.
|
|
|
|
|
- \f[V]rotation\f[R]: Rotation angle in degrees (clockwise around
|
|
|
|
|
origin).
|
|
|
|
|
Animatable property.
|
|
|
|
|
- \f[V]shader\f[R]: Shader for GPU visual effects (Shader or None).
|
|
|
|
|
When set, the drawable is rendered through the shader program.
|
|
|
|
|
Set to None to disable shader effects.
|
|
|
|
|
- \f[V]texture\f[R] \f[I](read-only)\f[R]: Texture used for tile
|
F15: correct docstring accuracy from adversarial verify pass (#314)
Follow-up to the macro conversion: an adversarial verify pass (one agent per
file vs. the C++ implementation + stubs) found 62 content issues; the real
ones are fixed here.
Callbacks (centralized):
- on_click: receives (pos, MouseButton, InputState), not str (8 files).
- on_enter/on_exit/on_move (UIBase.h): hover passes only (pos) -- removed the
fictional button/action args.
- bounds/global_bounds (UIBase.h): mark (tuple, read-only).
Signatures / types:
- Grid.find_path: document heuristic + weight; get_dijkstra_map: document roots;
compute_fov: FOV | int = FOV.BASIC (not the C constant FOV_BASIC) + Returns;
at/is_in_fov: document (pos) and (x, y) call forms.
- get_metrics: document all 16 returned dict keys (was 8); bresenham: drop the
bogus '*' keyword-only separator.
- Nullable defaults typed correctly: BSP seed/size, ColorLayer draw_fov/
apply_perspective Color|None, Entity.visible_entities radius int=-1 (None is
rejected by the 'i' parser -> see #319).
- Type-token fixes: GridView.center -> Vector; GridView.texture -> (None,
read-only) (unimplemented, #318); GridPoint.grid_pos -> (tuple, read-only);
EntityCollection.find -> Entity | list[Entity] | None; extend RuntimeError;
UniformCollection.values -> list[float | tuple | None].
- automation: onScreen (x, y) form documented; scroll notes x is ignored (#317).
Also: correct stale AStarPath/DijkstraMap signatures in docs/api-audit-2026-04.md
(the bindings were right, the audit table was outdated). Rebaseline the API
snapshot golden and regenerate docs/stubs.
Code-level bugs surfaced by the pass are filed as #317, #318, #319.
Refs #314, #317, #318, #319
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 06:43:47 -04:00
|
|
|
rendering (None, read-only).
|
|
|
|
|
Texture return is not yet implemented; always returns None.
|
Replace UIEntity gridstate with DiscreteMap perspective_map; closes #294
Per-entity FOV memory moves from std::vector<UIGridPointState> (two-bool
visible/discovered pairs) to a 3-state DiscreteMap (0=UNKNOWN, 1=DISCOVERED,
2=VISIBLE), exposed as entity.perspective_map. The invariant
visible-subset-of-discovered becomes structural (single value per cell), and
the map is a live, serializable, first-class object rather than an implicit
internal array.
Changes:
- New DiscreteMap C++ class with shared ownership; PyDiscreteMapObject now
holds shared_ptr<DiscreteMap>. UIEntity holds the same shared_ptr.
- New mcrfpy.Perspective IntEnum (UNKNOWN/DISCOVERED/VISIBLE), modelled on
PyInputState.
- entity.perspective_map: lazy-allocated on first access with a grid;
setter validates size against grid and raises ValueError on mismatch;
None clears (next access lazy-reallocates fresh).
- updateVisibility() now demotes 2->1 then promotes visible cells to 2.
- entity.at(x, y) returns grid.at(x, y) when VISIBLE, else None.
- Fog-of-war rendering in UIGridView and UIGrid reads the 3-state map.
- Removed: UIEntity::gridstate, ensureGridstate(), entity.gridstate getter,
UIGridPointState struct + PyUIGridPointStateType.
- Obsolete tests deleted (test_gridpointstate_point,
issue_265_gridpointstate_dangle); 4 new tests cover lazy allocation,
identity, serialization round-trip, size validation, and the
visible-subset-of-discovered invariant.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-17 23:04:27 -04:00
|
|
|
- \f[V]uniforms\f[R] \f[I](read-only)\f[R]: Collection of shader
|
|
|
|
|
uniforms (read-only access to collection).
|
|
|
|
|
Set uniforms via dict-like syntax: drawable.uniforms[`name'] = value.
|
|
|
|
|
Supports float, vec2/3/4 tuples, PropertyBinding, and CallableBinding.
|
|
|
|
|
- \f[V]vert_margin\f[R]: Vertical margin override (float, 0 = use
|
|
|
|
|
general margin).
|
|
|
|
|
Invalid for horizontally-centered alignments (CENTER_LEFT, CENTER_RIGHT,
|
|
|
|
|
CENTER).
|
|
|
|
|
- \f[V]visible\f[R]: Whether the object is visible (bool).
|
|
|
|
|
Invisible objects are not rendered or clickable.
|
F15: convert frozen binding docstrings to MCRF_* macros (#314)
Convert 289 raw PyMethodDef/PyGetSetDef docstring slots to MCRF_METHOD /
MCRF_PROPERTY across the 20 frozen (non-3D) binding files, bringing the
frozen surface to 100% macro compliance (check_frozen_docstrings.sh PASS).
Done via a one-agent-per-file workflow gated by validate_file_docstrings.sh
and per-wave build/doc-rebuild checks.
- Adds #include "McRFPy_Doc.h" where missing; fills the lone genuine doc
gap (UIGrid.at, which was MISSING a doc field in two arrays).
- McRFPy_Doc.h: comment documenting the MCRF_METHOD_DOC comma rule (the
trap that broke the GridLayers conversion mid-run).
- Rebaseline api_surface golden: property types now resolve to real types
instead of "Any" (e.g. grid_pos: Vector, on_cell_click: Callable | None),
and 11 properties correctly flip rw->ro now that their docstrings carry
"read-only" (collections, grid_size, hovered_cell, texture, view — all
verified against NULL setter slots).
- Regenerate docs/stubs/man page from the new docstrings.
Module-level functions use MCRF_METHOD(<name>, ...) (expands identically to
the intended MCRF_FUNCTION; the audit's compliance set is METHOD/PROPERTY).
Experimental 3D/Voxel bindings (src/3d/) remain exempt from the freeze.
Pre-existing failures unrelated to this change: test_animation_*,
test_constructor_comprehensive (reference the removed mcrfpy.Animation and
old constructor arity).
Refs #314
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 01:20:55 -04:00
|
|
|
- \f[V]w\f[R]: Visible widget width (float).
|
|
|
|
|
- \f[V]x\f[R]: Top-left corner X-coordinate (float).
|
|
|
|
|
- \f[V]y\f[R]: Top-left corner Y-coordinate (float).
|
|
|
|
|
- \f[V]z_index\f[R]: Z-order for rendering (int).
|
|
|
|
|
Lower values are rendered first.
|
|
|
|
|
- \f[V]zoom\f[R]: Zoom level for rendering (float).
|
|
|
|
|
Values greater than 1.0 magnify; less than 1.0 shrink.
|
2025-10-30 21:20:50 -04:00
|
|
|
.PP
|
Replace UIEntity gridstate with DiscreteMap perspective_map; closes #294
Per-entity FOV memory moves from std::vector<UIGridPointState> (two-bool
visible/discovered pairs) to a 3-state DiscreteMap (0=UNKNOWN, 1=DISCOVERED,
2=VISIBLE), exposed as entity.perspective_map. The invariant
visible-subset-of-discovered becomes structural (single value per cell), and
the map is a live, serializable, first-class object rather than an implicit
internal array.
Changes:
- New DiscreteMap C++ class with shared ownership; PyDiscreteMapObject now
holds shared_ptr<DiscreteMap>. UIEntity holds the same shared_ptr.
- New mcrfpy.Perspective IntEnum (UNKNOWN/DISCOVERED/VISIBLE), modelled on
PyInputState.
- entity.perspective_map: lazy-allocated on first access with a grid;
setter validates size against grid and raises ValueError on mismatch;
None clears (next access lazy-reallocates fresh).
- updateVisibility() now demotes 2->1 then promotes visible cells to 2.
- entity.at(x, y) returns grid.at(x, y) when VISIBLE, else None.
- Fog-of-war rendering in UIGridView and UIGrid reads the 3-state map.
- Removed: UIEntity::gridstate, ensureGridstate(), entity.gridstate getter,
UIGridPointState struct + PyUIGridPointStateType.
- Obsolete tests deleted (test_gridpointstate_point,
issue_265_gridpointstate_dangle); 4 new tests cover lazy allocation,
identity, serialization round-trip, size validation, and the
visible-subset-of-discovered invariant.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-17 23:04:27 -04:00
|
|
|
\f[B]Methods:\f[R]
|
|
|
|
|
.SS \f[V]animate(property: str, target: Any, duration: float, easing=None, delta=False, loop=False, callback=None, conflict_mode=\[aq]replace\[aq]) -> Animation\f[R]
|
2025-10-30 21:20:50 -04:00
|
|
|
.PP
|
Replace UIEntity gridstate with DiscreteMap perspective_map; closes #294
Per-entity FOV memory moves from std::vector<UIGridPointState> (two-bool
visible/discovered pairs) to a 3-state DiscreteMap (0=UNKNOWN, 1=DISCOVERED,
2=VISIBLE), exposed as entity.perspective_map. The invariant
visible-subset-of-discovered becomes structural (single value per cell), and
the map is a live, serializable, first-class object rather than an implicit
internal array.
Changes:
- New DiscreteMap C++ class with shared ownership; PyDiscreteMapObject now
holds shared_ptr<DiscreteMap>. UIEntity holds the same shared_ptr.
- New mcrfpy.Perspective IntEnum (UNKNOWN/DISCOVERED/VISIBLE), modelled on
PyInputState.
- entity.perspective_map: lazy-allocated on first access with a grid;
setter validates size against grid and raises ValueError on mismatch;
None clears (next access lazy-reallocates fresh).
- updateVisibility() now demotes 2->1 then promotes visible cells to 2.
- entity.at(x, y) returns grid.at(x, y) when VISIBLE, else None.
- Fog-of-war rendering in UIGridView and UIGrid reads the 3-state map.
- Removed: UIEntity::gridstate, ensureGridstate(), entity.gridstate getter,
UIGridPointState struct + PyUIGridPointStateType.
- Obsolete tests deleted (test_gridpointstate_point,
issue_265_gridpointstate_dangle); 4 new tests cover lazy allocation,
identity, serialization round-trip, size validation, and the
visible-subset-of-discovered invariant.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-17 23:04:27 -04:00
|
|
|
Create and start an animation on this drawable\[cq]s property.
|
2025-10-30 21:20:50 -04:00
|
|
|
.PP
|
Replace UIEntity gridstate with DiscreteMap perspective_map; closes #294
Per-entity FOV memory moves from std::vector<UIGridPointState> (two-bool
visible/discovered pairs) to a 3-state DiscreteMap (0=UNKNOWN, 1=DISCOVERED,
2=VISIBLE), exposed as entity.perspective_map. The invariant
visible-subset-of-discovered becomes structural (single value per cell), and
the map is a live, serializable, first-class object rather than an implicit
internal array.
Changes:
- New DiscreteMap C++ class with shared ownership; PyDiscreteMapObject now
holds shared_ptr<DiscreteMap>. UIEntity holds the same shared_ptr.
- New mcrfpy.Perspective IntEnum (UNKNOWN/DISCOVERED/VISIBLE), modelled on
PyInputState.
- entity.perspective_map: lazy-allocated on first access with a grid;
setter validates size against grid and raises ValueError on mismatch;
None clears (next access lazy-reallocates fresh).
- updateVisibility() now demotes 2->1 then promotes visible cells to 2.
- entity.at(x, y) returns grid.at(x, y) when VISIBLE, else None.
- Fog-of-war rendering in UIGridView and UIGrid reads the 3-state map.
- Removed: UIEntity::gridstate, ensureGridstate(), entity.gridstate getter,
UIGridPointState struct + PyUIGridPointStateType.
- Obsolete tests deleted (test_gridpointstate_point,
issue_265_gridpointstate_dangle); 4 new tests cover lazy allocation,
identity, serialization round-trip, size validation, and the
visible-subset-of-discovered invariant.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-17 23:04:27 -04:00
|
|
|
Note:
|
2025-12-02 09:21:43 -05:00
|
|
|
.PP
|
Replace UIEntity gridstate with DiscreteMap perspective_map; closes #294
Per-entity FOV memory moves from std::vector<UIGridPointState> (two-bool
visible/discovered pairs) to a 3-state DiscreteMap (0=UNKNOWN, 1=DISCOVERED,
2=VISIBLE), exposed as entity.perspective_map. The invariant
visible-subset-of-discovered becomes structural (single value per cell), and
the map is a live, serializable, first-class object rather than an implicit
internal array.
Changes:
- New DiscreteMap C++ class with shared ownership; PyDiscreteMapObject now
holds shared_ptr<DiscreteMap>. UIEntity holds the same shared_ptr.
- New mcrfpy.Perspective IntEnum (UNKNOWN/DISCOVERED/VISIBLE), modelled on
PyInputState.
- entity.perspective_map: lazy-allocated on first access with a grid;
setter validates size against grid and raises ValueError on mismatch;
None clears (next access lazy-reallocates fresh).
- updateVisibility() now demotes 2->1 then promotes visible cells to 2.
- entity.at(x, y) returns grid.at(x, y) when VISIBLE, else None.
- Fog-of-war rendering in UIGridView and UIGrid reads the 3-state map.
- Removed: UIEntity::gridstate, ensureGridstate(), entity.gridstate getter,
UIGridPointState struct + PyUIGridPointStateType.
- Obsolete tests deleted (test_gridpointstate_point,
issue_265_gridpointstate_dangle); 4 new tests cover lazy allocation,
identity, serialization round-trip, size validation, and the
visible-subset-of-discovered invariant.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-17 23:04:27 -04:00
|
|
|
\f[B]Arguments:\f[R] - \f[V]property\f[R]: Name of the property to
|
|
|
|
|
animate (e.g., `x', `fill_color', `opacity') - \f[V]target\f[R]: Target
|
|
|
|
|
value - type depends on property (float, tuple for color/vector, etc.)
|
|
|
|
|
- \f[V]duration\f[R]: Animation duration in seconds - \f[V]easing\f[R]:
|
|
|
|
|
Easing function: Easing enum value, string name, or None for linear -
|
|
|
|
|
\f[V]delta\f[R]: If True, target is relative to current value; if False,
|
|
|
|
|
target is absolute - \f[V]loop\f[R]: If True, animation repeats from
|
|
|
|
|
start when it reaches the end (default False) - \f[V]callback\f[R]:
|
|
|
|
|
Optional callable invoked when animation completes (not called for
|
|
|
|
|
looping animations) - \f[V]conflict_mode\f[R]: `replace' (default),
|
|
|
|
|
`queue', or `error' if property already animating
|
2025-12-02 09:21:43 -05:00
|
|
|
.PP
|
Replace UIEntity gridstate with DiscreteMap perspective_map; closes #294
Per-entity FOV memory moves from std::vector<UIGridPointState> (two-bool
visible/discovered pairs) to a 3-state DiscreteMap (0=UNKNOWN, 1=DISCOVERED,
2=VISIBLE), exposed as entity.perspective_map. The invariant
visible-subset-of-discovered becomes structural (single value per cell), and
the map is a live, serializable, first-class object rather than an implicit
internal array.
Changes:
- New DiscreteMap C++ class with shared ownership; PyDiscreteMapObject now
holds shared_ptr<DiscreteMap>. UIEntity holds the same shared_ptr.
- New mcrfpy.Perspective IntEnum (UNKNOWN/DISCOVERED/VISIBLE), modelled on
PyInputState.
- entity.perspective_map: lazy-allocated on first access with a grid;
setter validates size against grid and raises ValueError on mismatch;
None clears (next access lazy-reallocates fresh).
- updateVisibility() now demotes 2->1 then promotes visible cells to 2.
- entity.at(x, y) returns grid.at(x, y) when VISIBLE, else None.
- Fog-of-war rendering in UIGridView and UIGrid reads the 3-state map.
- Removed: UIEntity::gridstate, ensureGridstate(), entity.gridstate getter,
UIGridPointState struct + PyUIGridPointStateType.
- Obsolete tests deleted (test_gridpointstate_point,
issue_265_gridpointstate_dangle); 4 new tests cover lazy allocation,
identity, serialization round-trip, size validation, and the
visible-subset-of-discovered invariant.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-17 23:04:27 -04:00
|
|
|
\f[B]Returns:\f[R] Animation object for monitoring progress
|
2025-12-02 09:21:43 -05:00
|
|
|
.PP
|
Replace UIEntity gridstate with DiscreteMap perspective_map; closes #294
Per-entity FOV memory moves from std::vector<UIGridPointState> (two-bool
visible/discovered pairs) to a 3-state DiscreteMap (0=UNKNOWN, 1=DISCOVERED,
2=VISIBLE), exposed as entity.perspective_map. The invariant
visible-subset-of-discovered becomes structural (single value per cell), and
the map is a live, serializable, first-class object rather than an implicit
internal array.
Changes:
- New DiscreteMap C++ class with shared ownership; PyDiscreteMapObject now
holds shared_ptr<DiscreteMap>. UIEntity holds the same shared_ptr.
- New mcrfpy.Perspective IntEnum (UNKNOWN/DISCOVERED/VISIBLE), modelled on
PyInputState.
- entity.perspective_map: lazy-allocated on first access with a grid;
setter validates size against grid and raises ValueError on mismatch;
None clears (next access lazy-reallocates fresh).
- updateVisibility() now demotes 2->1 then promotes visible cells to 2.
- entity.at(x, y) returns grid.at(x, y) when VISIBLE, else None.
- Fog-of-war rendering in UIGridView and UIGrid reads the 3-state map.
- Removed: UIEntity::gridstate, ensureGridstate(), entity.gridstate getter,
UIGridPointState struct + PyUIGridPointStateType.
- Obsolete tests deleted (test_gridpointstate_point,
issue_265_gridpointstate_dangle); 4 new tests cover lazy allocation,
identity, serialization round-trip, size validation, and the
visible-subset-of-discovered invariant.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-17 23:04:27 -04:00
|
|
|
\f[B]Raises:\f[R] ValueError: If property name is not valid for this
|
|
|
|
|
drawable type This is a convenience method that creates an Animation,
|
|
|
|
|
starts it, and adds it to the AnimationManager.
|
2026-01-23 20:49:11 -05:00
|
|
|
.SS \f[V]move(dx, dy) or (delta) -> None\f[R]
|
2025-10-30 21:20:50 -04:00
|
|
|
.PP
|
|
|
|
|
Move the element by a relative offset.
|
|
|
|
|
.PP
|
|
|
|
|
Note:
|
|
|
|
|
.PP
|
2026-01-23 20:49:11 -05:00
|
|
|
\f[B]Arguments:\f[R] - \f[V]dx\f[R]: Horizontal offset in pixels (or use
|
|
|
|
|
delta) - \f[V]dy\f[R]: Vertical offset in pixels (or use delta) -
|
|
|
|
|
\f[V]delta\f[R]: Offset as tuple, list, or Vector: (dx, dy)
|
|
|
|
|
.SS \f[V]realign() -> None\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Reapply alignment relative to parent, useful for responsive layouts.
|
|
|
|
|
.PP
|
|
|
|
|
Note: Call this to recalculate position after parent changes size.
|
|
|
|
|
For elements with align=None, this has no effect.
|
|
|
|
|
.SS \f[V]resize(width, height) or (size) -> None\f[R]
|
2025-10-30 21:20:50 -04:00
|
|
|
.PP
|
|
|
|
|
Resize the element to new dimensions.
|
|
|
|
|
.PP
|
|
|
|
|
Note:
|
|
|
|
|
.PP
|
2026-01-23 20:49:11 -05:00
|
|
|
\f[B]Arguments:\f[R] - \f[V]width\f[R]: New width in pixels (or use
|
|
|
|
|
size) - \f[V]height\f[R]: New height in pixels (or use size) -
|
|
|
|
|
\f[V]size\f[R]: Size as tuple, list, or Vector: (width, height)
|
|
|
|
|
.SS HeightMap
|
2025-10-30 21:20:50 -04:00
|
|
|
.PP
|
2026-01-23 20:49:11 -05:00
|
|
|
HeightMap(size: tuple[int, int], fill: float = 0.0)
|
2025-10-30 21:20:50 -04:00
|
|
|
.PP
|
2026-01-23 20:49:11 -05:00
|
|
|
A 2D grid of float values for procedural generation.
|
2025-10-30 21:20:50 -04:00
|
|
|
.PP
|
2026-01-23 20:49:11 -05:00
|
|
|
HeightMap is the universal canvas for procedural generation.
|
|
|
|
|
It stores float values that can be manipulated, combined, and applied to
|
|
|
|
|
Grid and Layer objects.
|
2025-10-30 21:20:50 -04:00
|
|
|
.PP
|
2026-01-23 20:49:11 -05:00
|
|
|
Args: size: (width, height) dimensions of the heightmap.
|
|
|
|
|
Immutable after creation.
|
|
|
|
|
fill: Initial value for all cells.
|
|
|
|
|
Default 0.0.
|
2025-12-02 09:21:43 -05:00
|
|
|
.PP
|
2026-01-23 20:49:11 -05:00
|
|
|
Example: hmap = mcrfpy.HeightMap((100, 100))
|
|
|
|
|
hmap.fill(0.5).scale(2.0).clamp(0.0, 1.0) value = hmap[5, 5] # Subscript
|
|
|
|
|
shorthand for get()
|
2025-12-02 09:21:43 -05:00
|
|
|
.PP
|
2026-01-23 20:49:11 -05:00
|
|
|
\f[B]Properties:\f[R] - \f[V]size\f[R] \f[I](read-only)\f[R]: Dimensions
|
|
|
|
|
(width, height) of the heightmap.
|
|
|
|
|
Read-only.
|
2025-12-02 09:21:43 -05:00
|
|
|
.PP
|
2026-01-23 20:49:11 -05:00
|
|
|
\f[B]Methods:\f[R]
|
|
|
|
|
.SS \f[V]add(other: HeightMap, *, pos=None, source_pos=None, size=None) -> HeightMap\f[R]
|
2025-12-02 09:21:43 -05:00
|
|
|
.PP
|
2026-01-23 20:49:11 -05:00
|
|
|
Add another heightmap\[cq]s values to this one in the specified region.
|
2025-12-02 09:21:43 -05:00
|
|
|
.PP
|
2026-01-23 20:49:11 -05:00
|
|
|
\f[B]Arguments:\f[R] - \f[V]other\f[R]: HeightMap to add values from -
|
|
|
|
|
\f[V]pos\f[R]: Destination start (x, y) in self (default: (0, 0)) -
|
|
|
|
|
\f[V]source_pos\f[R]: Source start (x, y) in other (default: (0, 0)) -
|
|
|
|
|
\f[V]size\f[R]: Region (width, height) (default: max overlapping area)
|
2025-12-02 09:21:43 -05:00
|
|
|
.PP
|
2026-01-23 20:49:11 -05:00
|
|
|
\f[B]Returns:\f[R] HeightMap: self, for method chaining
|
|
|
|
|
.SS \f[V]add_bsp(bsp: BSP, *, pos=None, select: str = \[aq]leaves\[aq], nodes: list = None, shrink: int = 0, value: float = 1.0) -> HeightMap\f[R]
|
2025-12-02 09:21:43 -05:00
|
|
|
.PP
|
2026-01-23 20:49:11 -05:00
|
|
|
Add BSP node regions to heightmap.
|
|
|
|
|
More efficient than creating intermediate HeightMap.
|
2025-12-02 09:21:43 -05:00
|
|
|
.PP
|
2026-01-23 20:49:11 -05:00
|
|
|
\f[B]Arguments:\f[R] - \f[V]bsp\f[R]: BSP tree to sample from -
|
|
|
|
|
\f[V]pos\f[R]: Where BSP origin maps to in HeightMap (default:
|
|
|
|
|
origin-relative like to_heightmap) - \f[V]select\f[R]: `leaves', `all',
|
|
|
|
|
or `internal' (default: `leaves') - \f[V]nodes\f[R]: Override: specific
|
|
|
|
|
BSPNodes only (default: None) - \f[V]shrink\f[R]: Pixels to shrink from
|
|
|
|
|
node bounds (default: 0) - \f[V]value\f[R]: Value to add inside regions
|
|
|
|
|
(default: 1.0)
|
2025-12-02 09:21:43 -05:00
|
|
|
.PP
|
2026-01-23 20:49:11 -05:00
|
|
|
\f[B]Returns:\f[R] HeightMap: self, for method chaining
|
|
|
|
|
.SS \f[V]add_constant(value: float, *, pos=None, size=None) -> HeightMap\f[R]
|
2025-12-02 09:21:43 -05:00
|
|
|
.PP
|
2026-01-23 20:49:11 -05:00
|
|
|
Add a constant value to cells in region.
|
2025-12-02 09:21:43 -05:00
|
|
|
.PP
|
2026-01-23 20:49:11 -05:00
|
|
|
\f[B]Arguments:\f[R] - \f[V]value\f[R]: The value to add to each cell -
|
|
|
|
|
\f[V]pos\f[R]: Region start (x, y) in destination (default: (0, 0)) -
|
|
|
|
|
\f[V]size\f[R]: Region (width, height) (default: remaining space)
|
2025-12-02 09:21:43 -05:00
|
|
|
.PP
|
2026-01-23 20:49:11 -05:00
|
|
|
\f[B]Returns:\f[R] HeightMap: self, for method chaining
|
|
|
|
|
.SS \f[V]add_hill(center, radius: float, height: float) -> HeightMap\f[R]
|
2025-12-02 09:21:43 -05:00
|
|
|
.PP
|
2026-01-23 20:49:11 -05:00
|
|
|
Add a smooth hill at the specified position.
|
2025-12-02 09:21:43 -05:00
|
|
|
.PP
|
2026-01-23 20:49:11 -05:00
|
|
|
\f[B]Arguments:\f[R] - \f[V]center\f[R]: Center position as (x, y)
|
|
|
|
|
tuple, list, or Vector - \f[V]radius\f[R]: Radius of the hill in cells -
|
|
|
|
|
\f[V]height\f[R]: Height of the hill peak
|
2025-12-02 09:21:43 -05:00
|
|
|
.PP
|
2026-01-23 20:49:11 -05:00
|
|
|
\f[B]Returns:\f[R] HeightMap: self, for method chaining
|
|
|
|
|
.SS \f[V]add_noise(source: NoiseSource, world_origin: tuple = (0.0, 0.0), world_size: tuple = None, mode: str = \[aq]fbm\[aq], octaves: int = 4, scale: float = 1.0) -> HeightMap\f[R]
|
2025-12-02 09:21:43 -05:00
|
|
|
.PP
|
2026-01-23 20:49:11 -05:00
|
|
|
Sample noise and add to current values.
|
|
|
|
|
More efficient than creating intermediate HeightMap.
|
2025-10-30 21:20:50 -04:00
|
|
|
.PP
|
2026-01-23 20:49:11 -05:00
|
|
|
\f[B]Arguments:\f[R] - \f[V]source\f[R]: 2D NoiseSource to sample from -
|
|
|
|
|
\f[V]world_origin\f[R]: World coordinates of top-left (default: (0, 0))
|
|
|
|
|
- \f[V]world_size\f[R]: World area to sample (default: HeightMap size) -
|
|
|
|
|
\f[V]mode\f[R]: `flat', `fbm', or `turbulence' (default: `fbm') -
|
|
|
|
|
\f[V]octaves\f[R]: Octaves for fbm/turbulence (default: 4) -
|
|
|
|
|
\f[V]scale\f[R]: Multiplier for sampled values (default: 1.0)
|
2025-10-30 21:20:50 -04:00
|
|
|
.PP
|
2026-01-23 20:49:11 -05:00
|
|
|
\f[B]Returns:\f[R] HeightMap: self, for method chaining
|
|
|
|
|
.SS \f[V]add_voronoi(num_points: int, coefficients: tuple = (1.0, -0.5), seed: int = None) -> HeightMap\f[R]
|
2025-10-30 21:20:50 -04:00
|
|
|
.PP
|
2026-01-23 20:49:11 -05:00
|
|
|
Add Voronoi-based terrain features.
|
2025-10-30 21:20:50 -04:00
|
|
|
.PP
|
2026-01-23 20:49:11 -05:00
|
|
|
\f[B]Arguments:\f[R] - \f[V]num_points\f[R]: Number of Voronoi seed
|
|
|
|
|
points - \f[V]coefficients\f[R]: Coefficients for distance calculations
|
|
|
|
|
(default: (1.0, -0.5)) - \f[V]seed\f[R]: Random seed (None for random)
|
2025-10-30 21:20:50 -04:00
|
|
|
.PP
|
2026-01-23 20:49:11 -05:00
|
|
|
\f[B]Returns:\f[R] HeightMap: self, for method chaining
|
|
|
|
|
.SS \f[V]clamp(min: float = 0.0, max: float = 1.0, *, pos=None, size=None) -> HeightMap\f[R]
|
2025-10-30 21:20:50 -04:00
|
|
|
.PP
|
2026-01-23 20:49:11 -05:00
|
|
|
Clamp values in region to the specified range.
|
2025-10-30 21:20:50 -04:00
|
|
|
.PP
|
2026-01-23 20:49:11 -05:00
|
|
|
\f[B]Arguments:\f[R] - \f[V]min\f[R]: Minimum value (default 0.0) -
|
|
|
|
|
\f[V]max\f[R]: Maximum value (default 1.0) - \f[V]pos\f[R]: Region start
|
|
|
|
|
(x, y) in destination (default: (0, 0)) - \f[V]size\f[R]: Region (width,
|
|
|
|
|
height) (default: remaining space)
|
2025-10-30 21:20:50 -04:00
|
|
|
.PP
|
2026-01-23 20:49:11 -05:00
|
|
|
\f[B]Returns:\f[R] HeightMap: self, for method chaining
|
|
|
|
|
.SS \f[V]clear() -> HeightMap\f[R]
|
2025-10-30 21:20:50 -04:00
|
|
|
.PP
|
2026-01-23 20:49:11 -05:00
|
|
|
Set all cells to 0.0.
|
|
|
|
|
Equivalent to fill(0.0).
|
2025-10-30 21:20:50 -04:00
|
|
|
.PP
|
2026-01-23 20:49:11 -05:00
|
|
|
\f[B]Returns:\f[R] HeightMap: self, for method chaining
|
|
|
|
|
.SS \f[V]copy_from(other: HeightMap, *, pos=None, source_pos=None, size=None) -> HeightMap\f[R]
|
2025-10-30 21:20:50 -04:00
|
|
|
.PP
|
2026-01-23 20:49:11 -05:00
|
|
|
Copy values from another heightmap into the specified region.
|
2025-10-30 21:20:50 -04:00
|
|
|
.PP
|
2026-01-23 20:49:11 -05:00
|
|
|
\f[B]Arguments:\f[R] - \f[V]other\f[R]: HeightMap to copy from -
|
|
|
|
|
\f[V]pos\f[R]: Destination start (x, y) in self (default: (0, 0)) -
|
|
|
|
|
\f[V]source_pos\f[R]: Source start (x, y) in other (default: (0, 0)) -
|
|
|
|
|
\f[V]size\f[R]: Region (width, height) (default: max overlapping area)
|
2025-10-30 21:20:50 -04:00
|
|
|
.PP
|
2026-01-23 20:49:11 -05:00
|
|
|
\f[B]Returns:\f[R] HeightMap: self, for method chaining
|
|
|
|
|
.SS \f[V]count_in_range(range: tuple[float, float]) -> int\f[R]
|
2025-10-30 21:20:50 -04:00
|
|
|
.PP
|
2026-01-23 20:49:11 -05:00
|
|
|
Count cells with values in the specified range (inclusive).
|
2025-10-30 21:20:50 -04:00
|
|
|
.PP
|
2026-01-23 20:49:11 -05:00
|
|
|
\f[B]Arguments:\f[R] - \f[V]range\f[R]: Value range as (min, max) tuple
|
|
|
|
|
or list
|
2025-10-30 21:20:50 -04:00
|
|
|
.PP
|
2026-01-23 20:49:11 -05:00
|
|
|
\f[B]Returns:\f[R] int: Number of cells with values in range
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Raises:\f[R] ValueError: min > max
|
|
|
|
|
.SS \f[V]dig_bezier(points: tuple, start_radius: float, end_radius: float, start_height: float, end_height: float) -> HeightMap\f[R]
|
2025-10-30 21:20:50 -04:00
|
|
|
.PP
|
2026-01-23 20:49:11 -05:00
|
|
|
Construct a canal along a cubic Bezier curve with specified heights.
|
2025-10-30 21:20:50 -04:00
|
|
|
.PP
|
|
|
|
|
Note:
|
|
|
|
|
.PP
|
2026-01-23 20:49:11 -05:00
|
|
|
\f[B]Arguments:\f[R] - \f[V]points\f[R]: Four control points as
|
|
|
|
|
((x0,y0), (x1,y1), (x2,y2), (x3,y3)) - \f[V]start_radius\f[R]: Radius at
|
|
|
|
|
start of path - \f[V]end_radius\f[R]: Radius at end of path -
|
|
|
|
|
\f[V]start_height\f[R]: Target height at start of path -
|
|
|
|
|
\f[V]end_height\f[R]: Target height at end of path
|
2025-10-30 21:20:50 -04:00
|
|
|
.PP
|
2026-01-23 20:49:11 -05:00
|
|
|
\f[B]Returns:\f[R] HeightMap: self, for method chaining Only lowers
|
|
|
|
|
cells; cells below target height are unchanged
|
|
|
|
|
.SS \f[V]dig_hill(center, radius: float, target_height: float) -> HeightMap\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Construct a pit or crater with the specified center height.
|
2025-10-30 21:20:50 -04:00
|
|
|
.PP
|
|
|
|
|
Note:
|
|
|
|
|
.PP
|
2026-01-23 20:49:11 -05:00
|
|
|
\f[B]Arguments:\f[R] - \f[V]center\f[R]: Center position as (x, y)
|
|
|
|
|
tuple, list, or Vector - \f[V]radius\f[R]: Radius of the crater in cells
|
|
|
|
|
- \f[V]target_height\f[R]: Height at the center of the pit
|
2025-10-30 21:20:50 -04:00
|
|
|
.PP
|
2026-01-23 20:49:11 -05:00
|
|
|
\f[B]Returns:\f[R] HeightMap: self, for method chaining Only lowers
|
|
|
|
|
cells; cells below target_height are unchanged
|
|
|
|
|
.SS \f[V]fill(value: float, *, pos=None, size=None) -> HeightMap\f[R]
|
2025-10-30 21:20:50 -04:00
|
|
|
.PP
|
2026-01-23 20:49:11 -05:00
|
|
|
Set cells in region to the specified value.
|
2025-10-30 21:20:50 -04:00
|
|
|
.PP
|
2026-01-23 20:49:11 -05:00
|
|
|
\f[B]Arguments:\f[R] - \f[V]value\f[R]: The value to set -
|
|
|
|
|
\f[V]pos\f[R]: Region start (x, y) in destination (default: (0, 0)) -
|
|
|
|
|
\f[V]size\f[R]: Region (width, height) to fill (default: remaining
|
|
|
|
|
space)
|
2025-10-30 21:20:50 -04:00
|
|
|
.PP
|
2026-01-23 20:49:11 -05:00
|
|
|
\f[B]Returns:\f[R] HeightMap: self, for method chaining
|
|
|
|
|
.SS \f[V]get(x, y) or (pos) -> float\f[R]
|
2025-10-30 21:20:50 -04:00
|
|
|
.PP
|
2026-01-23 20:49:11 -05:00
|
|
|
Get the height value at integer coordinates.
|
2025-12-02 09:21:43 -05:00
|
|
|
.PP
|
2026-01-23 20:49:11 -05:00
|
|
|
\f[B]Returns:\f[R] float: Height value at that position
|
2025-12-02 09:21:43 -05:00
|
|
|
.PP
|
2026-01-23 20:49:11 -05:00
|
|
|
\f[B]Raises:\f[R] IndexError: Position is out of bounds
|
|
|
|
|
.SS \f[V]get_interpolated(x, y) or (pos) -> float\f[R]
|
2025-12-02 09:21:43 -05:00
|
|
|
.PP
|
2026-01-23 20:49:11 -05:00
|
|
|
Get interpolated height value at non-integer coordinates.
|
2025-12-02 09:21:43 -05:00
|
|
|
.PP
|
2026-01-23 20:49:11 -05:00
|
|
|
\f[B]Returns:\f[R] float: Bilinearly interpolated height value
|
|
|
|
|
.SS \f[V]get_normal(x, y, water_level=0.0) or (pos, water_level=0.0) -> tuple[float, float, float]\f[R]
|
2025-12-02 09:21:43 -05:00
|
|
|
.PP
|
2026-01-23 20:49:11 -05:00
|
|
|
Get the normal vector at given coordinates for lighting calculations.
|
2025-12-02 09:21:43 -05:00
|
|
|
.PP
|
2026-01-23 20:49:11 -05:00
|
|
|
\f[B]Arguments:\f[R] - \f[V]water_level\f[R]: Water level below which
|
|
|
|
|
terrain is considered flat (default 0.0)
|
2025-12-02 09:21:43 -05:00
|
|
|
.PP
|
2026-01-23 20:49:11 -05:00
|
|
|
\f[B]Returns:\f[R] tuple[float, float, float]: Normal vector (nx, ny,
|
|
|
|
|
nz)
|
|
|
|
|
.SS \f[V]get_slope(x, y) or (pos) -> float\f[R]
|
2025-12-02 09:21:43 -05:00
|
|
|
.PP
|
2026-01-23 20:49:11 -05:00
|
|
|
Get the slope at integer coordinates, from 0 (flat) to pi/2 (vertical).
|
refactor: Rename click kwarg to on_click for API consistency (closes #126)
BREAKING CHANGE: Constructor keyword argument renamed from `click` to
`on_click` for all UIDrawable types (Frame, Caption, Sprite, Grid, Line,
Circle, Arc).
Before: Frame(pos=(0,0), size=(100,100), click=handler)
After: Frame(pos=(0,0), size=(100,100), on_click=handler)
The property name was already `on_click` - this makes the constructor
kwarg match, completing the callback naming standardization from #139.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-28 14:31:22 -05:00
|
|
|
.PP
|
2026-01-23 20:49:11 -05:00
|
|
|
\f[B]Returns:\f[R] float: Slope angle in radians (0 to pi/2)
|
2025-12-02 09:21:43 -05:00
|
|
|
.PP
|
2026-01-23 20:49:11 -05:00
|
|
|
\f[B]Raises:\f[R] IndexError: Position is out of bounds
|
|
|
|
|
.SS \f[V]inverse() -> HeightMap\f[R]
|
2025-10-30 21:20:50 -04:00
|
|
|
.PP
|
2026-01-23 20:49:11 -05:00
|
|
|
Return NEW HeightMap with (1.0 - value) for each cell.
|
2025-10-30 21:20:50 -04:00
|
|
|
.PP
|
2026-01-23 20:49:11 -05:00
|
|
|
\f[B]Returns:\f[R] HeightMap: New inverted HeightMap (original is
|
|
|
|
|
unchanged)
|
|
|
|
|
.SS \f[V]lerp(other: HeightMap, t: float, *, pos=None, source_pos=None, size=None) -> HeightMap\f[R]
|
2025-10-30 21:20:50 -04:00
|
|
|
.PP
|
2026-01-23 20:49:11 -05:00
|
|
|
Linear interpolation between this and another heightmap in the specified
|
|
|
|
|
region.
|
2025-10-30 21:20:50 -04:00
|
|
|
.PP
|
2026-01-23 20:49:11 -05:00
|
|
|
\f[B]Arguments:\f[R] - \f[V]other\f[R]: HeightMap to interpolate towards
|
|
|
|
|
- \f[V]t\f[R]: Interpolation factor (0.0 = this, 1.0 = other) -
|
|
|
|
|
\f[V]pos\f[R]: Destination start (x, y) in self (default: (0, 0)) -
|
|
|
|
|
\f[V]source_pos\f[R]: Source start (x, y) in other (default: (0, 0)) -
|
|
|
|
|
\f[V]size\f[R]: Region (width, height) (default: max overlapping area)
|
2025-10-30 21:20:50 -04:00
|
|
|
.PP
|
2026-01-23 20:49:11 -05:00
|
|
|
\f[B]Returns:\f[R] HeightMap: self, for method chaining
|
|
|
|
|
.SS \f[V]max(other: HeightMap, *, pos=None, source_pos=None, size=None) -> HeightMap\f[R]
|
2025-10-30 21:20:50 -04:00
|
|
|
.PP
|
2026-01-23 20:49:11 -05:00
|
|
|
Set each cell in region to the maximum of this and another heightmap.
|
2025-10-30 21:20:50 -04:00
|
|
|
.PP
|
2026-01-23 20:49:11 -05:00
|
|
|
\f[B]Arguments:\f[R] - \f[V]other\f[R]: HeightMap to compare with -
|
|
|
|
|
\f[V]pos\f[R]: Destination start (x, y) in self (default: (0, 0)) -
|
|
|
|
|
\f[V]source_pos\f[R]: Source start (x, y) in other (default: (0, 0)) -
|
|
|
|
|
\f[V]size\f[R]: Region (width, height) (default: max overlapping area)
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Returns:\f[R] HeightMap: self, for method chaining
|
|
|
|
|
.SS \f[V]mid_point_displacement(roughness: float = 0.5, seed: int = None) -> HeightMap\f[R]
|
2025-10-30 21:20:50 -04:00
|
|
|
.PP
|
2026-01-23 20:49:11 -05:00
|
|
|
Generate terrain using midpoint displacement algorithm (diamond-square).
|
2025-10-30 21:20:50 -04:00
|
|
|
.PP
|
|
|
|
|
Note:
|
|
|
|
|
.PP
|
2026-01-23 20:49:11 -05:00
|
|
|
\f[B]Arguments:\f[R] - \f[V]roughness\f[R]: Controls terrain roughness
|
|
|
|
|
(0.0-1.0, default 0.5) - \f[V]seed\f[R]: Random seed (None for random)
|
2025-10-30 21:20:50 -04:00
|
|
|
.PP
|
2026-01-23 20:49:11 -05:00
|
|
|
\f[B]Returns:\f[R] HeightMap: self, for method chaining Works best with
|
|
|
|
|
power-of-2+1 dimensions (e.g., 65x65, 129x129)
|
|
|
|
|
.SS \f[V]min(other: HeightMap, *, pos=None, source_pos=None, size=None) -> HeightMap\f[R]
|
2025-10-30 21:20:50 -04:00
|
|
|
.PP
|
2026-01-23 20:49:11 -05:00
|
|
|
Set each cell in region to the minimum of this and another heightmap.
|
2025-10-30 21:20:50 -04:00
|
|
|
.PP
|
2026-01-23 20:49:11 -05:00
|
|
|
\f[B]Arguments:\f[R] - \f[V]other\f[R]: HeightMap to compare with -
|
|
|
|
|
\f[V]pos\f[R]: Destination start (x, y) in self (default: (0, 0)) -
|
|
|
|
|
\f[V]source_pos\f[R]: Source start (x, y) in other (default: (0, 0)) -
|
|
|
|
|
\f[V]size\f[R]: Region (width, height) (default: max overlapping area)
|
2025-10-30 21:20:50 -04:00
|
|
|
.PP
|
2026-01-23 20:49:11 -05:00
|
|
|
\f[B]Returns:\f[R] HeightMap: self, for method chaining
|
|
|
|
|
.SS \f[V]min_max() -> tuple[float, float]\f[R]
|
2025-10-30 21:20:50 -04:00
|
|
|
.PP
|
2026-01-23 20:49:11 -05:00
|
|
|
Get the minimum and maximum height values in the map.
|
2025-10-30 21:20:50 -04:00
|
|
|
.PP
|
2026-01-23 20:49:11 -05:00
|
|
|
\f[B]Returns:\f[R] tuple[float, float]: (min_value, max_value)
|
|
|
|
|
.SS \f[V]multiply(other: HeightMap, *, pos=None, source_pos=None, size=None) -> HeightMap\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Multiply this heightmap by another in the specified region (useful for
|
|
|
|
|
masking).
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Arguments:\f[R] - \f[V]other\f[R]: HeightMap to multiply by -
|
|
|
|
|
\f[V]pos\f[R]: Destination start (x, y) in self (default: (0, 0)) -
|
|
|
|
|
\f[V]source_pos\f[R]: Source start (x, y) in other (default: (0, 0)) -
|
|
|
|
|
\f[V]size\f[R]: Region (width, height) (default: max overlapping area)
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Returns:\f[R] HeightMap: self, for method chaining
|
|
|
|
|
.SS \f[V]multiply_bsp(bsp: BSP, *, pos=None, select: str = \[aq]leaves\[aq], nodes: list = None, shrink: int = 0, value: float = 1.0) -> HeightMap\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Multiply by BSP regions.
|
|
|
|
|
Effectively masks the heightmap to node interiors.
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Arguments:\f[R] - \f[V]bsp\f[R]: BSP tree to sample from -
|
|
|
|
|
\f[V]pos\f[R]: Where BSP origin maps to in HeightMap (default:
|
|
|
|
|
origin-relative like to_heightmap) - \f[V]select\f[R]: `leaves', `all',
|
|
|
|
|
or `internal' (default: `leaves') - \f[V]nodes\f[R]: Override: specific
|
|
|
|
|
BSPNodes only (default: None) - \f[V]shrink\f[R]: Pixels to shrink from
|
|
|
|
|
node bounds (default: 0) - \f[V]value\f[R]: Value to multiply inside
|
|
|
|
|
regions (default: 1.0)
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Returns:\f[R] HeightMap: self, for method chaining
|
|
|
|
|
.SS \f[V]multiply_noise(source: NoiseSource, world_origin: tuple = (0.0, 0.0), world_size: tuple = None, mode: str = \[aq]fbm\[aq], octaves: int = 4, scale: float = 1.0) -> HeightMap\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Sample noise and multiply with current values.
|
|
|
|
|
Useful for applying noise-based masks.
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Arguments:\f[R] - \f[V]source\f[R]: 2D NoiseSource to sample from -
|
|
|
|
|
\f[V]world_origin\f[R]: World coordinates of top-left (default: (0, 0))
|
|
|
|
|
- \f[V]world_size\f[R]: World area to sample (default: HeightMap size) -
|
|
|
|
|
\f[V]mode\f[R]: `flat', `fbm', or `turbulence' (default: `fbm') -
|
|
|
|
|
\f[V]octaves\f[R]: Octaves for fbm/turbulence (default: 4) -
|
|
|
|
|
\f[V]scale\f[R]: Multiplier for sampled values (default: 1.0)
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Returns:\f[R] HeightMap: self, for method chaining
|
|
|
|
|
.SS \f[V]normalize(min: float = 0.0, max: float = 1.0, *, pos=None, size=None) -> HeightMap\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Linearly rescale values in region.
|
|
|
|
|
Current min becomes new min, current max becomes new max.
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Arguments:\f[R] - \f[V]min\f[R]: Target minimum value (default 0.0)
|
|
|
|
|
- \f[V]max\f[R]: Target maximum value (default 1.0) - \f[V]pos\f[R]:
|
|
|
|
|
Region start (x, y) in destination (default: (0, 0)) - \f[V]size\f[R]:
|
|
|
|
|
Region (width, height) (default: remaining space)
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Returns:\f[R] HeightMap: self, for method chaining
|
|
|
|
|
.SS \f[V]rain_erosion(drops: int, erosion: float = 0.1, sedimentation: float = 0.05, seed: int = None) -> HeightMap\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Simulate rain erosion on the terrain.
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Arguments:\f[R] - \f[V]drops\f[R]: Number of rain drops to simulate
|
|
|
|
|
- \f[V]erosion\f[R]: Erosion coefficient (default 0.1) -
|
|
|
|
|
\f[V]sedimentation\f[R]: Sedimentation coefficient (default 0.05) -
|
|
|
|
|
\f[V]seed\f[R]: Random seed (None for random)
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Returns:\f[R] HeightMap: self, for method chaining
|
|
|
|
|
.SS \f[V]scale(factor: float, *, pos=None, size=None) -> HeightMap\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Multiply cells in region by a factor.
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Arguments:\f[R] - \f[V]factor\f[R]: The multiplier for each cell -
|
|
|
|
|
\f[V]pos\f[R]: Region start (x, y) in destination (default: (0, 0)) -
|
|
|
|
|
\f[V]size\f[R]: Region (width, height) (default: remaining space)
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Returns:\f[R] HeightMap: self, for method chaining
|
|
|
|
|
.SS \f[V]smooth(iterations: int = 1) -> HeightMap\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Smooth the heightmap by averaging neighboring cells.
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Arguments:\f[R] - \f[V]iterations\f[R]: Number of smoothing passes
|
|
|
|
|
(default 1)
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Returns:\f[R] HeightMap: self, for method chaining
|
|
|
|
|
.SS \f[V]sparse_kernel(weights: dict[tuple[int, int], float]) -> HeightMap\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Apply sparse convolution kernel, returning a NEW HeightMap with results.
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Arguments:\f[R] - \f[V]weights\f[R]: Dict mapping (dx, dy) offsets
|
|
|
|
|
to weight values
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Returns:\f[R] HeightMap: new heightmap with convolution result
|
|
|
|
|
.SS \f[V]sparse_kernel_from(source: HeightMap, weights: dict[tuple[int, int], float]) -> None\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Apply sparse convolution from source heightmap into self (for reusing
|
|
|
|
|
destination buffers).
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Arguments:\f[R] - \f[V]source\f[R]: Source HeightMap to convolve
|
|
|
|
|
from - \f[V]weights\f[R]: Dict mapping (dx, dy) offsets to weight values
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Returns:\f[R] None
|
|
|
|
|
.SS \f[V]subtract(other: HeightMap, *, pos=None, source_pos=None, size=None) -> HeightMap\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Subtract another heightmap\[cq]s values from this one in the specified
|
|
|
|
|
region.
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Arguments:\f[R] - \f[V]other\f[R]: HeightMap to subtract values
|
|
|
|
|
from - \f[V]pos\f[R]: Destination start (x, y) in self (default: (0, 0))
|
|
|
|
|
- \f[V]source_pos\f[R]: Source start (x, y) in other (default: (0, 0)) -
|
|
|
|
|
\f[V]size\f[R]: Region (width, height) (default: max overlapping area)
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Returns:\f[R] HeightMap: self, for method chaining
|
|
|
|
|
.SS \f[V]threshold(range: tuple[float, float]) -> HeightMap\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Return NEW HeightMap with original values where in range, 0.0 elsewhere.
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Arguments:\f[R] - \f[V]range\f[R]: Value range as (min, max) tuple
|
|
|
|
|
or list, inclusive
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Returns:\f[R] HeightMap: New HeightMap (original is unchanged)
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Raises:\f[R] ValueError: min > max
|
|
|
|
|
.SS \f[V]threshold_binary(range: tuple[float, float], value: float = 1.0) -> HeightMap\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Return NEW HeightMap with uniform value where in range, 0.0 elsewhere.
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Arguments:\f[R] - \f[V]range\f[R]: Value range as (min, max) tuple
|
|
|
|
|
or list, inclusive - \f[V]value\f[R]: Value to set for cells in range
|
|
|
|
|
(default 1.0)
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Returns:\f[R] HeightMap: New HeightMap (original is unchanged)
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Raises:\f[R] ValueError: min > max
|
2026-04-18 13:35:26 -04:00
|
|
|
.SS Heuristic
|
|
|
|
|
.PP
|
|
|
|
|
\f[I]Inherits from: IntEnum\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Built-in A* heuristic function selector.
|
|
|
|
|
.PP
|
|
|
|
|
Values: EUCLIDEAN: sqrt((dx)\[ha]2 + (dy)\[ha]2).
|
|
|
|
|
Admissible, default.
|
|
|
|
|
MANHATTAN: |dx| + |dy|.
|
|
|
|
|
Admissible on 4-connected grids.
|
|
|
|
|
CHEBYSHEV: max(|dx|, |dy|).
|
|
|
|
|
Admissible on 8-connected (diag=1).
|
|
|
|
|
DIAGONAL: Octile distance.
|
|
|
|
|
Admissible on 8-connected (diag=sqrt(2)).
|
|
|
|
|
ZERO: Always returns 0.
|
|
|
|
|
A* degenerates to Dijkstra.
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Properties:\f[R] - \f[V]denominator\f[R]: the denominator of a
|
|
|
|
|
rational number in lowest terms - \f[V]imag\f[R]: the imaginary part of
|
|
|
|
|
a complex number - \f[V]numerator\f[R]: the numerator of a rational
|
|
|
|
|
number in lowest terms - \f[V]real\f[R]: the real part of a complex
|
|
|
|
|
number
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Methods:\f[R]
|
|
|
|
|
.SS \f[V]as_integer_ratio(...)\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Return a pair of integers, whose ratio is equal to the original int.
|
|
|
|
|
The ratio is in lowest terms and has a positive denominator.
|
|
|
|
|
>>> (10).as_integer_ratio() (10, 1) >>> (-10).as_integer_ratio() (-10,
|
|
|
|
|
1) >>> (0).as_integer_ratio() (0, 1)
|
|
|
|
|
.SS \f[V]bit_count(...)\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Number of ones in the binary representation of the absolute value of
|
|
|
|
|
self.
|
|
|
|
|
Also known as the population count.
|
|
|
|
|
>>> bin(13) `0b1101' >>> (13).bit_count() 3
|
|
|
|
|
.SS \f[V]bit_length(...)\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Number of bits necessary to represent self in binary.
|
|
|
|
|
>>> bin(37) `0b100101' >>> (37).bit_length() 6
|
|
|
|
|
.SS \f[V]conjugate(...)\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Returns self, the complex conjugate of any int.
|
|
|
|
|
.SS \f[V]from_bytes(...)\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Return the integer represented by the given array of bytes.
|
|
|
|
|
bytes Holds the array of bytes to convert.
|
|
|
|
|
The argument must either support the buffer protocol or be an iterable
|
|
|
|
|
object producing bytes.
|
|
|
|
|
Bytes and bytearray are examples of built-in objects that support the
|
|
|
|
|
buffer protocol.
|
|
|
|
|
byteorder The byte order used to represent the integer.
|
|
|
|
|
If byteorder is `big', the most significant byte is at the beginning of
|
|
|
|
|
the byte array.
|
|
|
|
|
If byteorder is `little', the most significant byte is at the end of the
|
|
|
|
|
byte array.
|
|
|
|
|
To request the native byte order of the host system, use sys.byteorder
|
|
|
|
|
as the byte order value.
|
|
|
|
|
Default is to use `big'.
|
|
|
|
|
signed Indicates whether two\[cq]s complement is used to represent the
|
|
|
|
|
integer.
|
|
|
|
|
.SS \f[V]is_integer(...)\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Returns True.
|
|
|
|
|
Exists for duck type compatibility with float.is_integer.
|
|
|
|
|
.SS \f[V]to_bytes(...)\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Return an array of bytes representing an integer.
|
|
|
|
|
length Length of bytes object to use.
|
|
|
|
|
An OverflowError is raised if the integer is not representable with the
|
|
|
|
|
given number of bytes.
|
|
|
|
|
Default is length 1.
|
|
|
|
|
byteorder The byte order used to represent the integer.
|
|
|
|
|
If byteorder is `big', the most significant byte is at the beginning of
|
|
|
|
|
the byte array.
|
|
|
|
|
If byteorder is `little', the most significant byte is at the end of the
|
|
|
|
|
byte array.
|
|
|
|
|
To request the native byte order of the host system, use sys.byteorder
|
|
|
|
|
as the byte order value.
|
|
|
|
|
Default is to use `big'.
|
|
|
|
|
signed Determines whether two\[cq]s complement is used to represent the
|
|
|
|
|
integer.
|
|
|
|
|
If signed is False and a negative integer is given, an OverflowError is
|
|
|
|
|
raised.
|
2026-01-23 20:49:11 -05:00
|
|
|
.SS InputState
|
|
|
|
|
.PP
|
|
|
|
|
\f[I]Inherits from: IntEnum\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Enum representing input event states (pressed/released).
|
|
|
|
|
.PP
|
Replace UIEntity gridstate with DiscreteMap perspective_map; closes #294
Per-entity FOV memory moves from std::vector<UIGridPointState> (two-bool
visible/discovered pairs) to a 3-state DiscreteMap (0=UNKNOWN, 1=DISCOVERED,
2=VISIBLE), exposed as entity.perspective_map. The invariant
visible-subset-of-discovered becomes structural (single value per cell), and
the map is a live, serializable, first-class object rather than an implicit
internal array.
Changes:
- New DiscreteMap C++ class with shared ownership; PyDiscreteMapObject now
holds shared_ptr<DiscreteMap>. UIEntity holds the same shared_ptr.
- New mcrfpy.Perspective IntEnum (UNKNOWN/DISCOVERED/VISIBLE), modelled on
PyInputState.
- entity.perspective_map: lazy-allocated on first access with a grid;
setter validates size against grid and raises ValueError on mismatch;
None clears (next access lazy-reallocates fresh).
- updateVisibility() now demotes 2->1 then promotes visible cells to 2.
- entity.at(x, y) returns grid.at(x, y) when VISIBLE, else None.
- Fog-of-war rendering in UIGridView and UIGrid reads the 3-state map.
- Removed: UIEntity::gridstate, ensureGridstate(), entity.gridstate getter,
UIGridPointState struct + PyUIGridPointStateType.
- Obsolete tests deleted (test_gridpointstate_point,
issue_265_gridpointstate_dangle); 4 new tests cover lazy allocation,
identity, serialization round-trip, size validation, and the
visible-subset-of-discovered invariant.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-17 23:04:27 -04:00
|
|
|
Values: PRESSED: Key or button was pressed RELEASED: Key or button was
|
|
|
|
|
released
|
2026-01-23 20:49:11 -05:00
|
|
|
.PP
|
|
|
|
|
\f[B]Properties:\f[R] - \f[V]denominator\f[R]: the denominator of a
|
|
|
|
|
rational number in lowest terms - \f[V]imag\f[R]: the imaginary part of
|
|
|
|
|
a complex number - \f[V]numerator\f[R]: the numerator of a rational
|
|
|
|
|
number in lowest terms - \f[V]real\f[R]: the real part of a complex
|
|
|
|
|
number
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Methods:\f[R]
|
|
|
|
|
.SS \f[V]as_integer_ratio(...)\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Return a pair of integers, whose ratio is equal to the original int.
|
|
|
|
|
The ratio is in lowest terms and has a positive denominator.
|
|
|
|
|
>>> (10).as_integer_ratio() (10, 1) >>> (-10).as_integer_ratio() (-10,
|
|
|
|
|
1) >>> (0).as_integer_ratio() (0, 1)
|
|
|
|
|
.SS \f[V]bit_count(...)\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Number of ones in the binary representation of the absolute value of
|
|
|
|
|
self.
|
|
|
|
|
Also known as the population count.
|
|
|
|
|
>>> bin(13) `0b1101' >>> (13).bit_count() 3
|
|
|
|
|
.SS \f[V]bit_length(...)\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Number of bits necessary to represent self in binary.
|
|
|
|
|
>>> bin(37) `0b100101' >>> (37).bit_length() 6
|
|
|
|
|
.SS \f[V]conjugate(...)\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Returns self, the complex conjugate of any int.
|
|
|
|
|
.SS \f[V]from_bytes(...)\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Return the integer represented by the given array of bytes.
|
|
|
|
|
bytes Holds the array of bytes to convert.
|
|
|
|
|
The argument must either support the buffer protocol or be an iterable
|
|
|
|
|
object producing bytes.
|
|
|
|
|
Bytes and bytearray are examples of built-in objects that support the
|
|
|
|
|
buffer protocol.
|
|
|
|
|
byteorder The byte order used to represent the integer.
|
|
|
|
|
If byteorder is `big', the most significant byte is at the beginning of
|
|
|
|
|
the byte array.
|
|
|
|
|
If byteorder is `little', the most significant byte is at the end of the
|
|
|
|
|
byte array.
|
|
|
|
|
To request the native byte order of the host system, use sys.byteorder
|
|
|
|
|
as the byte order value.
|
|
|
|
|
Default is to use `big'.
|
|
|
|
|
signed Indicates whether two\[cq]s complement is used to represent the
|
|
|
|
|
integer.
|
|
|
|
|
.SS \f[V]is_integer(...)\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Returns True.
|
|
|
|
|
Exists for duck type compatibility with float.is_integer.
|
|
|
|
|
.SS \f[V]to_bytes(...)\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Return an array of bytes representing an integer.
|
|
|
|
|
length Length of bytes object to use.
|
|
|
|
|
An OverflowError is raised if the integer is not representable with the
|
|
|
|
|
given number of bytes.
|
|
|
|
|
Default is length 1.
|
|
|
|
|
byteorder The byte order used to represent the integer.
|
|
|
|
|
If byteorder is `big', the most significant byte is at the beginning of
|
|
|
|
|
the byte array.
|
|
|
|
|
If byteorder is `little', the most significant byte is at the end of the
|
|
|
|
|
byte array.
|
|
|
|
|
To request the native byte order of the host system, use sys.byteorder
|
|
|
|
|
as the byte order value.
|
|
|
|
|
Default is to use `big'.
|
|
|
|
|
signed Determines whether two\[cq]s complement is used to represent the
|
|
|
|
|
integer.
|
|
|
|
|
If signed is False and a negative integer is given, an OverflowError is
|
|
|
|
|
raised.
|
|
|
|
|
.SS Key
|
|
|
|
|
.PP
|
|
|
|
|
\f[I]Inherits from: IntEnum\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Enum representing keyboard keys.
|
|
|
|
|
.PP
|
|
|
|
|
Values map to SFML\[cq]s sf::Keyboard::Key enum.
|
|
|
|
|
.PP
|
|
|
|
|
Categories: Letters: A-Z Numbers: NUM_0 through NUM_9 (top row) Numpad:
|
|
|
|
|
NUMPAD_0 through NUMPAD_9 Function: F1 through F15 Modifiers:
|
|
|
|
|
LEFT_SHIFT, RIGHT_SHIFT, LEFT_CONTROL, etc.
|
|
|
|
|
Navigation: LEFT, RIGHT, UP, DOWN, HOME, END, PAGE_UP, PAGE_DOWN
|
|
|
|
|
Editing: ENTER, BACKSPACE, DELETE, INSERT, TAB, SPACE Symbols: COMMA,
|
|
|
|
|
PERIOD, SLASH, SEMICOLON, etc.
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Properties:\f[R] - \f[V]denominator\f[R]: the denominator of a
|
|
|
|
|
rational number in lowest terms - \f[V]imag\f[R]: the imaginary part of
|
|
|
|
|
a complex number - \f[V]numerator\f[R]: the numerator of a rational
|
|
|
|
|
number in lowest terms - \f[V]real\f[R]: the real part of a complex
|
|
|
|
|
number
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Methods:\f[R]
|
|
|
|
|
.SS \f[V]as_integer_ratio(...)\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Return a pair of integers, whose ratio is equal to the original int.
|
|
|
|
|
The ratio is in lowest terms and has a positive denominator.
|
|
|
|
|
>>> (10).as_integer_ratio() (10, 1) >>> (-10).as_integer_ratio() (-10,
|
|
|
|
|
1) >>> (0).as_integer_ratio() (0, 1)
|
|
|
|
|
.SS \f[V]bit_count(...)\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Number of ones in the binary representation of the absolute value of
|
|
|
|
|
self.
|
|
|
|
|
Also known as the population count.
|
|
|
|
|
>>> bin(13) `0b1101' >>> (13).bit_count() 3
|
|
|
|
|
.SS \f[V]bit_length(...)\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Number of bits necessary to represent self in binary.
|
|
|
|
|
>>> bin(37) `0b100101' >>> (37).bit_length() 6
|
|
|
|
|
.SS \f[V]conjugate(...)\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Returns self, the complex conjugate of any int.
|
|
|
|
|
.SS \f[V]from_bytes(...)\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Return the integer represented by the given array of bytes.
|
|
|
|
|
bytes Holds the array of bytes to convert.
|
|
|
|
|
The argument must either support the buffer protocol or be an iterable
|
|
|
|
|
object producing bytes.
|
|
|
|
|
Bytes and bytearray are examples of built-in objects that support the
|
|
|
|
|
buffer protocol.
|
|
|
|
|
byteorder The byte order used to represent the integer.
|
|
|
|
|
If byteorder is `big', the most significant byte is at the beginning of
|
|
|
|
|
the byte array.
|
|
|
|
|
If byteorder is `little', the most significant byte is at the end of the
|
|
|
|
|
byte array.
|
|
|
|
|
To request the native byte order of the host system, use sys.byteorder
|
|
|
|
|
as the byte order value.
|
|
|
|
|
Default is to use `big'.
|
|
|
|
|
signed Indicates whether two\[cq]s complement is used to represent the
|
|
|
|
|
integer.
|
|
|
|
|
.SS \f[V]is_integer(...)\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Returns True.
|
|
|
|
|
Exists for duck type compatibility with float.is_integer.
|
|
|
|
|
.SS \f[V]to_bytes(...)\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Return an array of bytes representing an integer.
|
|
|
|
|
length Length of bytes object to use.
|
|
|
|
|
An OverflowError is raised if the integer is not representable with the
|
|
|
|
|
given number of bytes.
|
|
|
|
|
Default is length 1.
|
|
|
|
|
byteorder The byte order used to represent the integer.
|
|
|
|
|
If byteorder is `big', the most significant byte is at the beginning of
|
|
|
|
|
the byte array.
|
|
|
|
|
If byteorder is `little', the most significant byte is at the end of the
|
|
|
|
|
byte array.
|
|
|
|
|
To request the native byte order of the host system, use sys.byteorder
|
|
|
|
|
as the byte order value.
|
|
|
|
|
Default is to use `big'.
|
|
|
|
|
signed Determines whether two\[cq]s complement is used to represent the
|
|
|
|
|
integer.
|
|
|
|
|
If signed is False and a negative integer is given, an OverflowError is
|
|
|
|
|
raised.
|
|
|
|
|
.SS Keyboard
|
|
|
|
|
.PP
|
|
|
|
|
Keyboard state singleton for checking modifier keys
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Properties:\f[R] - \f[V]alt\f[R] \f[I](read-only)\f[R]: True if
|
|
|
|
|
either Alt key is currently pressed (read-only).
|
|
|
|
|
- \f[V]ctrl\f[R] \f[I](read-only)\f[R]: True if either Control key is
|
|
|
|
|
currently pressed (read-only).
|
|
|
|
|
- \f[V]shift\f[R] \f[I](read-only)\f[R]: True if either Shift key is
|
|
|
|
|
currently pressed (read-only).
|
|
|
|
|
- \f[V]system\f[R] \f[I](read-only)\f[R]: True if either System key
|
|
|
|
|
(Win/Cmd) is currently pressed (read-only).
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Methods:\f[R]
|
Replace UIEntity gridstate with DiscreteMap perspective_map; closes #294
Per-entity FOV memory moves from std::vector<UIGridPointState> (two-bool
visible/discovered pairs) to a 3-state DiscreteMap (0=UNKNOWN, 1=DISCOVERED,
2=VISIBLE), exposed as entity.perspective_map. The invariant
visible-subset-of-discovered becomes structural (single value per cell), and
the map is a live, serializable, first-class object rather than an implicit
internal array.
Changes:
- New DiscreteMap C++ class with shared ownership; PyDiscreteMapObject now
holds shared_ptr<DiscreteMap>. UIEntity holds the same shared_ptr.
- New mcrfpy.Perspective IntEnum (UNKNOWN/DISCOVERED/VISIBLE), modelled on
PyInputState.
- entity.perspective_map: lazy-allocated on first access with a grid;
setter validates size against grid and raises ValueError on mismatch;
None clears (next access lazy-reallocates fresh).
- updateVisibility() now demotes 2->1 then promotes visible cells to 2.
- entity.at(x, y) returns grid.at(x, y) when VISIBLE, else None.
- Fog-of-war rendering in UIGridView and UIGrid reads the 3-state map.
- Removed: UIEntity::gridstate, ensureGridstate(), entity.gridstate getter,
UIGridPointState struct + PyUIGridPointStateType.
- Obsolete tests deleted (test_gridpointstate_point,
issue_265_gridpointstate_dangle); 4 new tests cover lazy allocation,
identity, serialization round-trip, size validation, and the
visible-subset-of-discovered invariant.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-17 23:04:27 -04:00
|
|
|
.SS LdtkProject
|
|
|
|
|
.PP
|
|
|
|
|
LdtkProject(path: str)
|
|
|
|
|
.PP
|
|
|
|
|
Load an LDtk project file (.ldtk).
|
|
|
|
|
.PP
|
|
|
|
|
Parses the project and provides access to tilesets, auto-rule sets,
|
|
|
|
|
levels, and enum definitions.
|
|
|
|
|
.PP
|
|
|
|
|
Args: path: Path to the .ldtk project file.
|
|
|
|
|
.PP
|
|
|
|
|
Properties: version (str, read-only): LDtk JSON format version.
|
|
|
|
|
tileset_names (list[str], read-only): Names of all tilesets.
|
|
|
|
|
ruleset_names (list[str], read-only): Names of all rule sets.
|
|
|
|
|
level_names (list[str], read-only): Names of all levels.
|
|
|
|
|
enums (dict, read-only): Enum definitions from the project.
|
|
|
|
|
.PP
|
|
|
|
|
Example: proj = mcrfpy.LdtkProject(`dungeon.ldtk') ts =
|
|
|
|
|
proj.tileset(`Dungeon_Tiles') rs = proj.ruleset(`Walls') level =
|
|
|
|
|
proj.level(`Level_0')
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Properties:\f[R] - \f[V]enums\f[R] \f[I](read-only)\f[R]: Enum
|
|
|
|
|
definitions from the project as a list of dicts (read-only).
|
|
|
|
|
- \f[V]level_names\f[R] \f[I](read-only)\f[R]: List of level identifier
|
|
|
|
|
names (list[str], read-only).
|
|
|
|
|
- \f[V]ruleset_names\f[R] \f[I](read-only)\f[R]: List of rule set /
|
|
|
|
|
layer names (list[str], read-only).
|
|
|
|
|
- \f[V]tileset_names\f[R] \f[I](read-only)\f[R]: List of tileset
|
|
|
|
|
identifier names (list[str], read-only).
|
|
|
|
|
- \f[V]version\f[R] \f[I](read-only)\f[R]: LDtk JSON format version
|
|
|
|
|
string (str, read-only).
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Methods:\f[R]
|
|
|
|
|
.SS \f[V]level(name: str) -> dict\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Get level data by name.
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Arguments:\f[R] - \f[V]name\f[R]: Level identifier from the LDtk
|
|
|
|
|
project
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Returns:\f[R] Dict with name, dimensions, world position, and layer
|
|
|
|
|
data.
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Raises:\f[R] KeyError: If no level with the given name exists
|
|
|
|
|
.SS \f[V]ruleset(name: str) -> AutoRuleSet\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Get an auto-rule set by layer name.
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Arguments:\f[R] - \f[V]name\f[R]: Layer identifier from the LDtk
|
|
|
|
|
project
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Returns:\f[R] An AutoRuleSet for resolving IntGrid data to sprite
|
|
|
|
|
tiles.
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Raises:\f[R] KeyError: If no ruleset with the given name exists
|
|
|
|
|
.SS \f[V]tileset(name: str) -> TileSetFile\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Get a tileset by name.
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Arguments:\f[R] - \f[V]name\f[R]: Tileset identifier from the LDtk
|
|
|
|
|
project
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Returns:\f[R] A TileSetFile object for texture creation and tile
|
|
|
|
|
metadata.
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Raises:\f[R] KeyError: If no tileset with the given name exists
|
2026-01-23 20:49:11 -05:00
|
|
|
.SS Line
|
|
|
|
|
.PP
|
|
|
|
|
\f[I]Inherits from: Drawable\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Line(start=None, end=None, thickness=1.0, color=None, **kwargs)
|
|
|
|
|
.PP
|
|
|
|
|
A line UI element for drawing straight lines between two points.
|
|
|
|
|
.PP
|
|
|
|
|
Args: start (tuple, optional): Starting point as (x, y).
|
|
|
|
|
Default: (0, 0) end (tuple, optional): Ending point as (x, y).
|
|
|
|
|
Default: (0, 0) thickness (float, optional): Line thickness in pixels.
|
|
|
|
|
Default: 1.0 color (Color, optional): Line color.
|
|
|
|
|
Default: White
|
|
|
|
|
.PP
|
|
|
|
|
Keyword Args: on_click (callable): Click handler.
|
|
|
|
|
Default: None visible (bool): Visibility state.
|
|
|
|
|
Default: True opacity (float): Opacity (0.0-1.0).
|
|
|
|
|
Default: 1.0 z_index (int): Rendering order.
|
|
|
|
|
Default: 0 name (str): Element name for finding.
|
|
|
|
|
Default: None align (Alignment): Alignment relative to parent.
|
|
|
|
|
Default: None margin (float): Margin from parent edge when aligned.
|
|
|
|
|
Default: 0 horiz_margin (float): Horizontal margin override.
|
|
|
|
|
Default: 0 (use margin) vert_margin (float): Vertical margin override.
|
|
|
|
|
Default: 0 (use margin)
|
|
|
|
|
.PP
|
|
|
|
|
Attributes: start (Vector): Starting point end (Vector): Ending point
|
|
|
|
|
thickness (float): Line thickness color (Color): Line color visible
|
|
|
|
|
(bool): Visibility state opacity (float): Opacity value z_index (int):
|
|
|
|
|
Rendering order name (str): Element name align (Alignment): Alignment
|
|
|
|
|
relative to parent (or None) margin (float): General margin for
|
|
|
|
|
alignment horiz_margin (float): Horizontal margin override vert_margin
|
|
|
|
|
(float): Vertical margin override
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Properties:\f[R] - \f[V]align\f[R]: Alignment relative to parent
|
|
|
|
|
bounds (Alignment enum or None).
|
|
|
|
|
When set, position is automatically calculated when parent is assigned
|
|
|
|
|
or resized.
|
|
|
|
|
Set to None to disable alignment and use manual positioning.
|
F15: correct docstring accuracy from adversarial verify pass (#314)
Follow-up to the macro conversion: an adversarial verify pass (one agent per
file vs. the C++ implementation + stubs) found 62 content issues; the real
ones are fixed here.
Callbacks (centralized):
- on_click: receives (pos, MouseButton, InputState), not str (8 files).
- on_enter/on_exit/on_move (UIBase.h): hover passes only (pos) -- removed the
fictional button/action args.
- bounds/global_bounds (UIBase.h): mark (tuple, read-only).
Signatures / types:
- Grid.find_path: document heuristic + weight; get_dijkstra_map: document roots;
compute_fov: FOV | int = FOV.BASIC (not the C constant FOV_BASIC) + Returns;
at/is_in_fov: document (pos) and (x, y) call forms.
- get_metrics: document all 16 returned dict keys (was 8); bresenham: drop the
bogus '*' keyword-only separator.
- Nullable defaults typed correctly: BSP seed/size, ColorLayer draw_fov/
apply_perspective Color|None, Entity.visible_entities radius int=-1 (None is
rejected by the 'i' parser -> see #319).
- Type-token fixes: GridView.center -> Vector; GridView.texture -> (None,
read-only) (unimplemented, #318); GridPoint.grid_pos -> (tuple, read-only);
EntityCollection.find -> Entity | list[Entity] | None; extend RuntimeError;
UniformCollection.values -> list[float | tuple | None].
- automation: onScreen (x, y) form documented; scroll notes x is ignored (#317).
Also: correct stale AStarPath/DijkstraMap signatures in docs/api-audit-2026-04.md
(the bindings were right, the audit table was outdated). Rebaseline the API
snapshot golden and regenerate docs/stubs.
Code-level bugs surfaced by the pass are filed as #317, #318, #319.
Refs #314, #317, #318, #319
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 06:43:47 -04:00
|
|
|
- \f[V]bounds\f[R] \f[I](read-only)\f[R]: Axis-aligned bounding box
|
|
|
|
|
(tuple, read-only) as a (pos, size) pair of Vectors: (Vector(x, y),
|
|
|
|
|
Vector(width, height)).
|
2026-01-23 20:49:11 -05:00
|
|
|
- \f[V]color\f[R]: Line color as a Color object.
|
|
|
|
|
- \f[V]end\f[R]: Ending point of the line as a Vector.
|
F15: correct docstring accuracy from adversarial verify pass (#314)
Follow-up to the macro conversion: an adversarial verify pass (one agent per
file vs. the C++ implementation + stubs) found 62 content issues; the real
ones are fixed here.
Callbacks (centralized):
- on_click: receives (pos, MouseButton, InputState), not str (8 files).
- on_enter/on_exit/on_move (UIBase.h): hover passes only (pos) -- removed the
fictional button/action args.
- bounds/global_bounds (UIBase.h): mark (tuple, read-only).
Signatures / types:
- Grid.find_path: document heuristic + weight; get_dijkstra_map: document roots;
compute_fov: FOV | int = FOV.BASIC (not the C constant FOV_BASIC) + Returns;
at/is_in_fov: document (pos) and (x, y) call forms.
- get_metrics: document all 16 returned dict keys (was 8); bresenham: drop the
bogus '*' keyword-only separator.
- Nullable defaults typed correctly: BSP seed/size, ColorLayer draw_fov/
apply_perspective Color|None, Entity.visible_entities radius int=-1 (None is
rejected by the 'i' parser -> see #319).
- Type-token fixes: GridView.center -> Vector; GridView.texture -> (None,
read-only) (unimplemented, #318); GridPoint.grid_pos -> (tuple, read-only);
EntityCollection.find -> Entity | list[Entity] | None; extend RuntimeError;
UniformCollection.values -> list[float | tuple | None].
- automation: onScreen (x, y) form documented; scroll notes x is ignored (#317).
Also: correct stale AStarPath/DijkstraMap signatures in docs/api-audit-2026-04.md
(the bindings were right, the audit table was outdated). Rebaseline the API
snapshot golden and regenerate docs/stubs.
Code-level bugs surfaced by the pass are filed as #317, #318, #319.
Refs #314, #317, #318, #319
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 06:43:47 -04:00
|
|
|
- \f[V]global_bounds\f[R] \f[I](read-only)\f[R]: Axis-aligned bounding
|
|
|
|
|
box in screen coordinates (tuple, read-only) as a (pos, size) pair of
|
|
|
|
|
Vectors: (Vector(x, y), Vector(width, height)).
|
2026-01-23 20:49:11 -05:00
|
|
|
- \f[V]global_position\f[R] \f[I](read-only)\f[R]: Global screen
|
|
|
|
|
position (read-only).
|
|
|
|
|
Calculates absolute position by walking up the parent chain.
|
F15: convert frozen binding docstrings to MCRF_* macros (#314)
Convert 289 raw PyMethodDef/PyGetSetDef docstring slots to MCRF_METHOD /
MCRF_PROPERTY across the 20 frozen (non-3D) binding files, bringing the
frozen surface to 100% macro compliance (check_frozen_docstrings.sh PASS).
Done via a one-agent-per-file workflow gated by validate_file_docstrings.sh
and per-wave build/doc-rebuild checks.
- Adds #include "McRFPy_Doc.h" where missing; fills the lone genuine doc
gap (UIGrid.at, which was MISSING a doc field in two arrays).
- McRFPy_Doc.h: comment documenting the MCRF_METHOD_DOC comma rule (the
trap that broke the GridLayers conversion mid-run).
- Rebaseline api_surface golden: property types now resolve to real types
instead of "Any" (e.g. grid_pos: Vector, on_cell_click: Callable | None),
and 11 properties correctly flip rw->ro now that their docstrings carry
"read-only" (collections, grid_size, hovered_cell, texture, view — all
verified against NULL setter slots).
- Regenerate docs/stubs/man page from the new docstrings.
Module-level functions use MCRF_METHOD(<name>, ...) (expands identically to
the intended MCRF_FUNCTION; the audit's compliance set is METHOD/PROPERTY).
Experimental 3D/Voxel bindings (src/3d/) remain exempt from the freeze.
Pre-existing failures unrelated to this change: test_animation_*,
test_constructor_comprehensive (reference the removed mcrfpy.Animation and
old constructor arity).
Refs #314
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 01:20:55 -04:00
|
|
|
- \f[V]grid_pos\f[R]: Position in grid tile coordinates (Vector, only
|
|
|
|
|
when parent is Grid).
|
|
|
|
|
- \f[V]grid_size\f[R]: Size in grid tile coordinates (Vector, only when
|
|
|
|
|
parent is Grid).
|
|
|
|
|
- \f[V]horiz_margin\f[R]: Horizontal margin override (float, 0 = use
|
|
|
|
|
general margin).
|
2026-01-23 20:49:11 -05:00
|
|
|
Invalid for vertically-centered alignments (TOP_CENTER, BOTTOM_CENTER,
|
|
|
|
|
CENTER).
|
|
|
|
|
- \f[V]hovered\f[R] \f[I](read-only)\f[R]: Whether mouse is currently
|
|
|
|
|
over this element (read-only).
|
|
|
|
|
Updated automatically by the engine during mouse movement.
|
|
|
|
|
- \f[V]margin\f[R]: General margin from edge when aligned (float).
|
|
|
|
|
Applied to both horizontal and vertical edges unless overridden.
|
|
|
|
|
Invalid for CENTER alignment (raises ValueError).
|
|
|
|
|
- \f[V]name\f[R]: Name for finding this element.
|
|
|
|
|
- \f[V]on_click\f[R]: Callable executed when line is clicked.
|
F15: correct docstring accuracy from adversarial verify pass (#314)
Follow-up to the macro conversion: an adversarial verify pass (one agent per
file vs. the C++ implementation + stubs) found 62 content issues; the real
ones are fixed here.
Callbacks (centralized):
- on_click: receives (pos, MouseButton, InputState), not str (8 files).
- on_enter/on_exit/on_move (UIBase.h): hover passes only (pos) -- removed the
fictional button/action args.
- bounds/global_bounds (UIBase.h): mark (tuple, read-only).
Signatures / types:
- Grid.find_path: document heuristic + weight; get_dijkstra_map: document roots;
compute_fov: FOV | int = FOV.BASIC (not the C constant FOV_BASIC) + Returns;
at/is_in_fov: document (pos) and (x, y) call forms.
- get_metrics: document all 16 returned dict keys (was 8); bresenham: drop the
bogus '*' keyword-only separator.
- Nullable defaults typed correctly: BSP seed/size, ColorLayer draw_fov/
apply_perspective Color|None, Entity.visible_entities radius int=-1 (None is
rejected by the 'i' parser -> see #319).
- Type-token fixes: GridView.center -> Vector; GridView.texture -> (None,
read-only) (unimplemented, #318); GridPoint.grid_pos -> (tuple, read-only);
EntityCollection.find -> Entity | list[Entity] | None; extend RuntimeError;
UniformCollection.values -> list[float | tuple | None].
- automation: onScreen (x, y) form documented; scroll notes x is ignored (#317).
Also: correct stale AStarPath/DijkstraMap signatures in docs/api-audit-2026-04.md
(the bindings were right, the audit table was outdated). Rebaseline the API
snapshot golden and regenerate docs/stubs.
Code-level bugs surfaced by the pass are filed as #317, #318, #319.
Refs #314, #317, #318, #319
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 06:43:47 -04:00
|
|
|
Function receives (pos: Vector, button: MouseButton, action:
|
|
|
|
|
InputState).
|
2026-01-23 20:49:11 -05:00
|
|
|
- \f[V]on_enter\f[R]: Callback for mouse enter events.
|
F15: correct docstring accuracy from adversarial verify pass (#314)
Follow-up to the macro conversion: an adversarial verify pass (one agent per
file vs. the C++ implementation + stubs) found 62 content issues; the real
ones are fixed here.
Callbacks (centralized):
- on_click: receives (pos, MouseButton, InputState), not str (8 files).
- on_enter/on_exit/on_move (UIBase.h): hover passes only (pos) -- removed the
fictional button/action args.
- bounds/global_bounds (UIBase.h): mark (tuple, read-only).
Signatures / types:
- Grid.find_path: document heuristic + weight; get_dijkstra_map: document roots;
compute_fov: FOV | int = FOV.BASIC (not the C constant FOV_BASIC) + Returns;
at/is_in_fov: document (pos) and (x, y) call forms.
- get_metrics: document all 16 returned dict keys (was 8); bresenham: drop the
bogus '*' keyword-only separator.
- Nullable defaults typed correctly: BSP seed/size, ColorLayer draw_fov/
apply_perspective Color|None, Entity.visible_entities radius int=-1 (None is
rejected by the 'i' parser -> see #319).
- Type-token fixes: GridView.center -> Vector; GridView.texture -> (None,
read-only) (unimplemented, #318); GridPoint.grid_pos -> (tuple, read-only);
EntityCollection.find -> Entity | list[Entity] | None; extend RuntimeError;
UniformCollection.values -> list[float | tuple | None].
- automation: onScreen (x, y) form documented; scroll notes x is ignored (#317).
Also: correct stale AStarPath/DijkstraMap signatures in docs/api-audit-2026-04.md
(the bindings were right, the audit table was outdated). Rebaseline the API
snapshot golden and regenerate docs/stubs.
Code-level bugs surfaced by the pass are filed as #317, #318, #319.
Refs #314, #317, #318, #319
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 06:43:47 -04:00
|
|
|
Called with (pos: Vector) when mouse enters this element\[cq]s bounds.
|
2026-01-23 20:49:11 -05:00
|
|
|
- \f[V]on_exit\f[R]: Callback for mouse exit events.
|
F15: correct docstring accuracy from adversarial verify pass (#314)
Follow-up to the macro conversion: an adversarial verify pass (one agent per
file vs. the C++ implementation + stubs) found 62 content issues; the real
ones are fixed here.
Callbacks (centralized):
- on_click: receives (pos, MouseButton, InputState), not str (8 files).
- on_enter/on_exit/on_move (UIBase.h): hover passes only (pos) -- removed the
fictional button/action args.
- bounds/global_bounds (UIBase.h): mark (tuple, read-only).
Signatures / types:
- Grid.find_path: document heuristic + weight; get_dijkstra_map: document roots;
compute_fov: FOV | int = FOV.BASIC (not the C constant FOV_BASIC) + Returns;
at/is_in_fov: document (pos) and (x, y) call forms.
- get_metrics: document all 16 returned dict keys (was 8); bresenham: drop the
bogus '*' keyword-only separator.
- Nullable defaults typed correctly: BSP seed/size, ColorLayer draw_fov/
apply_perspective Color|None, Entity.visible_entities radius int=-1 (None is
rejected by the 'i' parser -> see #319).
- Type-token fixes: GridView.center -> Vector; GridView.texture -> (None,
read-only) (unimplemented, #318); GridPoint.grid_pos -> (tuple, read-only);
EntityCollection.find -> Entity | list[Entity] | None; extend RuntimeError;
UniformCollection.values -> list[float | tuple | None].
- automation: onScreen (x, y) form documented; scroll notes x is ignored (#317).
Also: correct stale AStarPath/DijkstraMap signatures in docs/api-audit-2026-04.md
(the bindings were right, the audit table was outdated). Rebaseline the API
snapshot golden and regenerate docs/stubs.
Code-level bugs surfaced by the pass are filed as #317, #318, #319.
Refs #314, #317, #318, #319
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 06:43:47 -04:00
|
|
|
Called with (pos: Vector) when mouse leaves this element\[cq]s bounds.
|
2026-01-23 20:49:11 -05:00
|
|
|
- \f[V]on_move\f[R]: Callback for mouse movement within bounds.
|
F15: correct docstring accuracy from adversarial verify pass (#314)
Follow-up to the macro conversion: an adversarial verify pass (one agent per
file vs. the C++ implementation + stubs) found 62 content issues; the real
ones are fixed here.
Callbacks (centralized):
- on_click: receives (pos, MouseButton, InputState), not str (8 files).
- on_enter/on_exit/on_move (UIBase.h): hover passes only (pos) -- removed the
fictional button/action args.
- bounds/global_bounds (UIBase.h): mark (tuple, read-only).
Signatures / types:
- Grid.find_path: document heuristic + weight; get_dijkstra_map: document roots;
compute_fov: FOV | int = FOV.BASIC (not the C constant FOV_BASIC) + Returns;
at/is_in_fov: document (pos) and (x, y) call forms.
- get_metrics: document all 16 returned dict keys (was 8); bresenham: drop the
bogus '*' keyword-only separator.
- Nullable defaults typed correctly: BSP seed/size, ColorLayer draw_fov/
apply_perspective Color|None, Entity.visible_entities radius int=-1 (None is
rejected by the 'i' parser -> see #319).
- Type-token fixes: GridView.center -> Vector; GridView.texture -> (None,
read-only) (unimplemented, #318); GridPoint.grid_pos -> (tuple, read-only);
EntityCollection.find -> Entity | list[Entity] | None; extend RuntimeError;
UniformCollection.values -> list[float | tuple | None].
- automation: onScreen (x, y) form documented; scroll notes x is ignored (#317).
Also: correct stale AStarPath/DijkstraMap signatures in docs/api-audit-2026-04.md
(the bindings were right, the audit table was outdated). Rebaseline the API
snapshot golden and regenerate docs/stubs.
Code-level bugs surfaced by the pass are filed as #317, #318, #319.
Refs #314, #317, #318, #319
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 06:43:47 -04:00
|
|
|
Called with (pos: Vector) for each mouse movement while inside.
|
2026-01-23 20:49:11 -05:00
|
|
|
Performance note: Called frequently during movement - keep handlers
|
|
|
|
|
fast.
|
|
|
|
|
- \f[V]opacity\f[R]: Opacity level (0.0 = transparent, 1.0 = opaque).
|
|
|
|
|
Automatically clamped to valid range [0.0, 1.0].
|
Update documentation for API changes #229, #230, #184
CLAUDE.md updates:
- Fix Python version 3.12 -> 3.14
- Update keypressScene -> scene.on_key pattern
- Add API examples for new callback signatures
- Document animation callbacks (target, prop, value)
- Document hover callbacks (position-only)
- Document enum types (Key, MouseButton, InputState)
stubs/mcrfpy.pyi updates:
- Add Key, MouseButton, InputState, Easing enum classes
- Fix Drawable hover callback signatures per #230
- Fix Grid cell callback signatures per #230
- Fix Scene.on_key signature to use enums per #184
- Update Animation class with correct callback signature per #229
- Add deprecation notes to keypressScene, setTimer, delTimer
Regenerated docs:
- API_REFERENCE_DYNAMIC.md
- api_reference_dynamic.html
- mcrfpy.3 man page
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-28 19:20:04 -05:00
|
|
|
- \f[V]origin\f[R]: Transform origin as Vector (pivot point for
|
|
|
|
|
rotation).
|
|
|
|
|
Default (0,0) is top-left; set to (w/2, h/2) to rotate around center.
|
2026-01-23 20:49:11 -05:00
|
|
|
- \f[V]parent\f[R]: Parent drawable.
|
|
|
|
|
Get: Returns the parent Frame/Grid if nested, or None if at scene level.
|
|
|
|
|
Set: Assign a Frame/Grid to reparent, or None to remove from parent.
|
|
|
|
|
- \f[V]pos\f[R]: Position as a Vector (midpoint of line).
|
Update documentation for API changes #229, #230, #184
CLAUDE.md updates:
- Fix Python version 3.12 -> 3.14
- Update keypressScene -> scene.on_key pattern
- Add API examples for new callback signatures
- Document animation callbacks (target, prop, value)
- Document hover callbacks (position-only)
- Document enum types (Key, MouseButton, InputState)
stubs/mcrfpy.pyi updates:
- Add Key, MouseButton, InputState, Easing enum classes
- Fix Drawable hover callback signatures per #230
- Fix Grid cell callback signatures per #230
- Fix Scene.on_key signature to use enums per #184
- Update Animation class with correct callback signature per #229
- Add deprecation notes to keypressScene, setTimer, delTimer
Regenerated docs:
- API_REFERENCE_DYNAMIC.md
- api_reference_dynamic.html
- mcrfpy.3 man page
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-28 19:20:04 -05:00
|
|
|
- \f[V]rotate_with_camera\f[R]: Whether to rotate visually with parent
|
|
|
|
|
Grid\[cq]s camera_rotation (bool).
|
|
|
|
|
False (default): stay screen-aligned.
|
|
|
|
|
True: tilt with camera.
|
|
|
|
|
Only affects children of UIGrid; ignored for other parents.
|
|
|
|
|
- \f[V]rotation\f[R]: Rotation angle in degrees (clockwise around
|
|
|
|
|
origin).
|
|
|
|
|
Animatable property.
|
2026-01-23 20:49:11 -05:00
|
|
|
- \f[V]start\f[R]: Starting point of the line as a Vector.
|
|
|
|
|
- \f[V]thickness\f[R]: Line thickness in pixels.
|
|
|
|
|
- \f[V]vert_margin\f[R]: Vertical margin override (float, 0 = use
|
|
|
|
|
general margin).
|
|
|
|
|
Invalid for horizontally-centered alignments (CENTER_LEFT, CENTER_RIGHT,
|
|
|
|
|
CENTER).
|
|
|
|
|
- \f[V]visible\f[R]: Whether the object is visible (bool).
|
|
|
|
|
Invisible objects are not rendered or clickable.
|
|
|
|
|
- \f[V]z_index\f[R]: Z-order for rendering (lower values rendered
|
|
|
|
|
first).
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Methods:\f[R]
|
Replace UIEntity gridstate with DiscreteMap perspective_map; closes #294
Per-entity FOV memory moves from std::vector<UIGridPointState> (two-bool
visible/discovered pairs) to a 3-state DiscreteMap (0=UNKNOWN, 1=DISCOVERED,
2=VISIBLE), exposed as entity.perspective_map. The invariant
visible-subset-of-discovered becomes structural (single value per cell), and
the map is a live, serializable, first-class object rather than an implicit
internal array.
Changes:
- New DiscreteMap C++ class with shared ownership; PyDiscreteMapObject now
holds shared_ptr<DiscreteMap>. UIEntity holds the same shared_ptr.
- New mcrfpy.Perspective IntEnum (UNKNOWN/DISCOVERED/VISIBLE), modelled on
PyInputState.
- entity.perspective_map: lazy-allocated on first access with a grid;
setter validates size against grid and raises ValueError on mismatch;
None clears (next access lazy-reallocates fresh).
- updateVisibility() now demotes 2->1 then promotes visible cells to 2.
- entity.at(x, y) returns grid.at(x, y) when VISIBLE, else None.
- Fog-of-war rendering in UIGridView and UIGrid reads the 3-state map.
- Removed: UIEntity::gridstate, ensureGridstate(), entity.gridstate getter,
UIGridPointState struct + PyUIGridPointStateType.
- Obsolete tests deleted (test_gridpointstate_point,
issue_265_gridpointstate_dangle); 4 new tests cover lazy allocation,
identity, serialization round-trip, size validation, and the
visible-subset-of-discovered invariant.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-17 23:04:27 -04:00
|
|
|
.SS \f[V]animate(property: str, target: Any, duration: float, easing=None, delta=False, loop=False, callback=None, conflict_mode=\[aq]replace\[aq]) -> Animation\f[R]
|
2026-01-23 20:49:11 -05:00
|
|
|
.PP
|
|
|
|
|
Create and start an animation on this drawable\[cq]s property.
|
|
|
|
|
.PP
|
|
|
|
|
Note:
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Arguments:\f[R] - \f[V]property\f[R]: Name of the property to
|
|
|
|
|
animate (e.g., `x', `fill_color', `opacity') - \f[V]target\f[R]: Target
|
|
|
|
|
value - type depends on property (float, tuple for color/vector, etc.)
|
|
|
|
|
- \f[V]duration\f[R]: Animation duration in seconds - \f[V]easing\f[R]:
|
|
|
|
|
Easing function: Easing enum value, string name, or None for linear -
|
|
|
|
|
\f[V]delta\f[R]: If True, target is relative to current value; if False,
|
Replace UIEntity gridstate with DiscreteMap perspective_map; closes #294
Per-entity FOV memory moves from std::vector<UIGridPointState> (two-bool
visible/discovered pairs) to a 3-state DiscreteMap (0=UNKNOWN, 1=DISCOVERED,
2=VISIBLE), exposed as entity.perspective_map. The invariant
visible-subset-of-discovered becomes structural (single value per cell), and
the map is a live, serializable, first-class object rather than an implicit
internal array.
Changes:
- New DiscreteMap C++ class with shared ownership; PyDiscreteMapObject now
holds shared_ptr<DiscreteMap>. UIEntity holds the same shared_ptr.
- New mcrfpy.Perspective IntEnum (UNKNOWN/DISCOVERED/VISIBLE), modelled on
PyInputState.
- entity.perspective_map: lazy-allocated on first access with a grid;
setter validates size against grid and raises ValueError on mismatch;
None clears (next access lazy-reallocates fresh).
- updateVisibility() now demotes 2->1 then promotes visible cells to 2.
- entity.at(x, y) returns grid.at(x, y) when VISIBLE, else None.
- Fog-of-war rendering in UIGridView and UIGrid reads the 3-state map.
- Removed: UIEntity::gridstate, ensureGridstate(), entity.gridstate getter,
UIGridPointState struct + PyUIGridPointStateType.
- Obsolete tests deleted (test_gridpointstate_point,
issue_265_gridpointstate_dangle); 4 new tests cover lazy allocation,
identity, serialization round-trip, size validation, and the
visible-subset-of-discovered invariant.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-17 23:04:27 -04:00
|
|
|
target is absolute - \f[V]loop\f[R]: If True, animation repeats from
|
|
|
|
|
start when it reaches the end (default False) - \f[V]callback\f[R]:
|
|
|
|
|
Optional callable invoked when animation completes (not called for
|
|
|
|
|
looping animations) - \f[V]conflict_mode\f[R]: `replace' (default),
|
2026-01-23 20:49:11 -05:00
|
|
|
`queue', or `error' if property already animating
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Returns:\f[R] Animation object for monitoring progress
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Raises:\f[R] ValueError: If property name is not valid for this
|
|
|
|
|
drawable type This is a convenience method that creates an Animation,
|
|
|
|
|
starts it, and adds it to the AnimationManager.
|
|
|
|
|
.SS \f[V]move(dx, dy) or (delta) -> None\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Move the element by a relative offset.
|
|
|
|
|
.PP
|
|
|
|
|
Note:
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Arguments:\f[R] - \f[V]dx\f[R]: Horizontal offset in pixels (or use
|
|
|
|
|
delta) - \f[V]dy\f[R]: Vertical offset in pixels (or use delta) -
|
|
|
|
|
\f[V]delta\f[R]: Offset as tuple, list, or Vector: (dx, dy)
|
|
|
|
|
.SS \f[V]realign() -> None\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Reapply alignment relative to parent, useful for responsive layouts.
|
|
|
|
|
.PP
|
|
|
|
|
Note: Call this to recalculate position after parent changes size.
|
|
|
|
|
For elements with align=None, this has no effect.
|
|
|
|
|
.SS \f[V]resize(width, height) or (size) -> None\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Resize the element to new dimensions.
|
|
|
|
|
.PP
|
|
|
|
|
Note:
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Arguments:\f[R] - \f[V]width\f[R]: New width in pixels (or use
|
|
|
|
|
size) - \f[V]height\f[R]: New height in pixels (or use size) -
|
|
|
|
|
\f[V]size\f[R]: Size as tuple, list, or Vector: (width, height)
|
Replace UIEntity gridstate with DiscreteMap perspective_map; closes #294
Per-entity FOV memory moves from std::vector<UIGridPointState> (two-bool
visible/discovered pairs) to a 3-state DiscreteMap (0=UNKNOWN, 1=DISCOVERED,
2=VISIBLE), exposed as entity.perspective_map. The invariant
visible-subset-of-discovered becomes structural (single value per cell), and
the map is a live, serializable, first-class object rather than an implicit
internal array.
Changes:
- New DiscreteMap C++ class with shared ownership; PyDiscreteMapObject now
holds shared_ptr<DiscreteMap>. UIEntity holds the same shared_ptr.
- New mcrfpy.Perspective IntEnum (UNKNOWN/DISCOVERED/VISIBLE), modelled on
PyInputState.
- entity.perspective_map: lazy-allocated on first access with a grid;
setter validates size against grid and raises ValueError on mismatch;
None clears (next access lazy-reallocates fresh).
- updateVisibility() now demotes 2->1 then promotes visible cells to 2.
- entity.at(x, y) returns grid.at(x, y) when VISIBLE, else None.
- Fog-of-war rendering in UIGridView and UIGrid reads the 3-state map.
- Removed: UIEntity::gridstate, ensureGridstate(), entity.gridstate getter,
UIGridPointState struct + PyUIGridPointStateType.
- Obsolete tests deleted (test_gridpointstate_point,
issue_265_gridpointstate_dangle); 4 new tests cover lazy allocation,
identity, serialization round-trip, size validation, and the
visible-subset-of-discovered invariant.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-17 23:04:27 -04:00
|
|
|
.SS Model3D
|
|
|
|
|
.PP
|
|
|
|
|
Model3D(path=None)
|
|
|
|
|
.PP
|
|
|
|
|
A 3D model resource that can be rendered by Entity3D.
|
|
|
|
|
.PP
|
|
|
|
|
Args: path (str, optional): Path to .glb file to load.
|
|
|
|
|
If None, creates empty model.
|
|
|
|
|
.PP
|
|
|
|
|
Class Methods: cube(size=1.0) -> Model3D: Create a unit cube
|
|
|
|
|
plane(width=1.0, depth=1.0, segments=1) -> Model3D: Create a flat plane
|
|
|
|
|
sphere(radius=0.5, segments=16, rings=12) -> Model3D: Create a UV sphere
|
|
|
|
|
.PP
|
|
|
|
|
Properties: name (str, read-only): Model name vertex_count (int,
|
|
|
|
|
read-only): Total vertices across all meshes triangle_count (int,
|
|
|
|
|
read-only): Total triangles across all meshes has_skeleton (bool,
|
|
|
|
|
read-only): Whether model has skeletal animation data bounds (tuple,
|
|
|
|
|
read-only): AABB as ((min_x, min_y, min_z), (max_x, max_y, max_z))
|
|
|
|
|
mesh_count (int, read-only): Number of submeshes bone_count (int,
|
|
|
|
|
read-only): Number of bones in skeleton animation_clips (list,
|
|
|
|
|
read-only): List of animation clip names
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Properties:\f[R] - \f[V]animation_clips\f[R] \f[I](read-only)\f[R]:
|
|
|
|
|
List of animation clip names (read-only) - \f[V]bone_count\f[R]
|
|
|
|
|
\f[I](read-only)\f[R]: Number of bones in skeleton (read-only) -
|
|
|
|
|
\f[V]bounds\f[R] \f[I](read-only)\f[R]: AABB as ((min_x, min_y, min_z),
|
|
|
|
|
(max_x, max_y, max_z)) (read-only) - \f[V]has_skeleton\f[R]
|
|
|
|
|
\f[I](read-only)\f[R]: Whether model has skeletal animation data
|
|
|
|
|
(read-only) - \f[V]mesh_count\f[R] \f[I](read-only)\f[R]: Number of
|
|
|
|
|
submeshes (read-only) - \f[V]name\f[R] \f[I](read-only)\f[R]: Model name
|
|
|
|
|
(read-only) - \f[V]triangle_count\f[R] \f[I](read-only)\f[R]: Total
|
|
|
|
|
triangle count across all meshes (read-only) - \f[V]vertex_count\f[R]
|
|
|
|
|
\f[I](read-only)\f[R]: Total vertex count across all meshes (read-only)
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Methods:\f[R]
|
|
|
|
|
.SS \f[V]cube(size=1.0) -> Model3D\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Create a unit cube centered at origin.
|
|
|
|
|
.SS \f[V]plane(width=1.0, depth=1.0, segments=1) -> Model3D\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Create a flat plane.
|
|
|
|
|
.SS \f[V]sphere(radius=0.5, segments=16, rings=12) -> Model3D\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Create a UV sphere.
|
2026-01-23 20:49:11 -05:00
|
|
|
.SS Mouse
|
|
|
|
|
.PP
|
|
|
|
|
Mouse state singleton for reading button/position state and controlling
|
|
|
|
|
cursor visibility
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Properties:\f[R] - \f[V]grabbed\f[R]: Whether the mouse cursor is
|
|
|
|
|
confined to the window (default: False).
|
|
|
|
|
- \f[V]left\f[R] \f[I](read-only)\f[R]: True if left mouse button is
|
|
|
|
|
currently pressed (read-only).
|
|
|
|
|
- \f[V]middle\f[R] \f[I](read-only)\f[R]: True if middle mouse button is
|
|
|
|
|
currently pressed (read-only).
|
|
|
|
|
- \f[V]pos\f[R] \f[I](read-only)\f[R]: Current mouse position as Vector
|
|
|
|
|
(read-only).
|
|
|
|
|
- \f[V]right\f[R] \f[I](read-only)\f[R]: True if right mouse button is
|
|
|
|
|
currently pressed (read-only).
|
|
|
|
|
- \f[V]visible\f[R]: Whether the mouse cursor is visible (default:
|
|
|
|
|
True).
|
|
|
|
|
- \f[V]x\f[R] \f[I](read-only)\f[R]: Current mouse X position in window
|
|
|
|
|
coordinates (read-only).
|
|
|
|
|
- \f[V]y\f[R] \f[I](read-only)\f[R]: Current mouse Y position in window
|
|
|
|
|
coordinates (read-only).
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Methods:\f[R]
|
|
|
|
|
.SS MouseButton
|
|
|
|
|
.PP
|
|
|
|
|
\f[I]Inherits from: IntEnum\f[R]
|
|
|
|
|
.PP
|
Replace UIEntity gridstate with DiscreteMap perspective_map; closes #294
Per-entity FOV memory moves from std::vector<UIGridPointState> (two-bool
visible/discovered pairs) to a 3-state DiscreteMap (0=UNKNOWN, 1=DISCOVERED,
2=VISIBLE), exposed as entity.perspective_map. The invariant
visible-subset-of-discovered becomes structural (single value per cell), and
the map is a live, serializable, first-class object rather than an implicit
internal array.
Changes:
- New DiscreteMap C++ class with shared ownership; PyDiscreteMapObject now
holds shared_ptr<DiscreteMap>. UIEntity holds the same shared_ptr.
- New mcrfpy.Perspective IntEnum (UNKNOWN/DISCOVERED/VISIBLE), modelled on
PyInputState.
- entity.perspective_map: lazy-allocated on first access with a grid;
setter validates size against grid and raises ValueError on mismatch;
None clears (next access lazy-reallocates fresh).
- updateVisibility() now demotes 2->1 then promotes visible cells to 2.
- entity.at(x, y) returns grid.at(x, y) when VISIBLE, else None.
- Fog-of-war rendering in UIGridView and UIGrid reads the 3-state map.
- Removed: UIEntity::gridstate, ensureGridstate(), entity.gridstate getter,
UIGridPointState struct + PyUIGridPointStateType.
- Obsolete tests deleted (test_gridpointstate_point,
issue_265_gridpointstate_dangle); 4 new tests cover lazy allocation,
identity, serialization round-trip, size validation, and the
visible-subset-of-discovered invariant.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-17 23:04:27 -04:00
|
|
|
Enum representing mouse buttons and scroll wheel.
|
2026-01-23 20:49:11 -05:00
|
|
|
.PP
|
Replace UIEntity gridstate with DiscreteMap perspective_map; closes #294
Per-entity FOV memory moves from std::vector<UIGridPointState> (two-bool
visible/discovered pairs) to a 3-state DiscreteMap (0=UNKNOWN, 1=DISCOVERED,
2=VISIBLE), exposed as entity.perspective_map. The invariant
visible-subset-of-discovered becomes structural (single value per cell), and
the map is a live, serializable, first-class object rather than an implicit
internal array.
Changes:
- New DiscreteMap C++ class with shared ownership; PyDiscreteMapObject now
holds shared_ptr<DiscreteMap>. UIEntity holds the same shared_ptr.
- New mcrfpy.Perspective IntEnum (UNKNOWN/DISCOVERED/VISIBLE), modelled on
PyInputState.
- entity.perspective_map: lazy-allocated on first access with a grid;
setter validates size against grid and raises ValueError on mismatch;
None clears (next access lazy-reallocates fresh).
- updateVisibility() now demotes 2->1 then promotes visible cells to 2.
- entity.at(x, y) returns grid.at(x, y) when VISIBLE, else None.
- Fog-of-war rendering in UIGridView and UIGrid reads the 3-state map.
- Removed: UIEntity::gridstate, ensureGridstate(), entity.gridstate getter,
UIGridPointState struct + PyUIGridPointStateType.
- Obsolete tests deleted (test_gridpointstate_point,
issue_265_gridpointstate_dangle); 4 new tests cover lazy allocation,
identity, serialization round-trip, size validation, and the
visible-subset-of-discovered invariant.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-17 23:04:27 -04:00
|
|
|
Values: LEFT: Left mouse button RIGHT: Right mouse button MIDDLE: Middle
|
|
|
|
|
mouse button / scroll wheel click X1: Extra mouse button 1 X2: Extra
|
|
|
|
|
mouse button 2 SCROLL_UP: Scroll wheel up SCROLL_DOWN: Scroll wheel down
|
2026-01-23 20:49:11 -05:00
|
|
|
.PP
|
|
|
|
|
\f[B]Properties:\f[R] - \f[V]denominator\f[R]: the denominator of a
|
|
|
|
|
rational number in lowest terms - \f[V]imag\f[R]: the imaginary part of
|
|
|
|
|
a complex number - \f[V]numerator\f[R]: the numerator of a rational
|
|
|
|
|
number in lowest terms - \f[V]real\f[R]: the real part of a complex
|
|
|
|
|
number
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Methods:\f[R]
|
|
|
|
|
.SS \f[V]as_integer_ratio(...)\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Return a pair of integers, whose ratio is equal to the original int.
|
|
|
|
|
The ratio is in lowest terms and has a positive denominator.
|
|
|
|
|
>>> (10).as_integer_ratio() (10, 1) >>> (-10).as_integer_ratio() (-10,
|
|
|
|
|
1) >>> (0).as_integer_ratio() (0, 1)
|
|
|
|
|
.SS \f[V]bit_count(...)\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Number of ones in the binary representation of the absolute value of
|
|
|
|
|
self.
|
|
|
|
|
Also known as the population count.
|
|
|
|
|
>>> bin(13) `0b1101' >>> (13).bit_count() 3
|
|
|
|
|
.SS \f[V]bit_length(...)\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Number of bits necessary to represent self in binary.
|
|
|
|
|
>>> bin(37) `0b100101' >>> (37).bit_length() 6
|
|
|
|
|
.SS \f[V]conjugate(...)\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Returns self, the complex conjugate of any int.
|
|
|
|
|
.SS \f[V]from_bytes(...)\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Return the integer represented by the given array of bytes.
|
|
|
|
|
bytes Holds the array of bytes to convert.
|
|
|
|
|
The argument must either support the buffer protocol or be an iterable
|
|
|
|
|
object producing bytes.
|
|
|
|
|
Bytes and bytearray are examples of built-in objects that support the
|
|
|
|
|
buffer protocol.
|
|
|
|
|
byteorder The byte order used to represent the integer.
|
|
|
|
|
If byteorder is `big', the most significant byte is at the beginning of
|
|
|
|
|
the byte array.
|
|
|
|
|
If byteorder is `little', the most significant byte is at the end of the
|
|
|
|
|
byte array.
|
|
|
|
|
To request the native byte order of the host system, use sys.byteorder
|
|
|
|
|
as the byte order value.
|
|
|
|
|
Default is to use `big'.
|
|
|
|
|
signed Indicates whether two\[cq]s complement is used to represent the
|
|
|
|
|
integer.
|
|
|
|
|
.SS \f[V]is_integer(...)\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Returns True.
|
|
|
|
|
Exists for duck type compatibility with float.is_integer.
|
|
|
|
|
.SS \f[V]to_bytes(...)\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Return an array of bytes representing an integer.
|
|
|
|
|
length Length of bytes object to use.
|
|
|
|
|
An OverflowError is raised if the integer is not representable with the
|
|
|
|
|
given number of bytes.
|
|
|
|
|
Default is length 1.
|
|
|
|
|
byteorder The byte order used to represent the integer.
|
|
|
|
|
If byteorder is `big', the most significant byte is at the beginning of
|
|
|
|
|
the byte array.
|
|
|
|
|
If byteorder is `little', the most significant byte is at the end of the
|
|
|
|
|
byte array.
|
|
|
|
|
To request the native byte order of the host system, use sys.byteorder
|
|
|
|
|
as the byte order value.
|
|
|
|
|
Default is to use `big'.
|
|
|
|
|
signed Determines whether two\[cq]s complement is used to represent the
|
|
|
|
|
integer.
|
|
|
|
|
If signed is False and a negative integer is given, an OverflowError is
|
|
|
|
|
raised.
|
|
|
|
|
.SS Music
|
|
|
|
|
.PP
|
|
|
|
|
Streaming music object for longer audio tracks
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Properties:\f[R] - \f[V]duration\f[R] \f[I](read-only)\f[R]: Total
|
|
|
|
|
duration of the music in seconds (read-only).
|
|
|
|
|
- \f[V]loop\f[R]: Whether the music loops when it reaches the end.
|
|
|
|
|
- \f[V]playing\f[R] \f[I](read-only)\f[R]: True if the music is
|
|
|
|
|
currently playing (read-only).
|
|
|
|
|
- \f[V]position\f[R]: Current playback position in seconds.
|
|
|
|
|
Can be set to seek.
|
|
|
|
|
- \f[V]source\f[R] \f[I](read-only)\f[R]: Filename path used to load
|
|
|
|
|
this music (read-only).
|
|
|
|
|
- \f[V]volume\f[R]: Volume level from 0 (silent) to 100 (full volume).
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Methods:\f[R]
|
|
|
|
|
.SS \f[V]pause() -> None\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Pause the music.
|
|
|
|
|
Use play() to resume from the paused position.
|
|
|
|
|
.SS \f[V]play() -> None\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Start or resume playing the music.
|
|
|
|
|
.SS \f[V]stop() -> None\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Stop playing and reset to the beginning.
|
|
|
|
|
.SS NoiseSource
|
|
|
|
|
.PP
|
|
|
|
|
NoiseSource(dimensions: int = 2, algorithm: str = `simplex', hurst:
|
|
|
|
|
float = 0.5, lacunarity: float = 2.0, seed: int = None)
|
|
|
|
|
.PP
|
|
|
|
|
A configured noise generator for procedural generation.
|
|
|
|
|
.PP
|
|
|
|
|
NoiseSource wraps libtcod\[cq]s noise generator, providing coherent
|
|
|
|
|
noise values that can be used for terrain generation, textures, and
|
|
|
|
|
other procedural content.
|
|
|
|
|
The same coordinates always produce the same value (deterministic).
|
|
|
|
|
.PP
|
|
|
|
|
Args: dimensions: Number of input dimensions (1-4).
|
|
|
|
|
Default: 2.
|
|
|
|
|
algorithm: Noise algorithm - `simplex', `perlin', or `wavelet'.
|
|
|
|
|
Default: `simplex'.
|
|
|
|
|
hurst: Fractal Hurst exponent for fbm/turbulence (0.0-1.0).
|
|
|
|
|
Default: 0.5.
|
|
|
|
|
lacunarity: Frequency multiplier between octaves.
|
|
|
|
|
Default: 2.0.
|
|
|
|
|
seed: Random seed for reproducibility.
|
|
|
|
|
None for random seed.
|
|
|
|
|
.PP
|
|
|
|
|
Properties: dimensions (int): Read-only.
|
|
|
|
|
Number of input dimensions.
|
|
|
|
|
algorithm (str): Read-only.
|
|
|
|
|
Noise algorithm name.
|
|
|
|
|
hurst (float): Read-only.
|
|
|
|
|
Hurst exponent.
|
|
|
|
|
lacunarity (float): Read-only.
|
|
|
|
|
Lacunarity value.
|
|
|
|
|
seed (int): Read-only.
|
|
|
|
|
Seed used (even if originally None).
|
|
|
|
|
.PP
|
|
|
|
|
Example: noise = mcrfpy.NoiseSource(dimensions=2, algorithm=`simplex',
|
|
|
|
|
seed=42) value = noise.get((10.5, 20.3)) # Returns -1.0 to 1.0 fbm_val =
|
|
|
|
|
noise.fbm((10.5, 20.3), octaves=6)
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Properties:\f[R] - \f[V]algorithm\f[R] \f[I](read-only)\f[R]: Noise
|
|
|
|
|
algorithm name (`simplex', `perlin', or `wavelet').
|
|
|
|
|
Read-only.
|
|
|
|
|
- \f[V]dimensions\f[R] \f[I](read-only)\f[R]: Number of input dimensions
|
|
|
|
|
(1-4).
|
|
|
|
|
Read-only.
|
|
|
|
|
- \f[V]hurst\f[R] \f[I](read-only)\f[R]: Hurst exponent for
|
|
|
|
|
fbm/turbulence.
|
|
|
|
|
Read-only.
|
|
|
|
|
- \f[V]lacunarity\f[R] \f[I](read-only)\f[R]: Frequency multiplier
|
|
|
|
|
between octaves.
|
|
|
|
|
Read-only.
|
|
|
|
|
- \f[V]seed\f[R] \f[I](read-only)\f[R]: Random seed used (even if
|
|
|
|
|
originally None).
|
|
|
|
|
Read-only.
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Methods:\f[R]
|
|
|
|
|
.SS \f[V]fbm(pos: tuple[float, ...], octaves: int = 4) -> float\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Get fractal brownian motion value at coordinates.
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Arguments:\f[R] - \f[V]pos\f[R]: Position tuple with length
|
|
|
|
|
matching dimensions - \f[V]octaves\f[R]: Number of noise octaves to
|
|
|
|
|
combine (default: 4)
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Returns:\f[R] float: FBM noise value in range [-1.0, 1.0]
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Raises:\f[R] ValueError: Position tuple length doesn\[cq]t match
|
|
|
|
|
dimensions
|
|
|
|
|
.SS \f[V]get(pos: tuple[float, ...]) -> float\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Get flat noise value at coordinates.
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Arguments:\f[R] - \f[V]pos\f[R]: Position tuple with length
|
|
|
|
|
matching dimensions
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Returns:\f[R] float: Noise value in range [-1.0, 1.0]
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Raises:\f[R] ValueError: Position tuple length doesn\[cq]t match
|
|
|
|
|
dimensions
|
|
|
|
|
.SS \f[V]sample(size: tuple[int, int], world_origin: tuple[float, float] = (0.0, 0.0), world_size: tuple[float, float] = None, mode: str = \[aq]fbm\[aq], octaves: int = 4) -> HeightMap\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Sample noise into a HeightMap for batch processing.
|
|
|
|
|
.PP
|
|
|
|
|
Note:
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Arguments:\f[R] - \f[V]size\f[R]: Output dimensions in cells as
|
|
|
|
|
(width, height) - \f[V]world_origin\f[R]: World coordinates of top-left
|
|
|
|
|
corner (default: (0, 0)) - \f[V]world_size\f[R]: World area to sample
|
|
|
|
|
(default: same as size) - \f[V]mode\f[R]: Sampling mode: `flat', `fbm',
|
|
|
|
|
or `turbulence' (default: `fbm') - \f[V]octaves\f[R]: Octaves for
|
|
|
|
|
fbm/turbulence modes (default: 4)
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Returns:\f[R] HeightMap: New HeightMap filled with sampled noise
|
|
|
|
|
values Requires dimensions=2.
|
|
|
|
|
Values are in range [-1.0, 1.0].
|
|
|
|
|
.SS \f[V]turbulence(pos: tuple[float, ...], octaves: int = 4) -> float\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Get turbulence (absolute fbm) value at coordinates.
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Arguments:\f[R] - \f[V]pos\f[R]: Position tuple with length
|
|
|
|
|
matching dimensions - \f[V]octaves\f[R]: Number of noise octaves to
|
|
|
|
|
combine (default: 4)
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Returns:\f[R] float: Turbulence noise value in range [-1.0, 1.0]
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Raises:\f[R] ValueError: Position tuple length doesn\[cq]t match
|
|
|
|
|
dimensions
|
Replace UIEntity gridstate with DiscreteMap perspective_map; closes #294
Per-entity FOV memory moves from std::vector<UIGridPointState> (two-bool
visible/discovered pairs) to a 3-state DiscreteMap (0=UNKNOWN, 1=DISCOVERED,
2=VISIBLE), exposed as entity.perspective_map. The invariant
visible-subset-of-discovered becomes structural (single value per cell), and
the map is a live, serializable, first-class object rather than an implicit
internal array.
Changes:
- New DiscreteMap C++ class with shared ownership; PyDiscreteMapObject now
holds shared_ptr<DiscreteMap>. UIEntity holds the same shared_ptr.
- New mcrfpy.Perspective IntEnum (UNKNOWN/DISCOVERED/VISIBLE), modelled on
PyInputState.
- entity.perspective_map: lazy-allocated on first access with a grid;
setter validates size against grid and raises ValueError on mismatch;
None clears (next access lazy-reallocates fresh).
- updateVisibility() now demotes 2->1 then promotes visible cells to 2.
- entity.at(x, y) returns grid.at(x, y) when VISIBLE, else None.
- Fog-of-war rendering in UIGridView and UIGrid reads the 3-state map.
- Removed: UIEntity::gridstate, ensureGridstate(), entity.gridstate getter,
UIGridPointState struct + PyUIGridPointStateType.
- Obsolete tests deleted (test_gridpointstate_point,
issue_265_gridpointstate_dangle); 4 new tests cover lazy allocation,
identity, serialization round-trip, size validation, and the
visible-subset-of-discovered invariant.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-17 23:04:27 -04:00
|
|
|
.SS Perspective
|
Update documentation for API changes #229, #230, #184
CLAUDE.md updates:
- Fix Python version 3.12 -> 3.14
- Update keypressScene -> scene.on_key pattern
- Add API examples for new callback signatures
- Document animation callbacks (target, prop, value)
- Document hover callbacks (position-only)
- Document enum types (Key, MouseButton, InputState)
stubs/mcrfpy.pyi updates:
- Add Key, MouseButton, InputState, Easing enum classes
- Fix Drawable hover callback signatures per #230
- Fix Grid cell callback signatures per #230
- Fix Scene.on_key signature to use enums per #184
- Update Animation class with correct callback signature per #229
- Add deprecation notes to keypressScene, setTimer, delTimer
Regenerated docs:
- API_REFERENCE_DYNAMIC.md
- api_reference_dynamic.html
- mcrfpy.3 man page
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-28 19:20:04 -05:00
|
|
|
.PP
|
Replace UIEntity gridstate with DiscreteMap perspective_map; closes #294
Per-entity FOV memory moves from std::vector<UIGridPointState> (two-bool
visible/discovered pairs) to a 3-state DiscreteMap (0=UNKNOWN, 1=DISCOVERED,
2=VISIBLE), exposed as entity.perspective_map. The invariant
visible-subset-of-discovered becomes structural (single value per cell), and
the map is a live, serializable, first-class object rather than an implicit
internal array.
Changes:
- New DiscreteMap C++ class with shared ownership; PyDiscreteMapObject now
holds shared_ptr<DiscreteMap>. UIEntity holds the same shared_ptr.
- New mcrfpy.Perspective IntEnum (UNKNOWN/DISCOVERED/VISIBLE), modelled on
PyInputState.
- entity.perspective_map: lazy-allocated on first access with a grid;
setter validates size against grid and raises ValueError on mismatch;
None clears (next access lazy-reallocates fresh).
- updateVisibility() now demotes 2->1 then promotes visible cells to 2.
- entity.at(x, y) returns grid.at(x, y) when VISIBLE, else None.
- Fog-of-war rendering in UIGridView and UIGrid reads the 3-state map.
- Removed: UIEntity::gridstate, ensureGridstate(), entity.gridstate getter,
UIGridPointState struct + PyUIGridPointStateType.
- Obsolete tests deleted (test_gridpointstate_point,
issue_265_gridpointstate_dangle); 4 new tests cover lazy allocation,
identity, serialization round-trip, size validation, and the
visible-subset-of-discovered invariant.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-17 23:04:27 -04:00
|
|
|
\f[I]Inherits from: IntEnum\f[R]
|
Update documentation for API changes #229, #230, #184
CLAUDE.md updates:
- Fix Python version 3.12 -> 3.14
- Update keypressScene -> scene.on_key pattern
- Add API examples for new callback signatures
- Document animation callbacks (target, prop, value)
- Document hover callbacks (position-only)
- Document enum types (Key, MouseButton, InputState)
stubs/mcrfpy.pyi updates:
- Add Key, MouseButton, InputState, Easing enum classes
- Fix Drawable hover callback signatures per #230
- Fix Grid cell callback signatures per #230
- Fix Scene.on_key signature to use enums per #184
- Update Animation class with correct callback signature per #229
- Add deprecation notes to keypressScene, setTimer, delTimer
Regenerated docs:
- API_REFERENCE_DYNAMIC.md
- api_reference_dynamic.html
- mcrfpy.3 man page
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-28 19:20:04 -05:00
|
|
|
.PP
|
Replace UIEntity gridstate with DiscreteMap perspective_map; closes #294
Per-entity FOV memory moves from std::vector<UIGridPointState> (two-bool
visible/discovered pairs) to a 3-state DiscreteMap (0=UNKNOWN, 1=DISCOVERED,
2=VISIBLE), exposed as entity.perspective_map. The invariant
visible-subset-of-discovered becomes structural (single value per cell), and
the map is a live, serializable, first-class object rather than an implicit
internal array.
Changes:
- New DiscreteMap C++ class with shared ownership; PyDiscreteMapObject now
holds shared_ptr<DiscreteMap>. UIEntity holds the same shared_ptr.
- New mcrfpy.Perspective IntEnum (UNKNOWN/DISCOVERED/VISIBLE), modelled on
PyInputState.
- entity.perspective_map: lazy-allocated on first access with a grid;
setter validates size against grid and raises ValueError on mismatch;
None clears (next access lazy-reallocates fresh).
- updateVisibility() now demotes 2->1 then promotes visible cells to 2.
- entity.at(x, y) returns grid.at(x, y) when VISIBLE, else None.
- Fog-of-war rendering in UIGridView and UIGrid reads the 3-state map.
- Removed: UIEntity::gridstate, ensureGridstate(), entity.gridstate getter,
UIGridPointState struct + PyUIGridPointStateType.
- Obsolete tests deleted (test_gridpointstate_point,
issue_265_gridpointstate_dangle); 4 new tests cover lazy allocation,
identity, serialization round-trip, size validation, and the
visible-subset-of-discovered invariant.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-17 23:04:27 -04:00
|
|
|
Enum representing an entity\[cq]s knowledge of a cell.
|
Update documentation for API changes #229, #230, #184
CLAUDE.md updates:
- Fix Python version 3.12 -> 3.14
- Update keypressScene -> scene.on_key pattern
- Add API examples for new callback signatures
- Document animation callbacks (target, prop, value)
- Document hover callbacks (position-only)
- Document enum types (Key, MouseButton, InputState)
stubs/mcrfpy.pyi updates:
- Add Key, MouseButton, InputState, Easing enum classes
- Fix Drawable hover callback signatures per #230
- Fix Grid cell callback signatures per #230
- Fix Scene.on_key signature to use enums per #184
- Update Animation class with correct callback signature per #229
- Add deprecation notes to keypressScene, setTimer, delTimer
Regenerated docs:
- API_REFERENCE_DYNAMIC.md
- api_reference_dynamic.html
- mcrfpy.3 man page
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-28 19:20:04 -05:00
|
|
|
.PP
|
Replace UIEntity gridstate with DiscreteMap perspective_map; closes #294
Per-entity FOV memory moves from std::vector<UIGridPointState> (two-bool
visible/discovered pairs) to a 3-state DiscreteMap (0=UNKNOWN, 1=DISCOVERED,
2=VISIBLE), exposed as entity.perspective_map. The invariant
visible-subset-of-discovered becomes structural (single value per cell), and
the map is a live, serializable, first-class object rather than an implicit
internal array.
Changes:
- New DiscreteMap C++ class with shared ownership; PyDiscreteMapObject now
holds shared_ptr<DiscreteMap>. UIEntity holds the same shared_ptr.
- New mcrfpy.Perspective IntEnum (UNKNOWN/DISCOVERED/VISIBLE), modelled on
PyInputState.
- entity.perspective_map: lazy-allocated on first access with a grid;
setter validates size against grid and raises ValueError on mismatch;
None clears (next access lazy-reallocates fresh).
- updateVisibility() now demotes 2->1 then promotes visible cells to 2.
- entity.at(x, y) returns grid.at(x, y) when VISIBLE, else None.
- Fog-of-war rendering in UIGridView and UIGrid reads the 3-state map.
- Removed: UIEntity::gridstate, ensureGridstate(), entity.gridstate getter,
UIGridPointState struct + PyUIGridPointStateType.
- Obsolete tests deleted (test_gridpointstate_point,
issue_265_gridpointstate_dangle); 4 new tests cover lazy allocation,
identity, serialization round-trip, size validation, and the
visible-subset-of-discovered invariant.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-17 23:04:27 -04:00
|
|
|
Values: UNKNOWN: Never seen (perspective_map value 0) DISCOVERED: Seen
|
|
|
|
|
before but not currently visible (value 1) VISIBLE: In current FOV
|
|
|
|
|
(value 2)
|
Update documentation for API changes #229, #230, #184
CLAUDE.md updates:
- Fix Python version 3.12 -> 3.14
- Update keypressScene -> scene.on_key pattern
- Add API examples for new callback signatures
- Document animation callbacks (target, prop, value)
- Document hover callbacks (position-only)
- Document enum types (Key, MouseButton, InputState)
stubs/mcrfpy.pyi updates:
- Add Key, MouseButton, InputState, Easing enum classes
- Fix Drawable hover callback signatures per #230
- Fix Grid cell callback signatures per #230
- Fix Scene.on_key signature to use enums per #184
- Update Animation class with correct callback signature per #229
- Add deprecation notes to keypressScene, setTimer, delTimer
Regenerated docs:
- API_REFERENCE_DYNAMIC.md
- api_reference_dynamic.html
- mcrfpy.3 man page
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-28 19:20:04 -05:00
|
|
|
.PP
|
Replace UIEntity gridstate with DiscreteMap perspective_map; closes #294
Per-entity FOV memory moves from std::vector<UIGridPointState> (two-bool
visible/discovered pairs) to a 3-state DiscreteMap (0=UNKNOWN, 1=DISCOVERED,
2=VISIBLE), exposed as entity.perspective_map. The invariant
visible-subset-of-discovered becomes structural (single value per cell), and
the map is a live, serializable, first-class object rather than an implicit
internal array.
Changes:
- New DiscreteMap C++ class with shared ownership; PyDiscreteMapObject now
holds shared_ptr<DiscreteMap>. UIEntity holds the same shared_ptr.
- New mcrfpy.Perspective IntEnum (UNKNOWN/DISCOVERED/VISIBLE), modelled on
PyInputState.
- entity.perspective_map: lazy-allocated on first access with a grid;
setter validates size against grid and raises ValueError on mismatch;
None clears (next access lazy-reallocates fresh).
- updateVisibility() now demotes 2->1 then promotes visible cells to 2.
- entity.at(x, y) returns grid.at(x, y) when VISIBLE, else None.
- Fog-of-war rendering in UIGridView and UIGrid reads the 3-state map.
- Removed: UIEntity::gridstate, ensureGridstate(), entity.gridstate getter,
UIGridPointState struct + PyUIGridPointStateType.
- Obsolete tests deleted (test_gridpointstate_point,
issue_265_gridpointstate_dangle); 4 new tests cover lazy allocation,
identity, serialization round-trip, size validation, and the
visible-subset-of-discovered invariant.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-17 23:04:27 -04:00
|
|
|
\f[B]Properties:\f[R] - \f[V]denominator\f[R]: the denominator of a
|
|
|
|
|
rational number in lowest terms - \f[V]imag\f[R]: the imaginary part of
|
|
|
|
|
a complex number - \f[V]numerator\f[R]: the numerator of a rational
|
|
|
|
|
number in lowest terms - \f[V]real\f[R]: the real part of a complex
|
|
|
|
|
number
|
Update documentation for API changes #229, #230, #184
CLAUDE.md updates:
- Fix Python version 3.12 -> 3.14
- Update keypressScene -> scene.on_key pattern
- Add API examples for new callback signatures
- Document animation callbacks (target, prop, value)
- Document hover callbacks (position-only)
- Document enum types (Key, MouseButton, InputState)
stubs/mcrfpy.pyi updates:
- Add Key, MouseButton, InputState, Easing enum classes
- Fix Drawable hover callback signatures per #230
- Fix Grid cell callback signatures per #230
- Fix Scene.on_key signature to use enums per #184
- Update Animation class with correct callback signature per #229
- Add deprecation notes to keypressScene, setTimer, delTimer
Regenerated docs:
- API_REFERENCE_DYNAMIC.md
- api_reference_dynamic.html
- mcrfpy.3 man page
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-28 19:20:04 -05:00
|
|
|
.PP
|
|
|
|
|
\f[B]Methods:\f[R]
|
Replace UIEntity gridstate with DiscreteMap perspective_map; closes #294
Per-entity FOV memory moves from std::vector<UIGridPointState> (two-bool
visible/discovered pairs) to a 3-state DiscreteMap (0=UNKNOWN, 1=DISCOVERED,
2=VISIBLE), exposed as entity.perspective_map. The invariant
visible-subset-of-discovered becomes structural (single value per cell), and
the map is a live, serializable, first-class object rather than an implicit
internal array.
Changes:
- New DiscreteMap C++ class with shared ownership; PyDiscreteMapObject now
holds shared_ptr<DiscreteMap>. UIEntity holds the same shared_ptr.
- New mcrfpy.Perspective IntEnum (UNKNOWN/DISCOVERED/VISIBLE), modelled on
PyInputState.
- entity.perspective_map: lazy-allocated on first access with a grid;
setter validates size against grid and raises ValueError on mismatch;
None clears (next access lazy-reallocates fresh).
- updateVisibility() now demotes 2->1 then promotes visible cells to 2.
- entity.at(x, y) returns grid.at(x, y) when VISIBLE, else None.
- Fog-of-war rendering in UIGridView and UIGrid reads the 3-state map.
- Removed: UIEntity::gridstate, ensureGridstate(), entity.gridstate getter,
UIGridPointState struct + PyUIGridPointStateType.
- Obsolete tests deleted (test_gridpointstate_point,
issue_265_gridpointstate_dangle); 4 new tests cover lazy allocation,
identity, serialization round-trip, size validation, and the
visible-subset-of-discovered invariant.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-17 23:04:27 -04:00
|
|
|
.SS \f[V]as_integer_ratio(...)\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Return a pair of integers, whose ratio is equal to the original int.
|
|
|
|
|
The ratio is in lowest terms and has a positive denominator.
|
|
|
|
|
>>> (10).as_integer_ratio() (10, 1) >>> (-10).as_integer_ratio() (-10,
|
|
|
|
|
1) >>> (0).as_integer_ratio() (0, 1)
|
|
|
|
|
.SS \f[V]bit_count(...)\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Number of ones in the binary representation of the absolute value of
|
|
|
|
|
self.
|
|
|
|
|
Also known as the population count.
|
|
|
|
|
>>> bin(13) `0b1101' >>> (13).bit_count() 3
|
|
|
|
|
.SS \f[V]bit_length(...)\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Number of bits necessary to represent self in binary.
|
|
|
|
|
>>> bin(37) `0b100101' >>> (37).bit_length() 6
|
|
|
|
|
.SS \f[V]conjugate(...)\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Returns self, the complex conjugate of any int.
|
|
|
|
|
.SS \f[V]from_bytes(...)\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Return the integer represented by the given array of bytes.
|
|
|
|
|
bytes Holds the array of bytes to convert.
|
|
|
|
|
The argument must either support the buffer protocol or be an iterable
|
|
|
|
|
object producing bytes.
|
|
|
|
|
Bytes and bytearray are examples of built-in objects that support the
|
|
|
|
|
buffer protocol.
|
|
|
|
|
byteorder The byte order used to represent the integer.
|
|
|
|
|
If byteorder is `big', the most significant byte is at the beginning of
|
|
|
|
|
the byte array.
|
|
|
|
|
If byteorder is `little', the most significant byte is at the end of the
|
|
|
|
|
byte array.
|
|
|
|
|
To request the native byte order of the host system, use sys.byteorder
|
|
|
|
|
as the byte order value.
|
|
|
|
|
Default is to use `big'.
|
|
|
|
|
signed Indicates whether two\[cq]s complement is used to represent the
|
|
|
|
|
integer.
|
|
|
|
|
.SS \f[V]is_integer(...)\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Returns True.
|
|
|
|
|
Exists for duck type compatibility with float.is_integer.
|
|
|
|
|
.SS \f[V]to_bytes(...)\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Return an array of bytes representing an integer.
|
|
|
|
|
length Length of bytes object to use.
|
|
|
|
|
An OverflowError is raised if the integer is not representable with the
|
|
|
|
|
given number of bytes.
|
|
|
|
|
Default is length 1.
|
|
|
|
|
byteorder The byte order used to represent the integer.
|
|
|
|
|
If byteorder is `big', the most significant byte is at the beginning of
|
|
|
|
|
the byte array.
|
|
|
|
|
If byteorder is `little', the most significant byte is at the end of the
|
|
|
|
|
byte array.
|
|
|
|
|
To request the native byte order of the host system, use sys.byteorder
|
|
|
|
|
as the byte order value.
|
|
|
|
|
Default is to use `big'.
|
|
|
|
|
signed Determines whether two\[cq]s complement is used to represent the
|
|
|
|
|
integer.
|
|
|
|
|
If signed is False and a negative integer is given, an OverflowError is
|
|
|
|
|
raised.
|
|
|
|
|
.SS PropertyBinding
|
|
|
|
|
.PP
|
|
|
|
|
PropertyBinding(target: UIDrawable, property: str)
|
|
|
|
|
.PP
|
|
|
|
|
A binding that reads a property value from a UI drawable.
|
|
|
|
|
.PP
|
|
|
|
|
Args: target: The drawable to read the property from property: Name of
|
|
|
|
|
the property to read (e.g., `x', `opacity')
|
|
|
|
|
.PP
|
|
|
|
|
Use this to create dynamic shader uniforms that follow a drawable\[cq]s
|
|
|
|
|
properties.
|
|
|
|
|
The binding automatically handles cases where the target is destroyed.
|
|
|
|
|
.PP
|
|
|
|
|
Example: other_frame = mcrfpy.Frame(pos=(100, 100))
|
|
|
|
|
frame.uniforms[`offset_x'] = mcrfpy.PropertyBinding(other_frame, `x')
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Properties:\f[R] - \f[V]is_valid\f[R] \f[I](read-only)\f[R]: True
|
|
|
|
|
if the binding target still exists and property is valid (bool,
|
|
|
|
|
read-only).
|
|
|
|
|
- \f[V]property\f[R] \f[I](read-only)\f[R]: The property name being read
|
|
|
|
|
(str, read-only).
|
|
|
|
|
- \f[V]target\f[R] \f[I](read-only)\f[R]: The drawable this binding
|
|
|
|
|
reads from (read-only).
|
|
|
|
|
- \f[V]value\f[R] \f[I](read-only)\f[R]: Current value of the binding
|
|
|
|
|
(float, read-only).
|
|
|
|
|
Returns None if invalid.
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Methods:\f[R]
|
|
|
|
|
.SS Scene
|
|
|
|
|
.PP
|
|
|
|
|
Scene(name: str)
|
2026-01-23 20:49:11 -05:00
|
|
|
.PP
|
|
|
|
|
Object-oriented scene management with lifecycle callbacks.
|
|
|
|
|
.PP
|
|
|
|
|
This is the recommended approach for scene management, replacing
|
|
|
|
|
module-level functions like createScene(), setScene(), and sceneUI().
|
|
|
|
|
Key advantage: you can set on_key handlers on ANY scene, not just the
|
|
|
|
|
currently active one.
|
|
|
|
|
.PP
|
|
|
|
|
Args: name: Unique identifier for this scene.
|
|
|
|
|
Used for scene transitions.
|
|
|
|
|
.PP
|
|
|
|
|
Properties: name (str, read-only): Scene\[cq]s unique identifier.
|
|
|
|
|
active (bool, read-only): Whether this scene is currently displayed.
|
|
|
|
|
children (UICollection, read-only): UI elements in this scene.
|
|
|
|
|
Modify to add/remove elements.
|
|
|
|
|
on_key (callable): Keyboard handler.
|
|
|
|
|
Set on ANY scene, regardless of which is active!
|
|
|
|
|
pos (Vector): Position offset for all UI elements.
|
|
|
|
|
visible (bool): Whether the scene renders.
|
|
|
|
|
opacity (float): Scene transparency (0.0-1.0).
|
|
|
|
|
.PP
|
|
|
|
|
Lifecycle Callbacks (override in subclass): on_enter(): Called when
|
|
|
|
|
scene becomes active via activate().
|
|
|
|
|
on_exit(): Called when scene is deactivated (another scene activates).
|
|
|
|
|
on_key(key: str, action: str): Called for keyboard events (subclass
|
|
|
|
|
method).
|
|
|
|
|
update(dt: float): Called every frame with delta time in seconds.
|
|
|
|
|
on_resize(new_size: Vector): Called when window is resized.
|
|
|
|
|
.PP
|
|
|
|
|
Example: # Basic usage (replacing module functions): scene =
|
|
|
|
|
mcrfpy.Scene(`main_menu')
|
|
|
|
|
scene.children.append(mcrfpy.Caption(text=`Welcome', pos=(100, 100)))
|
|
|
|
|
scene.on_key = lambda key, action: print(f\[cq]Key: {key}\[cq])
|
|
|
|
|
scene.activate() # Switch to this scene
|
|
|
|
|
.IP
|
|
|
|
|
.nf
|
|
|
|
|
\f[C]
|
|
|
|
|
# Subclassing for lifecycle:
|
|
|
|
|
class GameScene(mcrfpy.Scene):
|
|
|
|
|
def on_enter(self):
|
|
|
|
|
print(\[aq]Game started!\[aq])
|
|
|
|
|
def update(self, dt):
|
|
|
|
|
self.player.move(dt)
|
|
|
|
|
\f[R]
|
|
|
|
|
.fi
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Properties:\f[R] - \f[V]active\f[R] \f[I](read-only)\f[R]: Whether
|
|
|
|
|
this scene is currently active (bool, read-only).
|
|
|
|
|
Only one scene can be active at a time.
|
|
|
|
|
- \f[V]children\f[R] \f[I](read-only)\f[R]: UI element collection for
|
|
|
|
|
this scene (UICollection, read-only).
|
|
|
|
|
Use to add, remove, or iterate over UI elements.
|
|
|
|
|
Changes are reflected immediately.
|
|
|
|
|
- \f[V]name\f[R] \f[I](read-only)\f[R]: Scene name (str, read-only).
|
|
|
|
|
Unique identifier for this scene.
|
|
|
|
|
- \f[V]on_key\f[R]: Keyboard event handler (callable or None).
|
Update documentation for API changes #229, #230, #184
CLAUDE.md updates:
- Fix Python version 3.12 -> 3.14
- Update keypressScene -> scene.on_key pattern
- Add API examples for new callback signatures
- Document animation callbacks (target, prop, value)
- Document hover callbacks (position-only)
- Document enum types (Key, MouseButton, InputState)
stubs/mcrfpy.pyi updates:
- Add Key, MouseButton, InputState, Easing enum classes
- Fix Drawable hover callback signatures per #230
- Fix Grid cell callback signatures per #230
- Fix Scene.on_key signature to use enums per #184
- Update Animation class with correct callback signature per #229
- Add deprecation notes to keypressScene, setTimer, delTimer
Regenerated docs:
- API_REFERENCE_DYNAMIC.md
- api_reference_dynamic.html
- mcrfpy.3 man page
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-28 19:20:04 -05:00
|
|
|
Function receives (key: Key, action: InputState) for keyboard events.
|
2026-01-23 20:49:11 -05:00
|
|
|
Set to None to remove the handler.
|
|
|
|
|
- \f[V]opacity\f[R]: Scene opacity (0.0-1.0).
|
|
|
|
|
Applied to all UI elements during rendering.
|
|
|
|
|
- \f[V]pos\f[R]: Scene position offset (Vector).
|
|
|
|
|
Applied to all UI elements during rendering.
|
Replace UIEntity gridstate with DiscreteMap perspective_map; closes #294
Per-entity FOV memory moves from std::vector<UIGridPointState> (two-bool
visible/discovered pairs) to a 3-state DiscreteMap (0=UNKNOWN, 1=DISCOVERED,
2=VISIBLE), exposed as entity.perspective_map. The invariant
visible-subset-of-discovered becomes structural (single value per cell), and
the map is a live, serializable, first-class object rather than an implicit
internal array.
Changes:
- New DiscreteMap C++ class with shared ownership; PyDiscreteMapObject now
holds shared_ptr<DiscreteMap>. UIEntity holds the same shared_ptr.
- New mcrfpy.Perspective IntEnum (UNKNOWN/DISCOVERED/VISIBLE), modelled on
PyInputState.
- entity.perspective_map: lazy-allocated on first access with a grid;
setter validates size against grid and raises ValueError on mismatch;
None clears (next access lazy-reallocates fresh).
- updateVisibility() now demotes 2->1 then promotes visible cells to 2.
- entity.at(x, y) returns grid.at(x, y) when VISIBLE, else None.
- Fog-of-war rendering in UIGridView and UIGrid reads the 3-state map.
- Removed: UIEntity::gridstate, ensureGridstate(), entity.gridstate getter,
UIGridPointState struct + PyUIGridPointStateType.
- Obsolete tests deleted (test_gridpointstate_point,
issue_265_gridpointstate_dangle); 4 new tests cover lazy allocation,
identity, serialization round-trip, size validation, and the
visible-subset-of-discovered invariant.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-17 23:04:27 -04:00
|
|
|
- \f[V]registered\f[R] \f[I](read-only)\f[R]: Whether this scene is
|
|
|
|
|
registered with the game engine (bool, read-only).
|
|
|
|
|
Unregistered scenes still exist but won\[cq]t receive lifecycle
|
|
|
|
|
callbacks.
|
2026-01-23 20:49:11 -05:00
|
|
|
- \f[V]visible\f[R]: Scene visibility (bool).
|
|
|
|
|
If False, scene is not rendered.
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Methods:\f[R]
|
|
|
|
|
.SS \f[V]activate(transition: Transition = None, duration: float = None) -> None\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Make this the active scene with optional transition effect.
|
|
|
|
|
.PP
|
|
|
|
|
Note:
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Arguments:\f[R] - \f[V]transition\f[R]: Transition type
|
|
|
|
|
(mcrfpy.Transition enum).
|
|
|
|
|
Defaults to mcrfpy.default_transition - \f[V]duration\f[R]: Transition
|
|
|
|
|
duration in seconds.
|
|
|
|
|
Defaults to mcrfpy.default_transition_duration
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Returns:\f[R] None Deactivates the current scene and activates this
|
|
|
|
|
one.
|
|
|
|
|
Lifecycle callbacks (on_exit, on_enter) are triggered.
|
|
|
|
|
.SS \f[V]realign() -> None\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Recalculate alignment for all children with alignment set.
|
|
|
|
|
.PP
|
|
|
|
|
Note: Call this after window resize or when game_resolution changes.
|
|
|
|
|
For responsive layouts, connect this to on_resize callback.
|
Replace UIEntity gridstate with DiscreteMap perspective_map; closes #294
Per-entity FOV memory moves from std::vector<UIGridPointState> (two-bool
visible/discovered pairs) to a 3-state DiscreteMap (0=UNKNOWN, 1=DISCOVERED,
2=VISIBLE), exposed as entity.perspective_map. The invariant
visible-subset-of-discovered becomes structural (single value per cell), and
the map is a live, serializable, first-class object rather than an implicit
internal array.
Changes:
- New DiscreteMap C++ class with shared ownership; PyDiscreteMapObject now
holds shared_ptr<DiscreteMap>. UIEntity holds the same shared_ptr.
- New mcrfpy.Perspective IntEnum (UNKNOWN/DISCOVERED/VISIBLE), modelled on
PyInputState.
- entity.perspective_map: lazy-allocated on first access with a grid;
setter validates size against grid and raises ValueError on mismatch;
None clears (next access lazy-reallocates fresh).
- updateVisibility() now demotes 2->1 then promotes visible cells to 2.
- entity.at(x, y) returns grid.at(x, y) when VISIBLE, else None.
- Fog-of-war rendering in UIGridView and UIGrid reads the 3-state map.
- Removed: UIEntity::gridstate, ensureGridstate(), entity.gridstate getter,
UIGridPointState struct + PyUIGridPointStateType.
- Obsolete tests deleted (test_gridpointstate_point,
issue_265_gridpointstate_dangle); 4 new tests cover lazy allocation,
identity, serialization round-trip, size validation, and the
visible-subset-of-discovered invariant.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-17 23:04:27 -04:00
|
|
|
.SS \f[V]register() -> None\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Register this scene with the game engine.
|
|
|
|
|
.PP
|
|
|
|
|
Note: Makes the scene available for activation and receives lifecycle
|
|
|
|
|
callbacks.
|
|
|
|
|
If another scene with the same name exists, it will be unregistered
|
|
|
|
|
first.
|
|
|
|
|
Called automatically by activate() if needed.
|
|
|
|
|
.SS \f[V]unregister() -> None\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Unregister this scene from the game engine.
|
|
|
|
|
.PP
|
|
|
|
|
Note: Removes the scene from the engine\[cq]s registry but keeps the
|
|
|
|
|
Python object alive.
|
|
|
|
|
The scene\[cq]s UI elements and state are preserved.
|
|
|
|
|
Call register() to re-add it.
|
|
|
|
|
Useful for temporary scenes or scene pooling.
|
Update documentation for API changes #229, #230, #184
CLAUDE.md updates:
- Fix Python version 3.12 -> 3.14
- Update keypressScene -> scene.on_key pattern
- Add API examples for new callback signatures
- Document animation callbacks (target, prop, value)
- Document hover callbacks (position-only)
- Document enum types (Key, MouseButton, InputState)
stubs/mcrfpy.pyi updates:
- Add Key, MouseButton, InputState, Easing enum classes
- Fix Drawable hover callback signatures per #230
- Fix Grid cell callback signatures per #230
- Fix Scene.on_key signature to use enums per #184
- Update Animation class with correct callback signature per #229
- Add deprecation notes to keypressScene, setTimer, delTimer
Regenerated docs:
- API_REFERENCE_DYNAMIC.md
- api_reference_dynamic.html
- mcrfpy.3 man page
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-28 19:20:04 -05:00
|
|
|
.SS Shader
|
|
|
|
|
.PP
|
|
|
|
|
Shader(fragment_source: str, dynamic: bool = False)
|
|
|
|
|
.PP
|
|
|
|
|
A GPU shader program for visual effects.
|
|
|
|
|
.PP
|
|
|
|
|
Args: fragment_source: GLSL fragment shader source code dynamic: If
|
|
|
|
|
True, shader uses time-varying effects and will invalidate parent caches
|
|
|
|
|
each frame
|
|
|
|
|
.PP
|
|
|
|
|
Shaders enable GPU-accelerated visual effects like glow, distortion,
|
|
|
|
|
color manipulation, and more.
|
|
|
|
|
Assign to drawable.shader to apply.
|
|
|
|
|
.PP
|
|
|
|
|
Engine-provided uniforms (automatically available): - float time:
|
|
|
|
|
Seconds since engine start - float delta_time: Seconds since last frame
|
|
|
|
|
- vec2 resolution: Texture size in pixels - vec2 mouse: Mouse position
|
|
|
|
|
in window coordinates
|
|
|
|
|
.PP
|
|
|
|
|
Example: shader = mcrfpy.Shader(\[cq]\[cq]\[cq] uniform sampler2D
|
|
|
|
|
texture; uniform float time; void main() { vec2 uv = gl_TexCoord[0].xy;
|
|
|
|
|
vec4 color = texture2D(texture, uv); color.rgb \f[I]= 0.5 + 0.5 \f[R]
|
|
|
|
|
sin(time); gl_FragColor = color; } \[cq]\[cq]\[cq], dynamic=True)
|
|
|
|
|
frame.shader = shader
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Properties:\f[R] - \f[V]dynamic\f[R]: Whether this shader uses
|
|
|
|
|
time-varying effects (bool).
|
|
|
|
|
Dynamic shaders invalidate parent caches each frame.
|
|
|
|
|
- \f[V]is_valid\f[R] \f[I](read-only)\f[R]: True if the shader compiled
|
|
|
|
|
successfully (bool, read-only).
|
|
|
|
|
- \f[V]source\f[R] \f[I](read-only)\f[R]: The GLSL fragment shader
|
|
|
|
|
source code (str, read-only).
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Methods:\f[R]
|
|
|
|
|
.SS \f[V]set_uniform(name: str, value: float|tuple) -> None\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Set a custom uniform value on this shader.
|
|
|
|
|
.PP
|
|
|
|
|
Note:
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Arguments:\f[R] - \f[V]name\f[R]: Uniform variable name in the
|
|
|
|
|
shader - \f[V]value\f[R]: Float, vec2 (2-tuple), vec3 (3-tuple), or vec4
|
|
|
|
|
(4-tuple)
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Raises:\f[R] ValueError: If uniform type cannot be determined
|
|
|
|
|
Engine uniforms (time, resolution, etc.)
|
|
|
|
|
are set automatically
|
2026-01-23 20:49:11 -05:00
|
|
|
.SS Sound
|
|
|
|
|
.PP
|
Replace UIEntity gridstate with DiscreteMap perspective_map; closes #294
Per-entity FOV memory moves from std::vector<UIGridPointState> (two-bool
visible/discovered pairs) to a 3-state DiscreteMap (0=UNKNOWN, 1=DISCOVERED,
2=VISIBLE), exposed as entity.perspective_map. The invariant
visible-subset-of-discovered becomes structural (single value per cell), and
the map is a live, serializable, first-class object rather than an implicit
internal array.
Changes:
- New DiscreteMap C++ class with shared ownership; PyDiscreteMapObject now
holds shared_ptr<DiscreteMap>. UIEntity holds the same shared_ptr.
- New mcrfpy.Perspective IntEnum (UNKNOWN/DISCOVERED/VISIBLE), modelled on
PyInputState.
- entity.perspective_map: lazy-allocated on first access with a grid;
setter validates size against grid and raises ValueError on mismatch;
None clears (next access lazy-reallocates fresh).
- updateVisibility() now demotes 2->1 then promotes visible cells to 2.
- entity.at(x, y) returns grid.at(x, y) when VISIBLE, else None.
- Fog-of-war rendering in UIGridView and UIGrid reads the 3-state map.
- Removed: UIEntity::gridstate, ensureGridstate(), entity.gridstate getter,
UIGridPointState struct + PyUIGridPointStateType.
- Obsolete tests deleted (test_gridpointstate_point,
issue_265_gridpointstate_dangle); 4 new tests cover lazy allocation,
identity, serialization round-trip, size validation, and the
visible-subset-of-discovered invariant.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-17 23:04:27 -04:00
|
|
|
Sound(source)
|
2026-01-23 20:49:11 -05:00
|
|
|
.PP
|
Replace UIEntity gridstate with DiscreteMap perspective_map; closes #294
Per-entity FOV memory moves from std::vector<UIGridPointState> (two-bool
visible/discovered pairs) to a 3-state DiscreteMap (0=UNKNOWN, 1=DISCOVERED,
2=VISIBLE), exposed as entity.perspective_map. The invariant
visible-subset-of-discovered becomes structural (single value per cell), and
the map is a live, serializable, first-class object rather than an implicit
internal array.
Changes:
- New DiscreteMap C++ class with shared ownership; PyDiscreteMapObject now
holds shared_ptr<DiscreteMap>. UIEntity holds the same shared_ptr.
- New mcrfpy.Perspective IntEnum (UNKNOWN/DISCOVERED/VISIBLE), modelled on
PyInputState.
- entity.perspective_map: lazy-allocated on first access with a grid;
setter validates size against grid and raises ValueError on mismatch;
None clears (next access lazy-reallocates fresh).
- updateVisibility() now demotes 2->1 then promotes visible cells to 2.
- entity.at(x, y) returns grid.at(x, y) when VISIBLE, else None.
- Fog-of-war rendering in UIGridView and UIGrid reads the 3-state map.
- Removed: UIEntity::gridstate, ensureGridstate(), entity.gridstate getter,
UIGridPointState struct + PyUIGridPointStateType.
- Obsolete tests deleted (test_gridpointstate_point,
issue_265_gridpointstate_dangle); 4 new tests cover lazy allocation,
identity, serialization round-trip, size validation, and the
visible-subset-of-discovered invariant.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-17 23:04:27 -04:00
|
|
|
Sound effect object for short audio clips.
|
|
|
|
|
.PP
|
|
|
|
|
Args: source: Filename string or SoundBuffer object.
|
|
|
|
|
.PP
|
|
|
|
|
Properties: volume (float): Volume 0-100.
|
|
|
|
|
loop (bool): Whether to loop.
|
|
|
|
|
playing (bool, read-only): True if playing.
|
|
|
|
|
duration (float, read-only): Duration in seconds.
|
|
|
|
|
source (str, read-only): Source filename.
|
|
|
|
|
pitch (float): Playback pitch (1.0 = normal).
|
|
|
|
|
buffer (SoundBuffer, read-only): The SoundBuffer, if created from one.
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Properties:\f[R] - \f[V]buffer\f[R] \f[I](read-only)\f[R]: The
|
|
|
|
|
SoundBuffer if created from one, else None (read-only).
|
|
|
|
|
- \f[V]duration\f[R] \f[I](read-only)\f[R]: Total duration of the sound
|
|
|
|
|
in seconds (read-only).
|
2026-01-23 20:49:11 -05:00
|
|
|
- \f[V]loop\f[R]: Whether the sound loops when it reaches the end.
|
Replace UIEntity gridstate with DiscreteMap perspective_map; closes #294
Per-entity FOV memory moves from std::vector<UIGridPointState> (two-bool
visible/discovered pairs) to a 3-state DiscreteMap (0=UNKNOWN, 1=DISCOVERED,
2=VISIBLE), exposed as entity.perspective_map. The invariant
visible-subset-of-discovered becomes structural (single value per cell), and
the map is a live, serializable, first-class object rather than an implicit
internal array.
Changes:
- New DiscreteMap C++ class with shared ownership; PyDiscreteMapObject now
holds shared_ptr<DiscreteMap>. UIEntity holds the same shared_ptr.
- New mcrfpy.Perspective IntEnum (UNKNOWN/DISCOVERED/VISIBLE), modelled on
PyInputState.
- entity.perspective_map: lazy-allocated on first access with a grid;
setter validates size against grid and raises ValueError on mismatch;
None clears (next access lazy-reallocates fresh).
- updateVisibility() now demotes 2->1 then promotes visible cells to 2.
- entity.at(x, y) returns grid.at(x, y) when VISIBLE, else None.
- Fog-of-war rendering in UIGridView and UIGrid reads the 3-state map.
- Removed: UIEntity::gridstate, ensureGridstate(), entity.gridstate getter,
UIGridPointState struct + PyUIGridPointStateType.
- Obsolete tests deleted (test_gridpointstate_point,
issue_265_gridpointstate_dangle); 4 new tests cover lazy allocation,
identity, serialization round-trip, size validation, and the
visible-subset-of-discovered invariant.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-17 23:04:27 -04:00
|
|
|
- \f[V]pitch\f[R]: Playback pitch multiplier (1.0 = normal, >1 = higher,
|
|
|
|
|
<1 = lower).
|
2026-01-23 20:49:11 -05:00
|
|
|
- \f[V]playing\f[R] \f[I](read-only)\f[R]: True if the sound is
|
|
|
|
|
currently playing (read-only).
|
|
|
|
|
- \f[V]source\f[R] \f[I](read-only)\f[R]: Filename path used to load
|
|
|
|
|
this sound (read-only).
|
|
|
|
|
- \f[V]volume\f[R]: Volume level from 0 (silent) to 100 (full volume).
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Methods:\f[R]
|
|
|
|
|
.SS \f[V]pause() -> None\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Pause the sound.
|
|
|
|
|
Use play() to resume from the paused position.
|
|
|
|
|
.SS \f[V]play() -> None\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Start or resume playing the sound.
|
Replace UIEntity gridstate with DiscreteMap perspective_map; closes #294
Per-entity FOV memory moves from std::vector<UIGridPointState> (two-bool
visible/discovered pairs) to a 3-state DiscreteMap (0=UNKNOWN, 1=DISCOVERED,
2=VISIBLE), exposed as entity.perspective_map. The invariant
visible-subset-of-discovered becomes structural (single value per cell), and
the map is a live, serializable, first-class object rather than an implicit
internal array.
Changes:
- New DiscreteMap C++ class with shared ownership; PyDiscreteMapObject now
holds shared_ptr<DiscreteMap>. UIEntity holds the same shared_ptr.
- New mcrfpy.Perspective IntEnum (UNKNOWN/DISCOVERED/VISIBLE), modelled on
PyInputState.
- entity.perspective_map: lazy-allocated on first access with a grid;
setter validates size against grid and raises ValueError on mismatch;
None clears (next access lazy-reallocates fresh).
- updateVisibility() now demotes 2->1 then promotes visible cells to 2.
- entity.at(x, y) returns grid.at(x, y) when VISIBLE, else None.
- Fog-of-war rendering in UIGridView and UIGrid reads the 3-state map.
- Removed: UIEntity::gridstate, ensureGridstate(), entity.gridstate getter,
UIGridPointState struct + PyUIGridPointStateType.
- Obsolete tests deleted (test_gridpointstate_point,
issue_265_gridpointstate_dangle); 4 new tests cover lazy allocation,
identity, serialization round-trip, size validation, and the
visible-subset-of-discovered invariant.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-17 23:04:27 -04:00
|
|
|
.SS \f[V]play_varied(pitch_range: float = 0.1, volume_range: float = 3.0) -> None\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Play with randomized pitch and volume for natural variation.
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Arguments:\f[R] - \f[V]pitch_range\f[R]: Random pitch offset range
|
|
|
|
|
(default 0.1) - \f[V]volume_range\f[R]: Random volume offset range
|
|
|
|
|
(default 3.0)
|
2026-01-23 20:49:11 -05:00
|
|
|
.SS \f[V]stop() -> None\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Stop playing and reset to the beginning.
|
Replace UIEntity gridstate with DiscreteMap perspective_map; closes #294
Per-entity FOV memory moves from std::vector<UIGridPointState> (two-bool
visible/discovered pairs) to a 3-state DiscreteMap (0=UNKNOWN, 1=DISCOVERED,
2=VISIBLE), exposed as entity.perspective_map. The invariant
visible-subset-of-discovered becomes structural (single value per cell), and
the map is a live, serializable, first-class object rather than an implicit
internal array.
Changes:
- New DiscreteMap C++ class with shared ownership; PyDiscreteMapObject now
holds shared_ptr<DiscreteMap>. UIEntity holds the same shared_ptr.
- New mcrfpy.Perspective IntEnum (UNKNOWN/DISCOVERED/VISIBLE), modelled on
PyInputState.
- entity.perspective_map: lazy-allocated on first access with a grid;
setter validates size against grid and raises ValueError on mismatch;
None clears (next access lazy-reallocates fresh).
- updateVisibility() now demotes 2->1 then promotes visible cells to 2.
- entity.at(x, y) returns grid.at(x, y) when VISIBLE, else None.
- Fog-of-war rendering in UIGridView and UIGrid reads the 3-state map.
- Removed: UIEntity::gridstate, ensureGridstate(), entity.gridstate getter,
UIGridPointState struct + PyUIGridPointStateType.
- Obsolete tests deleted (test_gridpointstate_point,
issue_265_gridpointstate_dangle); 4 new tests cover lazy allocation,
identity, serialization round-trip, size validation, and the
visible-subset-of-discovered invariant.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-17 23:04:27 -04:00
|
|
|
.SS SoundBuffer
|
|
|
|
|
.PP
|
|
|
|
|
SoundBuffer(filename: str) SoundBuffer.from_samples(data: bytes,
|
|
|
|
|
channels: int, sample_rate: int) SoundBuffer.tone(frequency: float,
|
|
|
|
|
duration: float, waveform: str = `sine', \&...)
|
|
|
|
|
SoundBuffer.sfxr(preset: str, seed: int = None)
|
|
|
|
|
.PP
|
|
|
|
|
Audio sample buffer for procedural audio generation and effects.
|
|
|
|
|
.PP
|
|
|
|
|
Holds PCM sample data that can be created from files, raw samples, tone
|
|
|
|
|
synthesis, or sfxr presets.
|
|
|
|
|
Effect methods return new SoundBuffer instances (copy-modify pattern).
|
|
|
|
|
.PP
|
|
|
|
|
Properties: duration (float, read-only): Duration in seconds.
|
|
|
|
|
sample_count (int, read-only): Total number of samples.
|
|
|
|
|
sample_rate (int, read-only): Samples per second (e.g.\ 44100).
|
|
|
|
|
channels (int, read-only): Number of audio channels.
|
|
|
|
|
sfxr_params (dict or None, read-only): sfxr parameters if
|
|
|
|
|
sfxr-generated.
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Properties:\f[R] - \f[V]channels\f[R] \f[I](read-only)\f[R]: Number
|
|
|
|
|
of audio channels (read-only).
|
|
|
|
|
- \f[V]duration\f[R] \f[I](read-only)\f[R]: Total duration in seconds
|
|
|
|
|
(read-only).
|
|
|
|
|
- \f[V]sample_count\f[R] \f[I](read-only)\f[R]: Total number of samples
|
|
|
|
|
(read-only).
|
|
|
|
|
- \f[V]sample_rate\f[R] \f[I](read-only)\f[R]: Sample rate in Hz
|
|
|
|
|
(read-only).
|
|
|
|
|
- \f[V]sfxr_params\f[R] \f[I](read-only)\f[R]: Dict of sfxr parameters
|
|
|
|
|
if sfxr-generated, else None (read-only).
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Methods:\f[R]
|
|
|
|
|
.SS \f[V]bit_crush(bits: int, rate_divisor: int) -> SoundBuffer\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Reduce bit depth and sample rate for lo-fi effect.
|
|
|
|
|
.SS \f[V]concat(buffers: list[SoundBuffer], overlap: float = 0.0) -> SoundBuffer\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Concatenate multiple SoundBuffers with optional crossfade overlap.
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Arguments:\f[R] - \f[V]buffers\f[R]: List of SoundBuffer objects to
|
|
|
|
|
concatenate - \f[V]overlap\f[R]: Crossfade overlap duration in seconds
|
|
|
|
|
.SS \f[V]distortion(drive: float) -> SoundBuffer\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Apply tanh soft clipping distortion.
|
|
|
|
|
.SS \f[V]echo(delay_ms: float, feedback: float, wet: float) -> SoundBuffer\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Apply echo effect with delay, feedback, and wet/dry mix.
|
|
|
|
|
.SS \f[V]from_samples(data: bytes, channels: int, sample_rate: int) -> SoundBuffer\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Create a SoundBuffer from raw int16 PCM sample data.
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Arguments:\f[R] - \f[V]data\f[R]: Raw PCM data as bytes (int16
|
|
|
|
|
little-endian) - \f[V]channels\f[R]: Number of audio channels (1=mono,
|
|
|
|
|
2=stereo) - \f[V]sample_rate\f[R]: Sample rate in Hz (e.g.\ 44100)
|
|
|
|
|
.SS \f[V]gain(factor: float) -> SoundBuffer\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Multiply all samples by a scalar factor.
|
|
|
|
|
Use for volume/amplitude control before mixing.
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Arguments:\f[R] - \f[V]factor\f[R]: Amplitude multiplier (0.5 =
|
|
|
|
|
half volume, 2.0 = double).
|
|
|
|
|
Clamps to int16 range.
|
|
|
|
|
.SS \f[V]high_pass(cutoff_hz: float) -> SoundBuffer\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Apply single-pole IIR high-pass filter.
|
|
|
|
|
.SS \f[V]low_pass(cutoff_hz: float) -> SoundBuffer\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Apply single-pole IIR low-pass filter.
|
|
|
|
|
.SS \f[V]mix(buffers: list[SoundBuffer]) -> SoundBuffer\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Mix multiple SoundBuffers together (additive, clamped).
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Arguments:\f[R] - \f[V]buffers\f[R]: List of SoundBuffer objects to
|
|
|
|
|
mix
|
|
|
|
|
.SS \f[V]normalize() -> SoundBuffer\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Scale samples to 95%% of int16 max.
|
|
|
|
|
.SS \f[V]pitch_shift(factor: float) -> SoundBuffer\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Resample to shift pitch.
|
|
|
|
|
factor>1 = higher+shorter.
|
|
|
|
|
.SS \f[V]reverb(room_size: float, damping: float, wet: float) -> SoundBuffer\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Apply simplified Freeverb-style reverb.
|
|
|
|
|
.SS \f[V]reverse() -> SoundBuffer\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Reverse the sample order.
|
|
|
|
|
.SS \f[V]sfxr(preset: str = None, seed: int = None, **params) -> SoundBuffer\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Generate retro sound effects using sfxr synthesis.
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Arguments:\f[R] - \f[V]preset\f[R]: One of: coin, laser, explosion,
|
|
|
|
|
powerup, hurt, jump, blip - \f[V]seed\f[R]: Random seed for
|
|
|
|
|
deterministic generation
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Returns:\f[R] SoundBuffer with sfxr_params set for later mutation
|
|
|
|
|
.SS \f[V]sfxr_mutate(amount: float = 0.05, seed: int = None) -> SoundBuffer\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Jitter sfxr params and re-synthesize.
|
|
|
|
|
Only works on sfxr-generated buffers.
|
|
|
|
|
.SS \f[V]slice(start: float, end: float) -> SoundBuffer\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Extract a time range in seconds.
|
|
|
|
|
.SS \f[V]tone(frequency: float, duration: float, waveform: str = \[aq]sine\[aq], ...) -> SoundBuffer\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Generate a tone with optional ADSR envelope.
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Arguments:\f[R] - \f[V]frequency\f[R]: Frequency in Hz -
|
|
|
|
|
\f[V]duration\f[R]: Duration in seconds - \f[V]waveform\f[R]: One of:
|
|
|
|
|
sine, square, saw, triangle, noise - \f[V]attack\f[R]: ADSR attack time
|
|
|
|
|
in seconds (default 0.01) - \f[V]decay\f[R]: ADSR decay time in seconds
|
|
|
|
|
(default 0.0) - \f[V]sustain\f[R]: ADSR sustain level 0.0-1.0 (default
|
|
|
|
|
1.0) - \f[V]release\f[R]: ADSR release time in seconds (default 0.01)
|
2026-01-23 20:49:11 -05:00
|
|
|
.SS Sprite
|
|
|
|
|
.PP
|
|
|
|
|
\f[I]Inherits from: Drawable\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Sprite(pos=None, texture=None, sprite_index=0, **kwargs)
|
|
|
|
|
.PP
|
|
|
|
|
A sprite UI element that displays a texture or portion of a texture
|
|
|
|
|
atlas.
|
|
|
|
|
.PP
|
|
|
|
|
Args: pos (tuple, optional): Position as (x, y) tuple.
|
|
|
|
|
Default: (0, 0) texture (Texture, optional): Texture object to display.
|
|
|
|
|
Default: default texture sprite_index (int, optional): Index into
|
|
|
|
|
texture atlas.
|
|
|
|
|
Default: 0
|
|
|
|
|
.PP
|
|
|
|
|
Keyword Args: scale (float): Uniform scale factor.
|
|
|
|
|
Default: 1.0 scale_x (float): Horizontal scale factor.
|
|
|
|
|
Default: 1.0 scale_y (float): Vertical scale factor.
|
|
|
|
|
Default: 1.0 click (callable): Click event handler.
|
|
|
|
|
Default: None visible (bool): Visibility state.
|
|
|
|
|
Default: True opacity (float): Opacity (0.0-1.0).
|
|
|
|
|
Default: 1.0 z_index (int): Rendering order.
|
|
|
|
|
Default: 0 name (str): Element name for finding.
|
|
|
|
|
Default: None x (float): X position override.
|
|
|
|
|
Default: 0 y (float): Y position override.
|
|
|
|
|
Default: 0 align (Alignment): Alignment relative to parent.
|
|
|
|
|
Default: None margin (float): Margin from parent edge when aligned.
|
|
|
|
|
Default: 0 horiz_margin (float): Horizontal margin override.
|
|
|
|
|
Default: 0 (use margin) vert_margin (float): Vertical margin override.
|
|
|
|
|
Default: 0 (use margin)
|
|
|
|
|
.PP
|
|
|
|
|
Attributes: x, y (float): Position in pixels pos (Vector): Position as a
|
|
|
|
|
Vector object texture (Texture): The texture being displayed
|
|
|
|
|
sprite_index (int): Current sprite index in texture atlas scale (float):
|
|
|
|
|
Uniform scale factor scale_x, scale_y (float): Individual scale factors
|
|
|
|
|
click (callable): Click event handler visible (bool): Visibility state
|
|
|
|
|
opacity (float): Opacity value z_index (int): Rendering order name
|
|
|
|
|
(str): Element name w, h (float): Read-only computed size based on
|
|
|
|
|
texture and scale align (Alignment): Alignment relative to parent (or
|
|
|
|
|
None) margin (float): General margin for alignment horiz_margin (float):
|
|
|
|
|
Horizontal margin override vert_margin (float): Vertical margin override
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Properties:\f[R] - \f[V]align\f[R]: Alignment relative to parent
|
|
|
|
|
bounds (Alignment enum or None).
|
|
|
|
|
When set, position is automatically calculated when parent is assigned
|
|
|
|
|
or resized.
|
|
|
|
|
Set to None to disable alignment and use manual positioning.
|
F15: correct docstring accuracy from adversarial verify pass (#314)
Follow-up to the macro conversion: an adversarial verify pass (one agent per
file vs. the C++ implementation + stubs) found 62 content issues; the real
ones are fixed here.
Callbacks (centralized):
- on_click: receives (pos, MouseButton, InputState), not str (8 files).
- on_enter/on_exit/on_move (UIBase.h): hover passes only (pos) -- removed the
fictional button/action args.
- bounds/global_bounds (UIBase.h): mark (tuple, read-only).
Signatures / types:
- Grid.find_path: document heuristic + weight; get_dijkstra_map: document roots;
compute_fov: FOV | int = FOV.BASIC (not the C constant FOV_BASIC) + Returns;
at/is_in_fov: document (pos) and (x, y) call forms.
- get_metrics: document all 16 returned dict keys (was 8); bresenham: drop the
bogus '*' keyword-only separator.
- Nullable defaults typed correctly: BSP seed/size, ColorLayer draw_fov/
apply_perspective Color|None, Entity.visible_entities radius int=-1 (None is
rejected by the 'i' parser -> see #319).
- Type-token fixes: GridView.center -> Vector; GridView.texture -> (None,
read-only) (unimplemented, #318); GridPoint.grid_pos -> (tuple, read-only);
EntityCollection.find -> Entity | list[Entity] | None; extend RuntimeError;
UniformCollection.values -> list[float | tuple | None].
- automation: onScreen (x, y) form documented; scroll notes x is ignored (#317).
Also: correct stale AStarPath/DijkstraMap signatures in docs/api-audit-2026-04.md
(the bindings were right, the audit table was outdated). Rebaseline the API
snapshot golden and regenerate docs/stubs.
Code-level bugs surfaced by the pass are filed as #317, #318, #319.
Refs #314, #317, #318, #319
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 06:43:47 -04:00
|
|
|
- \f[V]bounds\f[R] \f[I](read-only)\f[R]: Axis-aligned bounding box
|
|
|
|
|
(tuple, read-only) as a (pos, size) pair of Vectors: (Vector(x, y),
|
|
|
|
|
Vector(width, height)).
|
|
|
|
|
- \f[V]global_bounds\f[R] \f[I](read-only)\f[R]: Axis-aligned bounding
|
|
|
|
|
box in screen coordinates (tuple, read-only) as a (pos, size) pair of
|
|
|
|
|
Vectors: (Vector(x, y), Vector(width, height)).
|
2026-01-23 20:49:11 -05:00
|
|
|
- \f[V]global_position\f[R] \f[I](read-only)\f[R]: Global screen
|
|
|
|
|
position (read-only).
|
|
|
|
|
Calculates absolute position by walking up the parent chain.
|
F15: convert frozen binding docstrings to MCRF_* macros (#314)
Convert 289 raw PyMethodDef/PyGetSetDef docstring slots to MCRF_METHOD /
MCRF_PROPERTY across the 20 frozen (non-3D) binding files, bringing the
frozen surface to 100% macro compliance (check_frozen_docstrings.sh PASS).
Done via a one-agent-per-file workflow gated by validate_file_docstrings.sh
and per-wave build/doc-rebuild checks.
- Adds #include "McRFPy_Doc.h" where missing; fills the lone genuine doc
gap (UIGrid.at, which was MISSING a doc field in two arrays).
- McRFPy_Doc.h: comment documenting the MCRF_METHOD_DOC comma rule (the
trap that broke the GridLayers conversion mid-run).
- Rebaseline api_surface golden: property types now resolve to real types
instead of "Any" (e.g. grid_pos: Vector, on_cell_click: Callable | None),
and 11 properties correctly flip rw->ro now that their docstrings carry
"read-only" (collections, grid_size, hovered_cell, texture, view — all
verified against NULL setter slots).
- Regenerate docs/stubs/man page from the new docstrings.
Module-level functions use MCRF_METHOD(<name>, ...) (expands identically to
the intended MCRF_FUNCTION; the audit's compliance set is METHOD/PROPERTY).
Experimental 3D/Voxel bindings (src/3d/) remain exempt from the freeze.
Pre-existing failures unrelated to this change: test_animation_*,
test_constructor_comprehensive (reference the removed mcrfpy.Animation and
old constructor arity).
Refs #314
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 01:20:55 -04:00
|
|
|
- \f[V]grid_pos\f[R]: Position in grid tile coordinates (Vector, only
|
|
|
|
|
when parent is Grid).
|
|
|
|
|
- \f[V]grid_size\f[R]: Size in grid tile coordinates (Vector, only when
|
|
|
|
|
parent is Grid).
|
|
|
|
|
- \f[V]horiz_margin\f[R]: Horizontal margin override (float, 0 = use
|
|
|
|
|
general margin).
|
2026-01-23 20:49:11 -05:00
|
|
|
Invalid for vertically-centered alignments (TOP_CENTER, BOTTOM_CENTER,
|
|
|
|
|
CENTER).
|
|
|
|
|
- \f[V]hovered\f[R] \f[I](read-only)\f[R]: Whether mouse is currently
|
|
|
|
|
over this element (read-only).
|
|
|
|
|
Updated automatically by the engine during mouse movement.
|
|
|
|
|
- \f[V]margin\f[R]: General margin from edge when aligned (float).
|
|
|
|
|
Applied to both horizontal and vertical edges unless overridden.
|
|
|
|
|
Invalid for CENTER alignment (raises ValueError).
|
F15: convert frozen binding docstrings to MCRF_* macros (#314)
Convert 289 raw PyMethodDef/PyGetSetDef docstring slots to MCRF_METHOD /
MCRF_PROPERTY across the 20 frozen (non-3D) binding files, bringing the
frozen surface to 100% macro compliance (check_frozen_docstrings.sh PASS).
Done via a one-agent-per-file workflow gated by validate_file_docstrings.sh
and per-wave build/doc-rebuild checks.
- Adds #include "McRFPy_Doc.h" where missing; fills the lone genuine doc
gap (UIGrid.at, which was MISSING a doc field in two arrays).
- McRFPy_Doc.h: comment documenting the MCRF_METHOD_DOC comma rule (the
trap that broke the GridLayers conversion mid-run).
- Rebaseline api_surface golden: property types now resolve to real types
instead of "Any" (e.g. grid_pos: Vector, on_cell_click: Callable | None),
and 11 properties correctly flip rw->ro now that their docstrings carry
"read-only" (collections, grid_size, hovered_cell, texture, view — all
verified against NULL setter slots).
- Regenerate docs/stubs/man page from the new docstrings.
Module-level functions use MCRF_METHOD(<name>, ...) (expands identically to
the intended MCRF_FUNCTION; the audit's compliance set is METHOD/PROPERTY).
Experimental 3D/Voxel bindings (src/3d/) remain exempt from the freeze.
Pre-existing failures unrelated to this change: test_animation_*,
test_constructor_comprehensive (reference the removed mcrfpy.Animation and
old constructor arity).
Refs #314
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 01:20:55 -04:00
|
|
|
- \f[V]name\f[R]: Name for finding elements (str).
|
|
|
|
|
- \f[V]on_click\f[R]: Callable executed when object is clicked.
|
F15: correct docstring accuracy from adversarial verify pass (#314)
Follow-up to the macro conversion: an adversarial verify pass (one agent per
file vs. the C++ implementation + stubs) found 62 content issues; the real
ones are fixed here.
Callbacks (centralized):
- on_click: receives (pos, MouseButton, InputState), not str (8 files).
- on_enter/on_exit/on_move (UIBase.h): hover passes only (pos) -- removed the
fictional button/action args.
- bounds/global_bounds (UIBase.h): mark (tuple, read-only).
Signatures / types:
- Grid.find_path: document heuristic + weight; get_dijkstra_map: document roots;
compute_fov: FOV | int = FOV.BASIC (not the C constant FOV_BASIC) + Returns;
at/is_in_fov: document (pos) and (x, y) call forms.
- get_metrics: document all 16 returned dict keys (was 8); bresenham: drop the
bogus '*' keyword-only separator.
- Nullable defaults typed correctly: BSP seed/size, ColorLayer draw_fov/
apply_perspective Color|None, Entity.visible_entities radius int=-1 (None is
rejected by the 'i' parser -> see #319).
- Type-token fixes: GridView.center -> Vector; GridView.texture -> (None,
read-only) (unimplemented, #318); GridPoint.grid_pos -> (tuple, read-only);
EntityCollection.find -> Entity | list[Entity] | None; extend RuntimeError;
UniformCollection.values -> list[float | tuple | None].
- automation: onScreen (x, y) form documented; scroll notes x is ignored (#317).
Also: correct stale AStarPath/DijkstraMap signatures in docs/api-audit-2026-04.md
(the bindings were right, the audit table was outdated). Rebaseline the API
snapshot golden and regenerate docs/stubs.
Code-level bugs surfaced by the pass are filed as #317, #318, #319.
Refs #314, #317, #318, #319
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 06:43:47 -04:00
|
|
|
Function receives (pos: Vector, button: MouseButton, action:
|
|
|
|
|
InputState).
|
2026-01-23 20:49:11 -05:00
|
|
|
- \f[V]on_enter\f[R]: Callback for mouse enter events.
|
F15: correct docstring accuracy from adversarial verify pass (#314)
Follow-up to the macro conversion: an adversarial verify pass (one agent per
file vs. the C++ implementation + stubs) found 62 content issues; the real
ones are fixed here.
Callbacks (centralized):
- on_click: receives (pos, MouseButton, InputState), not str (8 files).
- on_enter/on_exit/on_move (UIBase.h): hover passes only (pos) -- removed the
fictional button/action args.
- bounds/global_bounds (UIBase.h): mark (tuple, read-only).
Signatures / types:
- Grid.find_path: document heuristic + weight; get_dijkstra_map: document roots;
compute_fov: FOV | int = FOV.BASIC (not the C constant FOV_BASIC) + Returns;
at/is_in_fov: document (pos) and (x, y) call forms.
- get_metrics: document all 16 returned dict keys (was 8); bresenham: drop the
bogus '*' keyword-only separator.
- Nullable defaults typed correctly: BSP seed/size, ColorLayer draw_fov/
apply_perspective Color|None, Entity.visible_entities radius int=-1 (None is
rejected by the 'i' parser -> see #319).
- Type-token fixes: GridView.center -> Vector; GridView.texture -> (None,
read-only) (unimplemented, #318); GridPoint.grid_pos -> (tuple, read-only);
EntityCollection.find -> Entity | list[Entity] | None; extend RuntimeError;
UniformCollection.values -> list[float | tuple | None].
- automation: onScreen (x, y) form documented; scroll notes x is ignored (#317).
Also: correct stale AStarPath/DijkstraMap signatures in docs/api-audit-2026-04.md
(the bindings were right, the audit table was outdated). Rebaseline the API
snapshot golden and regenerate docs/stubs.
Code-level bugs surfaced by the pass are filed as #317, #318, #319.
Refs #314, #317, #318, #319
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 06:43:47 -04:00
|
|
|
Called with (pos: Vector) when mouse enters this element\[cq]s bounds.
|
2026-01-23 20:49:11 -05:00
|
|
|
- \f[V]on_exit\f[R]: Callback for mouse exit events.
|
F15: correct docstring accuracy from adversarial verify pass (#314)
Follow-up to the macro conversion: an adversarial verify pass (one agent per
file vs. the C++ implementation + stubs) found 62 content issues; the real
ones are fixed here.
Callbacks (centralized):
- on_click: receives (pos, MouseButton, InputState), not str (8 files).
- on_enter/on_exit/on_move (UIBase.h): hover passes only (pos) -- removed the
fictional button/action args.
- bounds/global_bounds (UIBase.h): mark (tuple, read-only).
Signatures / types:
- Grid.find_path: document heuristic + weight; get_dijkstra_map: document roots;
compute_fov: FOV | int = FOV.BASIC (not the C constant FOV_BASIC) + Returns;
at/is_in_fov: document (pos) and (x, y) call forms.
- get_metrics: document all 16 returned dict keys (was 8); bresenham: drop the
bogus '*' keyword-only separator.
- Nullable defaults typed correctly: BSP seed/size, ColorLayer draw_fov/
apply_perspective Color|None, Entity.visible_entities radius int=-1 (None is
rejected by the 'i' parser -> see #319).
- Type-token fixes: GridView.center -> Vector; GridView.texture -> (None,
read-only) (unimplemented, #318); GridPoint.grid_pos -> (tuple, read-only);
EntityCollection.find -> Entity | list[Entity] | None; extend RuntimeError;
UniformCollection.values -> list[float | tuple | None].
- automation: onScreen (x, y) form documented; scroll notes x is ignored (#317).
Also: correct stale AStarPath/DijkstraMap signatures in docs/api-audit-2026-04.md
(the bindings were right, the audit table was outdated). Rebaseline the API
snapshot golden and regenerate docs/stubs.
Code-level bugs surfaced by the pass are filed as #317, #318, #319.
Refs #314, #317, #318, #319
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 06:43:47 -04:00
|
|
|
Called with (pos: Vector) when mouse leaves this element\[cq]s bounds.
|
2026-01-23 20:49:11 -05:00
|
|
|
- \f[V]on_move\f[R]: Callback for mouse movement within bounds.
|
F15: correct docstring accuracy from adversarial verify pass (#314)
Follow-up to the macro conversion: an adversarial verify pass (one agent per
file vs. the C++ implementation + stubs) found 62 content issues; the real
ones are fixed here.
Callbacks (centralized):
- on_click: receives (pos, MouseButton, InputState), not str (8 files).
- on_enter/on_exit/on_move (UIBase.h): hover passes only (pos) -- removed the
fictional button/action args.
- bounds/global_bounds (UIBase.h): mark (tuple, read-only).
Signatures / types:
- Grid.find_path: document heuristic + weight; get_dijkstra_map: document roots;
compute_fov: FOV | int = FOV.BASIC (not the C constant FOV_BASIC) + Returns;
at/is_in_fov: document (pos) and (x, y) call forms.
- get_metrics: document all 16 returned dict keys (was 8); bresenham: drop the
bogus '*' keyword-only separator.
- Nullable defaults typed correctly: BSP seed/size, ColorLayer draw_fov/
apply_perspective Color|None, Entity.visible_entities radius int=-1 (None is
rejected by the 'i' parser -> see #319).
- Type-token fixes: GridView.center -> Vector; GridView.texture -> (None,
read-only) (unimplemented, #318); GridPoint.grid_pos -> (tuple, read-only);
EntityCollection.find -> Entity | list[Entity] | None; extend RuntimeError;
UniformCollection.values -> list[float | tuple | None].
- automation: onScreen (x, y) form documented; scroll notes x is ignored (#317).
Also: correct stale AStarPath/DijkstraMap signatures in docs/api-audit-2026-04.md
(the bindings were right, the audit table was outdated). Rebaseline the API
snapshot golden and regenerate docs/stubs.
Code-level bugs surfaced by the pass are filed as #317, #318, #319.
Refs #314, #317, #318, #319
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 06:43:47 -04:00
|
|
|
Called with (pos: Vector) for each mouse movement while inside.
|
2026-01-23 20:49:11 -05:00
|
|
|
Performance note: Called frequently during movement - keep handlers
|
|
|
|
|
fast.
|
|
|
|
|
- \f[V]opacity\f[R]: Opacity level (0.0 = transparent, 1.0 = opaque).
|
|
|
|
|
Automatically clamped to valid range [0.0, 1.0].
|
Update documentation for API changes #229, #230, #184
CLAUDE.md updates:
- Fix Python version 3.12 -> 3.14
- Update keypressScene -> scene.on_key pattern
- Add API examples for new callback signatures
- Document animation callbacks (target, prop, value)
- Document hover callbacks (position-only)
- Document enum types (Key, MouseButton, InputState)
stubs/mcrfpy.pyi updates:
- Add Key, MouseButton, InputState, Easing enum classes
- Fix Drawable hover callback signatures per #230
- Fix Grid cell callback signatures per #230
- Fix Scene.on_key signature to use enums per #184
- Update Animation class with correct callback signature per #229
- Add deprecation notes to keypressScene, setTimer, delTimer
Regenerated docs:
- API_REFERENCE_DYNAMIC.md
- api_reference_dynamic.html
- mcrfpy.3 man page
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-28 19:20:04 -05:00
|
|
|
- \f[V]origin\f[R]: Transform origin as Vector (pivot point for
|
|
|
|
|
rotation).
|
|
|
|
|
Default (0,0) is top-left; set to (w/2, h/2) to rotate around center.
|
2026-01-23 20:49:11 -05:00
|
|
|
- \f[V]parent\f[R]: Parent drawable.
|
|
|
|
|
Get: Returns the parent Frame/Grid if nested, or None if at scene level.
|
|
|
|
|
Set: Assign a Frame/Grid to reparent, or None to remove from parent.
|
F15: convert frozen binding docstrings to MCRF_* macros (#314)
Convert 289 raw PyMethodDef/PyGetSetDef docstring slots to MCRF_METHOD /
MCRF_PROPERTY across the 20 frozen (non-3D) binding files, bringing the
frozen surface to 100% macro compliance (check_frozen_docstrings.sh PASS).
Done via a one-agent-per-file workflow gated by validate_file_docstrings.sh
and per-wave build/doc-rebuild checks.
- Adds #include "McRFPy_Doc.h" where missing; fills the lone genuine doc
gap (UIGrid.at, which was MISSING a doc field in two arrays).
- McRFPy_Doc.h: comment documenting the MCRF_METHOD_DOC comma rule (the
trap that broke the GridLayers conversion mid-run).
- Rebaseline api_surface golden: property types now resolve to real types
instead of "Any" (e.g. grid_pos: Vector, on_cell_click: Callable | None),
and 11 properties correctly flip rw->ro now that their docstrings carry
"read-only" (collections, grid_size, hovered_cell, texture, view — all
verified against NULL setter slots).
- Regenerate docs/stubs/man page from the new docstrings.
Module-level functions use MCRF_METHOD(<name>, ...) (expands identically to
the intended MCRF_FUNCTION; the audit's compliance set is METHOD/PROPERTY).
Experimental 3D/Voxel bindings (src/3d/) remain exempt from the freeze.
Pre-existing failures unrelated to this change: test_animation_*,
test_constructor_comprehensive (reference the removed mcrfpy.Animation and
old constructor arity).
Refs #314
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 01:20:55 -04:00
|
|
|
- \f[V]pos\f[R]: Position as a Vector (Vector).
|
|
|
|
|
- \f[V]rotate_with_camera\f[R]: Whether to rotate visually with parent
|
|
|
|
|
Grid\[cq]s camera_rotation (bool).
|
Update documentation for API changes #229, #230, #184
CLAUDE.md updates:
- Fix Python version 3.12 -> 3.14
- Update keypressScene -> scene.on_key pattern
- Add API examples for new callback signatures
- Document animation callbacks (target, prop, value)
- Document hover callbacks (position-only)
- Document enum types (Key, MouseButton, InputState)
stubs/mcrfpy.pyi updates:
- Add Key, MouseButton, InputState, Easing enum classes
- Fix Drawable hover callback signatures per #230
- Fix Grid cell callback signatures per #230
- Fix Scene.on_key signature to use enums per #184
- Update Animation class with correct callback signature per #229
- Add deprecation notes to keypressScene, setTimer, delTimer
Regenerated docs:
- API_REFERENCE_DYNAMIC.md
- api_reference_dynamic.html
- mcrfpy.3 man page
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-28 19:20:04 -05:00
|
|
|
False (default): stay screen-aligned.
|
|
|
|
|
True: tilt with camera.
|
|
|
|
|
Only affects children of UIGrid; ignored for other parents.
|
|
|
|
|
- \f[V]rotation\f[R]: Rotation angle in degrees (clockwise around
|
|
|
|
|
origin).
|
|
|
|
|
Animatable property.
|
F15: convert frozen binding docstrings to MCRF_* macros (#314)
Convert 289 raw PyMethodDef/PyGetSetDef docstring slots to MCRF_METHOD /
MCRF_PROPERTY across the 20 frozen (non-3D) binding files, bringing the
frozen surface to 100% macro compliance (check_frozen_docstrings.sh PASS).
Done via a one-agent-per-file workflow gated by validate_file_docstrings.sh
and per-wave build/doc-rebuild checks.
- Adds #include "McRFPy_Doc.h" where missing; fills the lone genuine doc
gap (UIGrid.at, which was MISSING a doc field in two arrays).
- McRFPy_Doc.h: comment documenting the MCRF_METHOD_DOC comma rule (the
trap that broke the GridLayers conversion mid-run).
- Rebaseline api_surface golden: property types now resolve to real types
instead of "Any" (e.g. grid_pos: Vector, on_cell_click: Callable | None),
and 11 properties correctly flip rw->ro now that their docstrings carry
"read-only" (collections, grid_size, hovered_cell, texture, view — all
verified against NULL setter slots).
- Regenerate docs/stubs/man page from the new docstrings.
Module-level functions use MCRF_METHOD(<name>, ...) (expands identically to
the intended MCRF_FUNCTION; the audit's compliance set is METHOD/PROPERTY).
Experimental 3D/Voxel bindings (src/3d/) remain exempt from the freeze.
Pre-existing failures unrelated to this change: test_animation_*,
test_constructor_comprehensive (reference the removed mcrfpy.Animation and
old constructor arity).
Refs #314
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 01:20:55 -04:00
|
|
|
- \f[V]scale\f[R]: Uniform size factor (float).
|
|
|
|
|
Sets both horizontal and vertical scale to the same value.
|
|
|
|
|
- \f[V]scale_x\f[R]: Horizontal scale factor (float).
|
|
|
|
|
- \f[V]scale_y\f[R]: Vertical scale factor (float).
|
|
|
|
|
- \f[V]shader\f[R]: Shader for GPU visual effects (Shader or None).
|
Update documentation for API changes #229, #230, #184
CLAUDE.md updates:
- Fix Python version 3.12 -> 3.14
- Update keypressScene -> scene.on_key pattern
- Add API examples for new callback signatures
- Document animation callbacks (target, prop, value)
- Document hover callbacks (position-only)
- Document enum types (Key, MouseButton, InputState)
stubs/mcrfpy.pyi updates:
- Add Key, MouseButton, InputState, Easing enum classes
- Fix Drawable hover callback signatures per #230
- Fix Grid cell callback signatures per #230
- Fix Scene.on_key signature to use enums per #184
- Update Animation class with correct callback signature per #229
- Add deprecation notes to keypressScene, setTimer, delTimer
Regenerated docs:
- API_REFERENCE_DYNAMIC.md
- api_reference_dynamic.html
- mcrfpy.3 man page
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-28 19:20:04 -05:00
|
|
|
When set, the drawable is rendered through the shader program.
|
|
|
|
|
Set to None to disable shader effects.
|
F15: convert frozen binding docstrings to MCRF_* macros (#314)
Convert 289 raw PyMethodDef/PyGetSetDef docstring slots to MCRF_METHOD /
MCRF_PROPERTY across the 20 frozen (non-3D) binding files, bringing the
frozen surface to 100% macro compliance (check_frozen_docstrings.sh PASS).
Done via a one-agent-per-file workflow gated by validate_file_docstrings.sh
and per-wave build/doc-rebuild checks.
- Adds #include "McRFPy_Doc.h" where missing; fills the lone genuine doc
gap (UIGrid.at, which was MISSING a doc field in two arrays).
- McRFPy_Doc.h: comment documenting the MCRF_METHOD_DOC comma rule (the
trap that broke the GridLayers conversion mid-run).
- Rebaseline api_surface golden: property types now resolve to real types
instead of "Any" (e.g. grid_pos: Vector, on_cell_click: Callable | None),
and 11 properties correctly flip rw->ro now that their docstrings carry
"read-only" (collections, grid_size, hovered_cell, texture, view — all
verified against NULL setter slots).
- Regenerate docs/stubs/man page from the new docstrings.
Module-level functions use MCRF_METHOD(<name>, ...) (expands identically to
the intended MCRF_FUNCTION; the audit's compliance set is METHOD/PROPERTY).
Experimental 3D/Voxel bindings (src/3d/) remain exempt from the freeze.
Pre-existing failures unrelated to this change: test_animation_*,
test_constructor_comprehensive (reference the removed mcrfpy.Animation and
old constructor arity).
Refs #314
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 01:20:55 -04:00
|
|
|
- \f[V]sprite_index\f[R]: Which sprite on the texture is shown (int).
|
|
|
|
|
Index into the texture atlas; must be in range [0, sprite_count).
|
|
|
|
|
- \f[V]texture\f[R]: Texture object (Texture).
|
|
|
|
|
The texture atlas from which sprites are drawn.
|
|
|
|
|
- \f[V]uniforms\f[R] \f[I](read-only)\f[R]: Collection of shader
|
|
|
|
|
uniforms (read-only access to collection).
|
Update documentation for API changes #229, #230, #184
CLAUDE.md updates:
- Fix Python version 3.12 -> 3.14
- Update keypressScene -> scene.on_key pattern
- Add API examples for new callback signatures
- Document animation callbacks (target, prop, value)
- Document hover callbacks (position-only)
- Document enum types (Key, MouseButton, InputState)
stubs/mcrfpy.pyi updates:
- Add Key, MouseButton, InputState, Easing enum classes
- Fix Drawable hover callback signatures per #230
- Fix Grid cell callback signatures per #230
- Fix Scene.on_key signature to use enums per #184
- Update Animation class with correct callback signature per #229
- Add deprecation notes to keypressScene, setTimer, delTimer
Regenerated docs:
- API_REFERENCE_DYNAMIC.md
- api_reference_dynamic.html
- mcrfpy.3 man page
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-28 19:20:04 -05:00
|
|
|
Set uniforms via dict-like syntax: drawable.uniforms[`name'] = value.
|
|
|
|
|
Supports float, vec2/3/4 tuples, PropertyBinding, and CallableBinding.
|
|
|
|
|
- \f[V]vert_margin\f[R]: Vertical margin override (float, 0 = use
|
|
|
|
|
general margin).
|
2026-01-23 20:49:11 -05:00
|
|
|
Invalid for horizontally-centered alignments (CENTER_LEFT, CENTER_RIGHT,
|
|
|
|
|
CENTER).
|
|
|
|
|
- \f[V]visible\f[R]: Whether the object is visible (bool).
|
|
|
|
|
Invisible objects are not rendered or clickable.
|
F15: convert frozen binding docstrings to MCRF_* macros (#314)
Convert 289 raw PyMethodDef/PyGetSetDef docstring slots to MCRF_METHOD /
MCRF_PROPERTY across the 20 frozen (non-3D) binding files, bringing the
frozen surface to 100% macro compliance (check_frozen_docstrings.sh PASS).
Done via a one-agent-per-file workflow gated by validate_file_docstrings.sh
and per-wave build/doc-rebuild checks.
- Adds #include "McRFPy_Doc.h" where missing; fills the lone genuine doc
gap (UIGrid.at, which was MISSING a doc field in two arrays).
- McRFPy_Doc.h: comment documenting the MCRF_METHOD_DOC comma rule (the
trap that broke the GridLayers conversion mid-run).
- Rebaseline api_surface golden: property types now resolve to real types
instead of "Any" (e.g. grid_pos: Vector, on_cell_click: Callable | None),
and 11 properties correctly flip rw->ro now that their docstrings carry
"read-only" (collections, grid_size, hovered_cell, texture, view — all
verified against NULL setter slots).
- Regenerate docs/stubs/man page from the new docstrings.
Module-level functions use MCRF_METHOD(<name>, ...) (expands identically to
the intended MCRF_FUNCTION; the audit's compliance set is METHOD/PROPERTY).
Experimental 3D/Voxel bindings (src/3d/) remain exempt from the freeze.
Pre-existing failures unrelated to this change: test_animation_*,
test_constructor_comprehensive (reference the removed mcrfpy.Animation and
old constructor arity).
Refs #314
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 01:20:55 -04:00
|
|
|
- \f[V]x\f[R]: X coordinate of top-left corner (float).
|
|
|
|
|
- \f[V]y\f[R]: Y coordinate of top-left corner (float).
|
|
|
|
|
- \f[V]z_index\f[R]: Z-order for rendering (lower values rendered
|
|
|
|
|
first).
|
2026-01-23 20:49:11 -05:00
|
|
|
Automatically triggers scene resort when changed.
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Methods:\f[R]
|
Replace UIEntity gridstate with DiscreteMap perspective_map; closes #294
Per-entity FOV memory moves from std::vector<UIGridPointState> (two-bool
visible/discovered pairs) to a 3-state DiscreteMap (0=UNKNOWN, 1=DISCOVERED,
2=VISIBLE), exposed as entity.perspective_map. The invariant
visible-subset-of-discovered becomes structural (single value per cell), and
the map is a live, serializable, first-class object rather than an implicit
internal array.
Changes:
- New DiscreteMap C++ class with shared ownership; PyDiscreteMapObject now
holds shared_ptr<DiscreteMap>. UIEntity holds the same shared_ptr.
- New mcrfpy.Perspective IntEnum (UNKNOWN/DISCOVERED/VISIBLE), modelled on
PyInputState.
- entity.perspective_map: lazy-allocated on first access with a grid;
setter validates size against grid and raises ValueError on mismatch;
None clears (next access lazy-reallocates fresh).
- updateVisibility() now demotes 2->1 then promotes visible cells to 2.
- entity.at(x, y) returns grid.at(x, y) when VISIBLE, else None.
- Fog-of-war rendering in UIGridView and UIGrid reads the 3-state map.
- Removed: UIEntity::gridstate, ensureGridstate(), entity.gridstate getter,
UIGridPointState struct + PyUIGridPointStateType.
- Obsolete tests deleted (test_gridpointstate_point,
issue_265_gridpointstate_dangle); 4 new tests cover lazy allocation,
identity, serialization round-trip, size validation, and the
visible-subset-of-discovered invariant.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-17 23:04:27 -04:00
|
|
|
.SS \f[V]animate(property: str, target: Any, duration: float, easing=None, delta=False, loop=False, callback=None, conflict_mode=\[aq]replace\[aq]) -> Animation\f[R]
|
2026-01-23 20:49:11 -05:00
|
|
|
.PP
|
|
|
|
|
Create and start an animation on this drawable\[cq]s property.
|
|
|
|
|
.PP
|
|
|
|
|
Note:
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Arguments:\f[R] - \f[V]property\f[R]: Name of the property to
|
|
|
|
|
animate (e.g., `x', `fill_color', `opacity') - \f[V]target\f[R]: Target
|
|
|
|
|
value - type depends on property (float, tuple for color/vector, etc.)
|
|
|
|
|
- \f[V]duration\f[R]: Animation duration in seconds - \f[V]easing\f[R]:
|
|
|
|
|
Easing function: Easing enum value, string name, or None for linear -
|
|
|
|
|
\f[V]delta\f[R]: If True, target is relative to current value; if False,
|
Replace UIEntity gridstate with DiscreteMap perspective_map; closes #294
Per-entity FOV memory moves from std::vector<UIGridPointState> (two-bool
visible/discovered pairs) to a 3-state DiscreteMap (0=UNKNOWN, 1=DISCOVERED,
2=VISIBLE), exposed as entity.perspective_map. The invariant
visible-subset-of-discovered becomes structural (single value per cell), and
the map is a live, serializable, first-class object rather than an implicit
internal array.
Changes:
- New DiscreteMap C++ class with shared ownership; PyDiscreteMapObject now
holds shared_ptr<DiscreteMap>. UIEntity holds the same shared_ptr.
- New mcrfpy.Perspective IntEnum (UNKNOWN/DISCOVERED/VISIBLE), modelled on
PyInputState.
- entity.perspective_map: lazy-allocated on first access with a grid;
setter validates size against grid and raises ValueError on mismatch;
None clears (next access lazy-reallocates fresh).
- updateVisibility() now demotes 2->1 then promotes visible cells to 2.
- entity.at(x, y) returns grid.at(x, y) when VISIBLE, else None.
- Fog-of-war rendering in UIGridView and UIGrid reads the 3-state map.
- Removed: UIEntity::gridstate, ensureGridstate(), entity.gridstate getter,
UIGridPointState struct + PyUIGridPointStateType.
- Obsolete tests deleted (test_gridpointstate_point,
issue_265_gridpointstate_dangle); 4 new tests cover lazy allocation,
identity, serialization round-trip, size validation, and the
visible-subset-of-discovered invariant.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-17 23:04:27 -04:00
|
|
|
target is absolute - \f[V]loop\f[R]: If True, animation repeats from
|
|
|
|
|
start when it reaches the end (default False) - \f[V]callback\f[R]:
|
|
|
|
|
Optional callable invoked when animation completes (not called for
|
|
|
|
|
looping animations) - \f[V]conflict_mode\f[R]: `replace' (default),
|
2026-01-23 20:49:11 -05:00
|
|
|
`queue', or `error' if property already animating
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Returns:\f[R] Animation object for monitoring progress
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Raises:\f[R] ValueError: If property name is not valid for this
|
|
|
|
|
drawable type This is a convenience method that creates an Animation,
|
|
|
|
|
starts it, and adds it to the AnimationManager.
|
|
|
|
|
.SS \f[V]move(dx, dy) or (delta) -> None\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Move the element by a relative offset.
|
|
|
|
|
.PP
|
|
|
|
|
Note:
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Arguments:\f[R] - \f[V]dx\f[R]: Horizontal offset in pixels (or use
|
|
|
|
|
delta) - \f[V]dy\f[R]: Vertical offset in pixels (or use delta) -
|
|
|
|
|
\f[V]delta\f[R]: Offset as tuple, list, or Vector: (dx, dy)
|
|
|
|
|
.SS \f[V]realign() -> None\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Reapply alignment relative to parent, useful for responsive layouts.
|
|
|
|
|
.PP
|
|
|
|
|
Note: Call this to recalculate position after parent changes size.
|
|
|
|
|
For elements with align=None, this has no effect.
|
|
|
|
|
.SS \f[V]resize(width, height) or (size) -> None\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Resize the element to new dimensions.
|
|
|
|
|
.PP
|
|
|
|
|
Note:
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Arguments:\f[R] - \f[V]width\f[R]: New width in pixels (or use
|
|
|
|
|
size) - \f[V]height\f[R]: New height in pixels (or use size) -
|
|
|
|
|
\f[V]size\f[R]: Size as tuple, list, or Vector: (width, height)
|
|
|
|
|
.SS Texture
|
|
|
|
|
.PP
|
Replace UIEntity gridstate with DiscreteMap perspective_map; closes #294
Per-entity FOV memory moves from std::vector<UIGridPointState> (two-bool
visible/discovered pairs) to a 3-state DiscreteMap (0=UNKNOWN, 1=DISCOVERED,
2=VISIBLE), exposed as entity.perspective_map. The invariant
visible-subset-of-discovered becomes structural (single value per cell), and
the map is a live, serializable, first-class object rather than an implicit
internal array.
Changes:
- New DiscreteMap C++ class with shared ownership; PyDiscreteMapObject now
holds shared_ptr<DiscreteMap>. UIEntity holds the same shared_ptr.
- New mcrfpy.Perspective IntEnum (UNKNOWN/DISCOVERED/VISIBLE), modelled on
PyInputState.
- entity.perspective_map: lazy-allocated on first access with a grid;
setter validates size against grid and raises ValueError on mismatch;
None clears (next access lazy-reallocates fresh).
- updateVisibility() now demotes 2->1 then promotes visible cells to 2.
- entity.at(x, y) returns grid.at(x, y) when VISIBLE, else None.
- Fog-of-war rendering in UIGridView and UIGrid reads the 3-state map.
- Removed: UIEntity::gridstate, ensureGridstate(), entity.gridstate getter,
UIGridPointState struct + PyUIGridPointStateType.
- Obsolete tests deleted (test_gridpointstate_point,
issue_265_gridpointstate_dangle); 4 new tests cover lazy allocation,
identity, serialization round-trip, size validation, and the
visible-subset-of-discovered invariant.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-17 23:04:27 -04:00
|
|
|
Texture(filename: str, sprite_width: int = 0, sprite_height: int = 0,
|
|
|
|
|
display_size: tuple = None, display_origin: tuple = None)
|
|
|
|
|
.PP
|
|
|
|
|
A texture atlas for sprites and tiles.
|
|
|
|
|
.PP
|
|
|
|
|
Args: filename: Path to an image file (PNG, BMP, etc.).
|
|
|
|
|
sprite_width: Width of each sprite cell in pixels (0 = full image).
|
|
|
|
|
sprite_height: Height of each sprite cell in pixels (0 = full image).
|
|
|
|
|
display_size: Optional (w, h) actual content size within each cell.
|
|
|
|
|
display_origin: Optional (x, y) content offset within each cell.
|
|
|
|
|
.PP
|
|
|
|
|
Properties: sprite_width, sprite_height (int, read-only): Cell
|
|
|
|
|
dimensions.
|
|
|
|
|
sheet_width, sheet_height (int, read-only): Grid dimensions in cells.
|
|
|
|
|
sprite_count (int, read-only): Total number of sprite cells.
|
|
|
|
|
source (str, read-only): File path used to load this texture.
|
|
|
|
|
display_width, display_height (int, read-only): Content size within
|
|
|
|
|
cells.
|
|
|
|
|
display_offset_x, display_offset_y (int, read-only): Content offset
|
|
|
|
|
within cells.
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Properties:\f[R] - \f[V]display_height\f[R] \f[I](read-only)\f[R]:
|
|
|
|
|
Display height of sprite content within each cell (int, read-only).
|
|
|
|
|
Defaults to sprite_height.
|
|
|
|
|
- \f[V]display_offset_x\f[R] \f[I](read-only)\f[R]: X offset of sprite
|
|
|
|
|
content within each cell (int, read-only).
|
|
|
|
|
Default 0.
|
|
|
|
|
- \f[V]display_offset_y\f[R] \f[I](read-only)\f[R]: Y offset of sprite
|
|
|
|
|
content within each cell (int, read-only).
|
|
|
|
|
Default 0.
|
|
|
|
|
- \f[V]display_width\f[R] \f[I](read-only)\f[R]: Display width of sprite
|
|
|
|
|
content within each cell (int, read-only).
|
|
|
|
|
Defaults to sprite_width.
|
|
|
|
|
- \f[V]sheet_height\f[R] \f[I](read-only)\f[R]: Number of sprite rows in
|
|
|
|
|
the texture sheet (int, read-only).
|
2026-01-23 20:49:11 -05:00
|
|
|
Calculated as texture_height / sprite_height.
|
|
|
|
|
- \f[V]sheet_width\f[R] \f[I](read-only)\f[R]: Number of sprite columns
|
|
|
|
|
in the texture sheet (int, read-only).
|
|
|
|
|
Calculated as texture_width / sprite_width.
|
|
|
|
|
- \f[V]source\f[R] \f[I](read-only)\f[R]: Source filename path (str,
|
|
|
|
|
read-only).
|
|
|
|
|
The path used to load this texture.
|
|
|
|
|
- \f[V]sprite_count\f[R] \f[I](read-only)\f[R]: Total number of sprites
|
|
|
|
|
in the texture sheet (int, read-only).
|
|
|
|
|
Equals sheet_width * sheet_height.
|
|
|
|
|
- \f[V]sprite_height\f[R] \f[I](read-only)\f[R]: Height of each sprite
|
|
|
|
|
in pixels (int, read-only).
|
|
|
|
|
Specified during texture initialization.
|
|
|
|
|
- \f[V]sprite_width\f[R] \f[I](read-only)\f[R]: Width of each sprite in
|
|
|
|
|
pixels (int, read-only).
|
|
|
|
|
Specified during texture initialization.
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Methods:\f[R]
|
Replace UIEntity gridstate with DiscreteMap perspective_map; closes #294
Per-entity FOV memory moves from std::vector<UIGridPointState> (two-bool
visible/discovered pairs) to a 3-state DiscreteMap (0=UNKNOWN, 1=DISCOVERED,
2=VISIBLE), exposed as entity.perspective_map. The invariant
visible-subset-of-discovered becomes structural (single value per cell), and
the map is a live, serializable, first-class object rather than an implicit
internal array.
Changes:
- New DiscreteMap C++ class with shared ownership; PyDiscreteMapObject now
holds shared_ptr<DiscreteMap>. UIEntity holds the same shared_ptr.
- New mcrfpy.Perspective IntEnum (UNKNOWN/DISCOVERED/VISIBLE), modelled on
PyInputState.
- entity.perspective_map: lazy-allocated on first access with a grid;
setter validates size against grid and raises ValueError on mismatch;
None clears (next access lazy-reallocates fresh).
- updateVisibility() now demotes 2->1 then promotes visible cells to 2.
- entity.at(x, y) returns grid.at(x, y) when VISIBLE, else None.
- Fog-of-war rendering in UIGridView and UIGrid reads the 3-state map.
- Removed: UIEntity::gridstate, ensureGridstate(), entity.gridstate getter,
UIGridPointState struct + PyUIGridPointStateType.
- Obsolete tests deleted (test_gridpointstate_point,
issue_265_gridpointstate_dangle); 4 new tests cover lazy allocation,
identity, serialization round-trip, size validation, and the
visible-subset-of-discovered invariant.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-17 23:04:27 -04:00
|
|
|
.SS \f[V]composite(layers: list[Texture], sprite_width: int, sprite_height: int, name: str = \[aq]<composite>\[aq]) -> Texture\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Alpha-composite multiple texture layers into a single texture.
|
|
|
|
|
.PP
|
|
|
|
|
Note:
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Arguments:\f[R] - \f[V]layers\f[R]: List of Texture objects,
|
|
|
|
|
composited bottom-to-top - \f[V]sprite_width\f[R]: Width of each sprite
|
|
|
|
|
cell in the result - \f[V]sprite_height\f[R]: Height of each sprite cell
|
|
|
|
|
in the result - \f[V]name\f[R]: Optional name for the composite texture
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Returns:\f[R] Texture: New texture with all layers composited
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Raises:\f[R] ValueError: If layers have different dimensions or
|
|
|
|
|
list is empty This is a class method.
|
|
|
|
|
Uses Porter-Duff `over' alpha compositing.
|
|
|
|
|
.SS \f[V]from_bytes(data: bytes, width: int, height: int, sprite_width: int, sprite_height: int, name: str = \[aq]<generated>\[aq]) -> Texture\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Create a Texture from raw RGBA pixel data.
|
|
|
|
|
.PP
|
|
|
|
|
Note:
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Arguments:\f[R] - \f[V]data\f[R]: Raw RGBA bytes (length must equal
|
|
|
|
|
width * height * 4) - \f[V]width\f[R]: Image width in pixels -
|
|
|
|
|
\f[V]height\f[R]: Image height in pixels - \f[V]sprite_width\f[R]: Width
|
|
|
|
|
of each sprite cell - \f[V]sprite_height\f[R]: Height of each sprite
|
|
|
|
|
cell - \f[V]name\f[R]: Optional name for the texture (default: `')
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Returns:\f[R] Texture: New texture containing the pixel data
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Raises:\f[R] ValueError: If data length does not match width *
|
|
|
|
|
height * 4 This is a class method.
|
|
|
|
|
Useful for procedurally generated textures.
|
|
|
|
|
.SS \f[V]hsl_shift(hue_shift: float, sat_shift: float = 0.0, lit_shift: float = 0.0) -> Texture\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Create a new texture with HSL color adjustments applied.
|
|
|
|
|
.PP
|
|
|
|
|
Note:
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Arguments:\f[R] - \f[V]hue_shift\f[R]: Hue rotation in degrees
|
|
|
|
|
[0.0, 360.0) - \f[V]sat_shift\f[R]: Saturation adjustment [-1.0, 1.0]
|
|
|
|
|
(default 0.0) - \f[V]lit_shift\f[R]: Lightness adjustment [-1.0, 1.0]
|
|
|
|
|
(default 0.0)
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Returns:\f[R] Texture: New texture with color-shifted pixels
|
|
|
|
|
Preserves alpha channel.
|
|
|
|
|
Skips fully transparent pixels.
|
2026-01-23 20:49:11 -05:00
|
|
|
.SS TileLayer
|
|
|
|
|
.PP
|
Replace UIEntity gridstate with DiscreteMap perspective_map; closes #294
Per-entity FOV memory moves from std::vector<UIGridPointState> (two-bool
visible/discovered pairs) to a 3-state DiscreteMap (0=UNKNOWN, 1=DISCOVERED,
2=VISIBLE), exposed as entity.perspective_map. The invariant
visible-subset-of-discovered becomes structural (single value per cell), and
the map is a live, serializable, first-class object rather than an implicit
internal array.
Changes:
- New DiscreteMap C++ class with shared ownership; PyDiscreteMapObject now
holds shared_ptr<DiscreteMap>. UIEntity holds the same shared_ptr.
- New mcrfpy.Perspective IntEnum (UNKNOWN/DISCOVERED/VISIBLE), modelled on
PyInputState.
- entity.perspective_map: lazy-allocated on first access with a grid;
setter validates size against grid and raises ValueError on mismatch;
None clears (next access lazy-reallocates fresh).
- updateVisibility() now demotes 2->1 then promotes visible cells to 2.
- entity.at(x, y) returns grid.at(x, y) when VISIBLE, else None.
- Fog-of-war rendering in UIGridView and UIGrid reads the 3-state map.
- Removed: UIEntity::gridstate, ensureGridstate(), entity.gridstate getter,
UIGridPointState struct + PyUIGridPointStateType.
- Obsolete tests deleted (test_gridpointstate_point,
issue_265_gridpointstate_dangle); 4 new tests cover lazy allocation,
identity, serialization round-trip, size validation, and the
visible-subset-of-discovered invariant.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-17 23:04:27 -04:00
|
|
|
TileLayer(z_index=-1, name=None, texture=None, grid_size=None)
|
2026-01-23 20:49:11 -05:00
|
|
|
.PP
|
|
|
|
|
A grid layer that stores sprite indices per cell for tile-based
|
|
|
|
|
rendering.
|
|
|
|
|
.PP
|
Replace UIEntity gridstate with DiscreteMap perspective_map; closes #294
Per-entity FOV memory moves from std::vector<UIGridPointState> (two-bool
visible/discovered pairs) to a 3-state DiscreteMap (0=UNKNOWN, 1=DISCOVERED,
2=VISIBLE), exposed as entity.perspective_map. The invariant
visible-subset-of-discovered becomes structural (single value per cell), and
the map is a live, serializable, first-class object rather than an implicit
internal array.
Changes:
- New DiscreteMap C++ class with shared ownership; PyDiscreteMapObject now
holds shared_ptr<DiscreteMap>. UIEntity holds the same shared_ptr.
- New mcrfpy.Perspective IntEnum (UNKNOWN/DISCOVERED/VISIBLE), modelled on
PyInputState.
- entity.perspective_map: lazy-allocated on first access with a grid;
setter validates size against grid and raises ValueError on mismatch;
None clears (next access lazy-reallocates fresh).
- updateVisibility() now demotes 2->1 then promotes visible cells to 2.
- entity.at(x, y) returns grid.at(x, y) when VISIBLE, else None.
- Fog-of-war rendering in UIGridView and UIGrid reads the 3-state map.
- Removed: UIEntity::gridstate, ensureGridstate(), entity.gridstate getter,
UIGridPointState struct + PyUIGridPointStateType.
- Obsolete tests deleted (test_gridpointstate_point,
issue_265_gridpointstate_dangle); 4 new tests cover lazy allocation,
identity, serialization round-trip, size validation, and the
visible-subset-of-discovered invariant.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-17 23:04:27 -04:00
|
|
|
TileLayers can be created standalone and attached to a Grid via
|
|
|
|
|
add_layer() or passed to the Grid constructor\[cq]s layers parameter.
|
|
|
|
|
Layers with size (0, 0) automatically resize to match the Grid when
|
|
|
|
|
attached.
|
2026-01-23 20:49:11 -05:00
|
|
|
.PP
|
|
|
|
|
Args: z_index (int): Render order relative to entities.
|
|
|
|
|
Negative values render below entities (as backgrounds), positive values
|
|
|
|
|
render above entities (as overlays).
|
Replace UIEntity gridstate with DiscreteMap perspective_map; closes #294
Per-entity FOV memory moves from std::vector<UIGridPointState> (two-bool
visible/discovered pairs) to a 3-state DiscreteMap (0=UNKNOWN, 1=DISCOVERED,
2=VISIBLE), exposed as entity.perspective_map. The invariant
visible-subset-of-discovered becomes structural (single value per cell), and
the map is a live, serializable, first-class object rather than an implicit
internal array.
Changes:
- New DiscreteMap C++ class with shared ownership; PyDiscreteMapObject now
holds shared_ptr<DiscreteMap>. UIEntity holds the same shared_ptr.
- New mcrfpy.Perspective IntEnum (UNKNOWN/DISCOVERED/VISIBLE), modelled on
PyInputState.
- entity.perspective_map: lazy-allocated on first access with a grid;
setter validates size against grid and raises ValueError on mismatch;
None clears (next access lazy-reallocates fresh).
- updateVisibility() now demotes 2->1 then promotes visible cells to 2.
- entity.at(x, y) returns grid.at(x, y) when VISIBLE, else None.
- Fog-of-war rendering in UIGridView and UIGrid reads the 3-state map.
- Removed: UIEntity::gridstate, ensureGridstate(), entity.gridstate getter,
UIGridPointState struct + PyUIGridPointStateType.
- Obsolete tests deleted (test_gridpointstate_point,
issue_265_gridpointstate_dangle); 4 new tests cover lazy allocation,
identity, serialization round-trip, size validation, and the
visible-subset-of-discovered invariant.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-17 23:04:27 -04:00
|
|
|
Default: -1 (background) name (str): Layer name for Grid.layer(name)
|
|
|
|
|
lookup.
|
|
|
|
|
Default: None texture (Texture): Sprite atlas containing tile images.
|
2026-01-23 20:49:11 -05:00
|
|
|
The texture\[cq]s sprite_size determines individual tile dimensions.
|
|
|
|
|
Required for rendering; can be set after creation.
|
|
|
|
|
Default: None grid_size (tuple): Dimensions as (width, height).
|
Replace UIEntity gridstate with DiscreteMap perspective_map; closes #294
Per-entity FOV memory moves from std::vector<UIGridPointState> (two-bool
visible/discovered pairs) to a 3-state DiscreteMap (0=UNKNOWN, 1=DISCOVERED,
2=VISIBLE), exposed as entity.perspective_map. The invariant
visible-subset-of-discovered becomes structural (single value per cell), and
the map is a live, serializable, first-class object rather than an implicit
internal array.
Changes:
- New DiscreteMap C++ class with shared ownership; PyDiscreteMapObject now
holds shared_ptr<DiscreteMap>. UIEntity holds the same shared_ptr.
- New mcrfpy.Perspective IntEnum (UNKNOWN/DISCOVERED/VISIBLE), modelled on
PyInputState.
- entity.perspective_map: lazy-allocated on first access with a grid;
setter validates size against grid and raises ValueError on mismatch;
None clears (next access lazy-reallocates fresh).
- updateVisibility() now demotes 2->1 then promotes visible cells to 2.
- entity.at(x, y) returns grid.at(x, y) when VISIBLE, else None.
- Fog-of-war rendering in UIGridView and UIGrid reads the 3-state map.
- Removed: UIEntity::gridstate, ensureGridstate(), entity.gridstate getter,
UIGridPointState struct + PyUIGridPointStateType.
- Obsolete tests deleted (test_gridpointstate_point,
issue_265_gridpointstate_dangle); 4 new tests cover lazy allocation,
identity, serialization round-trip, size validation, and the
visible-subset-of-discovered invariant.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-17 23:04:27 -04:00
|
|
|
If None or (0, 0), the layer will auto-resize when attached to a Grid.
|
2026-01-23 20:49:11 -05:00
|
|
|
Default: None
|
|
|
|
|
.PP
|
|
|
|
|
Attributes: z_index (int): Layer z-order relative to entities
|
Replace UIEntity gridstate with DiscreteMap perspective_map; closes #294
Per-entity FOV memory moves from std::vector<UIGridPointState> (two-bool
visible/discovered pairs) to a 3-state DiscreteMap (0=UNKNOWN, 1=DISCOVERED,
2=VISIBLE), exposed as entity.perspective_map. The invariant
visible-subset-of-discovered becomes structural (single value per cell), and
the map is a live, serializable, first-class object rather than an implicit
internal array.
Changes:
- New DiscreteMap C++ class with shared ownership; PyDiscreteMapObject now
holds shared_ptr<DiscreteMap>. UIEntity holds the same shared_ptr.
- New mcrfpy.Perspective IntEnum (UNKNOWN/DISCOVERED/VISIBLE), modelled on
PyInputState.
- entity.perspective_map: lazy-allocated on first access with a grid;
setter validates size against grid and raises ValueError on mismatch;
None clears (next access lazy-reallocates fresh).
- updateVisibility() now demotes 2->1 then promotes visible cells to 2.
- entity.at(x, y) returns grid.at(x, y) when VISIBLE, else None.
- Fog-of-war rendering in UIGridView and UIGrid reads the 3-state map.
- Removed: UIEntity::gridstate, ensureGridstate(), entity.gridstate getter,
UIGridPointState struct + PyUIGridPointStateType.
- Obsolete tests deleted (test_gridpointstate_point,
issue_265_gridpointstate_dangle); 4 new tests cover lazy allocation,
identity, serialization round-trip, size validation, and the
visible-subset-of-discovered invariant.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-17 23:04:27 -04:00
|
|
|
(read/write) name (str): Layer name for lookup (read-only) visible
|
|
|
|
|
(bool): Whether layer is rendered (read/write) texture (Texture): Sprite
|
|
|
|
|
atlas for tile images (read/write) grid_size (tuple): Layer dimensions
|
|
|
|
|
as (width, height) (read-only) grid (Grid): Parent Grid or None.
|
|
|
|
|
Setting manages layer association.
|
2026-01-23 20:49:11 -05:00
|
|
|
.PP
|
|
|
|
|
Methods: at(x, y) -> int: Get the tile index at cell position (x, y)
|
|
|
|
|
set(x, y, index): Set the tile index at cell position (x, y)
|
|
|
|
|
fill(index): Fill the entire layer with a single tile index fill_rect(x,
|
|
|
|
|
y, w, h, index): Fill a rectangular region with a tile index
|
|
|
|
|
.PP
|
|
|
|
|
Tile Index Values: -1: No tile (transparent/empty cell) 0+: Index into
|
|
|
|
|
the texture\[cq]s sprite atlas (row-major order)
|
|
|
|
|
.PP
|
Replace UIEntity gridstate with DiscreteMap perspective_map; closes #294
Per-entity FOV memory moves from std::vector<UIGridPointState> (two-bool
visible/discovered pairs) to a 3-state DiscreteMap (0=UNKNOWN, 1=DISCOVERED,
2=VISIBLE), exposed as entity.perspective_map. The invariant
visible-subset-of-discovered becomes structural (single value per cell), and
the map is a live, serializable, first-class object rather than an implicit
internal array.
Changes:
- New DiscreteMap C++ class with shared ownership; PyDiscreteMapObject now
holds shared_ptr<DiscreteMap>. UIEntity holds the same shared_ptr.
- New mcrfpy.Perspective IntEnum (UNKNOWN/DISCOVERED/VISIBLE), modelled on
PyInputState.
- entity.perspective_map: lazy-allocated on first access with a grid;
setter validates size against grid and raises ValueError on mismatch;
None clears (next access lazy-reallocates fresh).
- updateVisibility() now demotes 2->1 then promotes visible cells to 2.
- entity.at(x, y) returns grid.at(x, y) when VISIBLE, else None.
- Fog-of-war rendering in UIGridView and UIGrid reads the 3-state map.
- Removed: UIEntity::gridstate, ensureGridstate(), entity.gridstate getter,
UIGridPointState struct + PyUIGridPointStateType.
- Obsolete tests deleted (test_gridpointstate_point,
issue_265_gridpointstate_dangle); 4 new tests cover lazy allocation,
identity, serialization round-trip, size validation, and the
visible-subset-of-discovered invariant.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-17 23:04:27 -04:00
|
|
|
Example: terrain = mcrfpy.TileLayer(z_index=-2, name=`terrain',
|
|
|
|
|
texture=tileset) grid = mcrfpy.Grid(grid_size=(20, 15),
|
|
|
|
|
layers=[terrain]) terrain.fill(0) # Fill with tile index 0
|
|
|
|
|
grid.layer(`terrain').set(5, 5, 42) # Place tile 42 at (5, 5)
|
2026-01-23 20:49:11 -05:00
|
|
|
.PP
|
F15: convert frozen binding docstrings to MCRF_* macros (#314)
Convert 289 raw PyMethodDef/PyGetSetDef docstring slots to MCRF_METHOD /
MCRF_PROPERTY across the 20 frozen (non-3D) binding files, bringing the
frozen surface to 100% macro compliance (check_frozen_docstrings.sh PASS).
Done via a one-agent-per-file workflow gated by validate_file_docstrings.sh
and per-wave build/doc-rebuild checks.
- Adds #include "McRFPy_Doc.h" where missing; fills the lone genuine doc
gap (UIGrid.at, which was MISSING a doc field in two arrays).
- McRFPy_Doc.h: comment documenting the MCRF_METHOD_DOC comma rule (the
trap that broke the GridLayers conversion mid-run).
- Rebaseline api_surface golden: property types now resolve to real types
instead of "Any" (e.g. grid_pos: Vector, on_cell_click: Callable | None),
and 11 properties correctly flip rw->ro now that their docstrings carry
"read-only" (collections, grid_size, hovered_cell, texture, view — all
verified against NULL setter slots).
- Regenerate docs/stubs/man page from the new docstrings.
Module-level functions use MCRF_METHOD(<name>, ...) (expands identically to
the intended MCRF_FUNCTION; the audit's compliance set is METHOD/PROPERTY).
Experimental 3D/Voxel bindings (src/3d/) remain exempt from the freeze.
Pre-existing failures unrelated to this change: test_animation_*,
test_constructor_comprehensive (reference the removed mcrfpy.Animation and
old constructor arity).
Refs #314
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 01:20:55 -04:00
|
|
|
\f[B]Properties:\f[R] - \f[V]grid\f[R]: Parent Grid or None (Grid |
|
|
|
|
|
None).
|
Replace UIEntity gridstate with DiscreteMap perspective_map; closes #294
Per-entity FOV memory moves from std::vector<UIGridPointState> (two-bool
visible/discovered pairs) to a 3-state DiscreteMap (0=UNKNOWN, 1=DISCOVERED,
2=VISIBLE), exposed as entity.perspective_map. The invariant
visible-subset-of-discovered becomes structural (single value per cell), and
the map is a live, serializable, first-class object rather than an implicit
internal array.
Changes:
- New DiscreteMap C++ class with shared ownership; PyDiscreteMapObject now
holds shared_ptr<DiscreteMap>. UIEntity holds the same shared_ptr.
- New mcrfpy.Perspective IntEnum (UNKNOWN/DISCOVERED/VISIBLE), modelled on
PyInputState.
- entity.perspective_map: lazy-allocated on first access with a grid;
setter validates size against grid and raises ValueError on mismatch;
None clears (next access lazy-reallocates fresh).
- updateVisibility() now demotes 2->1 then promotes visible cells to 2.
- entity.at(x, y) returns grid.at(x, y) when VISIBLE, else None.
- Fog-of-war rendering in UIGridView and UIGrid reads the 3-state map.
- Removed: UIEntity::gridstate, ensureGridstate(), entity.gridstate getter,
UIGridPointState struct + PyUIGridPointStateType.
- Obsolete tests deleted (test_gridpointstate_point,
issue_265_gridpointstate_dangle); 4 new tests cover lazy allocation,
identity, serialization round-trip, size validation, and the
visible-subset-of-discovered invariant.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-17 23:04:27 -04:00
|
|
|
Setting manages layer association and handles lazy allocation.
|
F15: convert frozen binding docstrings to MCRF_* macros (#314)
Convert 289 raw PyMethodDef/PyGetSetDef docstring slots to MCRF_METHOD /
MCRF_PROPERTY across the 20 frozen (non-3D) binding files, bringing the
frozen surface to 100% macro compliance (check_frozen_docstrings.sh PASS).
Done via a one-agent-per-file workflow gated by validate_file_docstrings.sh
and per-wave build/doc-rebuild checks.
- Adds #include "McRFPy_Doc.h" where missing; fills the lone genuine doc
gap (UIGrid.at, which was MISSING a doc field in two arrays).
- McRFPy_Doc.h: comment documenting the MCRF_METHOD_DOC comma rule (the
trap that broke the GridLayers conversion mid-run).
- Rebaseline api_surface golden: property types now resolve to real types
instead of "Any" (e.g. grid_pos: Vector, on_cell_click: Callable | None),
and 11 properties correctly flip rw->ro now that their docstrings carry
"read-only" (collections, grid_size, hovered_cell, texture, view — all
verified against NULL setter slots).
- Regenerate docs/stubs/man page from the new docstrings.
Module-level functions use MCRF_METHOD(<name>, ...) (expands identically to
the intended MCRF_FUNCTION; the audit's compliance set is METHOD/PROPERTY).
Experimental 3D/Voxel bindings (src/3d/) remain exempt from the freeze.
Pre-existing failures unrelated to this change: test_animation_*,
test_constructor_comprehensive (reference the removed mcrfpy.Animation and
old constructor arity).
Refs #314
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 01:20:55 -04:00
|
|
|
- \f[V]grid_size\f[R] \f[I](read-only)\f[R]: Layer dimensions as (width,
|
|
|
|
|
height) tuple (tuple, read-only).
|
Replace UIEntity gridstate with DiscreteMap perspective_map; closes #294
Per-entity FOV memory moves from std::vector<UIGridPointState> (two-bool
visible/discovered pairs) to a 3-state DiscreteMap (0=UNKNOWN, 1=DISCOVERED,
2=VISIBLE), exposed as entity.perspective_map. The invariant
visible-subset-of-discovered becomes structural (single value per cell), and
the map is a live, serializable, first-class object rather than an implicit
internal array.
Changes:
- New DiscreteMap C++ class with shared ownership; PyDiscreteMapObject now
holds shared_ptr<DiscreteMap>. UIEntity holds the same shared_ptr.
- New mcrfpy.Perspective IntEnum (UNKNOWN/DISCOVERED/VISIBLE), modelled on
PyInputState.
- entity.perspective_map: lazy-allocated on first access with a grid;
setter validates size against grid and raises ValueError on mismatch;
None clears (next access lazy-reallocates fresh).
- updateVisibility() now demotes 2->1 then promotes visible cells to 2.
- entity.at(x, y) returns grid.at(x, y) when VISIBLE, else None.
- Fog-of-war rendering in UIGridView and UIGrid reads the 3-state map.
- Removed: UIEntity::gridstate, ensureGridstate(), entity.gridstate getter,
UIGridPointState struct + PyUIGridPointStateType.
- Obsolete tests deleted (test_gridpointstate_point,
issue_265_gridpointstate_dangle); 4 new tests cover lazy allocation,
identity, serialization round-trip, size validation, and the
visible-subset-of-discovered invariant.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-17 23:04:27 -04:00
|
|
|
- \f[V]name\f[R] \f[I](read-only)\f[R]: Layer name (str, read-only).
|
|
|
|
|
Used for Grid.layer(name) lookup.
|
F15: convert frozen binding docstrings to MCRF_* macros (#314)
Convert 289 raw PyMethodDef/PyGetSetDef docstring slots to MCRF_METHOD /
MCRF_PROPERTY across the 20 frozen (non-3D) binding files, bringing the
frozen surface to 100% macro compliance (check_frozen_docstrings.sh PASS).
Done via a one-agent-per-file workflow gated by validate_file_docstrings.sh
and per-wave build/doc-rebuild checks.
- Adds #include "McRFPy_Doc.h" where missing; fills the lone genuine doc
gap (UIGrid.at, which was MISSING a doc field in two arrays).
- McRFPy_Doc.h: comment documenting the MCRF_METHOD_DOC comma rule (the
trap that broke the GridLayers conversion mid-run).
- Rebaseline api_surface golden: property types now resolve to real types
instead of "Any" (e.g. grid_pos: Vector, on_cell_click: Callable | None),
and 11 properties correctly flip rw->ro now that their docstrings carry
"read-only" (collections, grid_size, hovered_cell, texture, view — all
verified against NULL setter slots).
- Regenerate docs/stubs/man page from the new docstrings.
Module-level functions use MCRF_METHOD(<name>, ...) (expands identically to
the intended MCRF_FUNCTION; the audit's compliance set is METHOD/PROPERTY).
Experimental 3D/Voxel bindings (src/3d/) remain exempt from the freeze.
Pre-existing failures unrelated to this change: test_animation_*,
test_constructor_comprehensive (reference the removed mcrfpy.Animation and
old constructor arity).
Refs #314
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 01:20:55 -04:00
|
|
|
- \f[V]texture\f[R]: Texture atlas for tile sprites (Texture | None).
|
|
|
|
|
- \f[V]visible\f[R]: Whether the layer is rendered (bool).
|
|
|
|
|
- \f[V]z_index\f[R]: Layer z-order (int).
|
2026-01-23 20:49:11 -05:00
|
|
|
Negative values render below entities.
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Methods:\f[R]
|
F15: convert frozen binding docstrings to MCRF_* macros (#314)
Convert 289 raw PyMethodDef/PyGetSetDef docstring slots to MCRF_METHOD /
MCRF_PROPERTY across the 20 frozen (non-3D) binding files, bringing the
frozen surface to 100% macro compliance (check_frozen_docstrings.sh PASS).
Done via a one-agent-per-file workflow gated by validate_file_docstrings.sh
and per-wave build/doc-rebuild checks.
- Adds #include "McRFPy_Doc.h" where missing; fills the lone genuine doc
gap (UIGrid.at, which was MISSING a doc field in two arrays).
- McRFPy_Doc.h: comment documenting the MCRF_METHOD_DOC comma rule (the
trap that broke the GridLayers conversion mid-run).
- Rebaseline api_surface golden: property types now resolve to real types
instead of "Any" (e.g. grid_pos: Vector, on_cell_click: Callable | None),
and 11 properties correctly flip rw->ro now that their docstrings carry
"read-only" (collections, grid_size, hovered_cell, texture, view — all
verified against NULL setter slots).
- Regenerate docs/stubs/man page from the new docstrings.
Module-level functions use MCRF_METHOD(<name>, ...) (expands identically to
the intended MCRF_FUNCTION; the audit's compliance set is METHOD/PROPERTY).
Experimental 3D/Voxel bindings (src/3d/) remain exempt from the freeze.
Pre-existing failures unrelated to this change: test_animation_*,
test_constructor_comprehensive (reference the removed mcrfpy.Animation and
old constructor arity).
Refs #314
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 01:20:55 -04:00
|
|
|
.SS \f[V]apply_ranges(source: HeightMap, ranges: list) -> TileLayer\f[R]
|
2026-01-23 20:49:11 -05:00
|
|
|
.PP
|
F15: convert frozen binding docstrings to MCRF_* macros (#314)
Convert 289 raw PyMethodDef/PyGetSetDef docstring slots to MCRF_METHOD /
MCRF_PROPERTY across the 20 frozen (non-3D) binding files, bringing the
frozen surface to 100% macro compliance (check_frozen_docstrings.sh PASS).
Done via a one-agent-per-file workflow gated by validate_file_docstrings.sh
and per-wave build/doc-rebuild checks.
- Adds #include "McRFPy_Doc.h" where missing; fills the lone genuine doc
gap (UIGrid.at, which was MISSING a doc field in two arrays).
- McRFPy_Doc.h: comment documenting the MCRF_METHOD_DOC comma rule (the
trap that broke the GridLayers conversion mid-run).
- Rebaseline api_surface golden: property types now resolve to real types
instead of "Any" (e.g. grid_pos: Vector, on_cell_click: Callable | None),
and 11 properties correctly flip rw->ro now that their docstrings carry
"read-only" (collections, grid_size, hovered_cell, texture, view — all
verified against NULL setter slots).
- Regenerate docs/stubs/man page from the new docstrings.
Module-level functions use MCRF_METHOD(<name>, ...) (expands identically to
the intended MCRF_FUNCTION; the audit's compliance set is METHOD/PROPERTY).
Experimental 3D/Voxel bindings (src/3d/) remain exempt from the freeze.
Pre-existing failures unrelated to this change: test_animation_*,
test_constructor_comprehensive (reference the removed mcrfpy.Animation and
old constructor arity).
Refs #314
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 01:20:55 -04:00
|
|
|
Apply multiple tile assignments from a HeightMap in a single pass.
|
|
|
|
|
Later ranges override earlier ones if overlapping.
|
2026-01-23 20:49:11 -05:00
|
|
|
.PP
|
|
|
|
|
Note:
|
|
|
|
|
.PP
|
F15: convert frozen binding docstrings to MCRF_* macros (#314)
Convert 289 raw PyMethodDef/PyGetSetDef docstring slots to MCRF_METHOD /
MCRF_PROPERTY across the 20 frozen (non-3D) binding files, bringing the
frozen surface to 100% macro compliance (check_frozen_docstrings.sh PASS).
Done via a one-agent-per-file workflow gated by validate_file_docstrings.sh
and per-wave build/doc-rebuild checks.
- Adds #include "McRFPy_Doc.h" where missing; fills the lone genuine doc
gap (UIGrid.at, which was MISSING a doc field in two arrays).
- McRFPy_Doc.h: comment documenting the MCRF_METHOD_DOC comma rule (the
trap that broke the GridLayers conversion mid-run).
- Rebaseline api_surface golden: property types now resolve to real types
instead of "Any" (e.g. grid_pos: Vector, on_cell_click: Callable | None),
and 11 properties correctly flip rw->ro now that their docstrings carry
"read-only" (collections, grid_size, hovered_cell, texture, view — all
verified against NULL setter slots).
- Regenerate docs/stubs/man page from the new docstrings.
Module-level functions use MCRF_METHOD(<name>, ...) (expands identically to
the intended MCRF_FUNCTION; the audit's compliance set is METHOD/PROPERTY).
Experimental 3D/Voxel bindings (src/3d/) remain exempt from the freeze.
Pre-existing failures unrelated to this change: test_animation_*,
test_constructor_comprehensive (reference the removed mcrfpy.Animation and
old constructor arity).
Refs #314
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 01:20:55 -04:00
|
|
|
\f[B]Arguments:\f[R] - \f[V]source\f[R]: Source heightmap (must match
|
|
|
|
|
layer dimensions) - \f[V]ranges\f[R]: List of ((min, max), tile_index)
|
|
|
|
|
tuples
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Returns:\f[R] self for method chaining Cells not matching any range
|
|
|
|
|
are left unchanged.
|
|
|
|
|
.SS \f[V]apply_threshold(source: HeightMap, range: tuple, tile: int) -> TileLayer\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Set a tile index for cells where the HeightMap value falls within a
|
|
|
|
|
range.
|
2026-01-23 20:49:11 -05:00
|
|
|
.PP
|
F15: convert frozen binding docstrings to MCRF_* macros (#314)
Convert 289 raw PyMethodDef/PyGetSetDef docstring slots to MCRF_METHOD /
MCRF_PROPERTY across the 20 frozen (non-3D) binding files, bringing the
frozen surface to 100% macro compliance (check_frozen_docstrings.sh PASS).
Done via a one-agent-per-file workflow gated by validate_file_docstrings.sh
and per-wave build/doc-rebuild checks.
- Adds #include "McRFPy_Doc.h" where missing; fills the lone genuine doc
gap (UIGrid.at, which was MISSING a doc field in two arrays).
- McRFPy_Doc.h: comment documenting the MCRF_METHOD_DOC comma rule (the
trap that broke the GridLayers conversion mid-run).
- Rebaseline api_surface golden: property types now resolve to real types
instead of "Any" (e.g. grid_pos: Vector, on_cell_click: Callable | None),
and 11 properties correctly flip rw->ro now that their docstrings carry
"read-only" (collections, grid_size, hovered_cell, texture, view — all
verified against NULL setter slots).
- Regenerate docs/stubs/man page from the new docstrings.
Module-level functions use MCRF_METHOD(<name>, ...) (expands identically to
the intended MCRF_FUNCTION; the audit's compliance set is METHOD/PROPERTY).
Experimental 3D/Voxel bindings (src/3d/) remain exempt from the freeze.
Pre-existing failures unrelated to this change: test_animation_*,
test_constructor_comprehensive (reference the removed mcrfpy.Animation and
old constructor arity).
Refs #314
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 01:20:55 -04:00
|
|
|
\f[B]Arguments:\f[R] - \f[V]source\f[R]: Source heightmap (must match
|
|
|
|
|
layer dimensions) - \f[V]range\f[R]: Value range as (min, max) inclusive
|
|
|
|
|
- \f[V]tile\f[R]: Tile index to set for cells in range
|
2026-01-23 20:49:11 -05:00
|
|
|
.PP
|
|
|
|
|
\f[B]Returns:\f[R] self for method chaining
|
F15: correct docstring accuracy from adversarial verify pass (#314)
Follow-up to the macro conversion: an adversarial verify pass (one agent per
file vs. the C++ implementation + stubs) found 62 content issues; the real
ones are fixed here.
Callbacks (centralized):
- on_click: receives (pos, MouseButton, InputState), not str (8 files).
- on_enter/on_exit/on_move (UIBase.h): hover passes only (pos) -- removed the
fictional button/action args.
- bounds/global_bounds (UIBase.h): mark (tuple, read-only).
Signatures / types:
- Grid.find_path: document heuristic + weight; get_dijkstra_map: document roots;
compute_fov: FOV | int = FOV.BASIC (not the C constant FOV_BASIC) + Returns;
at/is_in_fov: document (pos) and (x, y) call forms.
- get_metrics: document all 16 returned dict keys (was 8); bresenham: drop the
bogus '*' keyword-only separator.
- Nullable defaults typed correctly: BSP seed/size, ColorLayer draw_fov/
apply_perspective Color|None, Entity.visible_entities radius int=-1 (None is
rejected by the 'i' parser -> see #319).
- Type-token fixes: GridView.center -> Vector; GridView.texture -> (None,
read-only) (unimplemented, #318); GridPoint.grid_pos -> (tuple, read-only);
EntityCollection.find -> Entity | list[Entity] | None; extend RuntimeError;
UniformCollection.values -> list[float | tuple | None].
- automation: onScreen (x, y) form documented; scroll notes x is ignored (#317).
Also: correct stale AStarPath/DijkstraMap signatures in docs/api-audit-2026-04.md
(the bindings were right, the audit table was outdated). Rebaseline the API
snapshot golden and regenerate docs/stubs.
Code-level bugs surfaced by the pass are filed as #317, #318, #319.
Refs #314, #317, #318, #319
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 06:43:47 -04:00
|
|
|
.SS \f[V]at(pos: tuple | Vector) or (x: int, y: int) -> int\f[R]
|
2026-01-23 20:49:11 -05:00
|
|
|
.PP
|
F15: convert frozen binding docstrings to MCRF_* macros (#314)
Convert 289 raw PyMethodDef/PyGetSetDef docstring slots to MCRF_METHOD /
MCRF_PROPERTY across the 20 frozen (non-3D) binding files, bringing the
frozen surface to 100% macro compliance (check_frozen_docstrings.sh PASS).
Done via a one-agent-per-file workflow gated by validate_file_docstrings.sh
and per-wave build/doc-rebuild checks.
- Adds #include "McRFPy_Doc.h" where missing; fills the lone genuine doc
gap (UIGrid.at, which was MISSING a doc field in two arrays).
- McRFPy_Doc.h: comment documenting the MCRF_METHOD_DOC comma rule (the
trap that broke the GridLayers conversion mid-run).
- Rebaseline api_surface golden: property types now resolve to real types
instead of "Any" (e.g. grid_pos: Vector, on_cell_click: Callable | None),
and 11 properties correctly flip rw->ro now that their docstrings carry
"read-only" (collections, grid_size, hovered_cell, texture, view — all
verified against NULL setter slots).
- Regenerate docs/stubs/man page from the new docstrings.
Module-level functions use MCRF_METHOD(<name>, ...) (expands identically to
the intended MCRF_FUNCTION; the audit's compliance set is METHOD/PROPERTY).
Experimental 3D/Voxel bindings (src/3d/) remain exempt from the freeze.
Pre-existing failures unrelated to this change: test_animation_*,
test_constructor_comprehensive (reference the removed mcrfpy.Animation and
old constructor arity).
Refs #314
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 01:20:55 -04:00
|
|
|
Get the tile index at a cell position.
|
|
|
|
|
Returns -1 if no tile is set.
|
2026-01-23 20:49:11 -05:00
|
|
|
.PP
|
|
|
|
|
\f[B]Arguments:\f[R] - \f[V]pos\f[R]: Position as (x, y) tuple, list, or
|
F15: convert frozen binding docstrings to MCRF_* macros (#314)
Convert 289 raw PyMethodDef/PyGetSetDef docstring slots to MCRF_METHOD /
MCRF_PROPERTY across the 20 frozen (non-3D) binding files, bringing the
frozen surface to 100% macro compliance (check_frozen_docstrings.sh PASS).
Done via a one-agent-per-file workflow gated by validate_file_docstrings.sh
and per-wave build/doc-rebuild checks.
- Adds #include "McRFPy_Doc.h" where missing; fills the lone genuine doc
gap (UIGrid.at, which was MISSING a doc field in two arrays).
- McRFPy_Doc.h: comment documenting the MCRF_METHOD_DOC comma rule (the
trap that broke the GridLayers conversion mid-run).
- Rebaseline api_surface golden: property types now resolve to real types
instead of "Any" (e.g. grid_pos: Vector, on_cell_click: Callable | None),
and 11 properties correctly flip rw->ro now that their docstrings carry
"read-only" (collections, grid_size, hovered_cell, texture, view — all
verified against NULL setter slots).
- Regenerate docs/stubs/man page from the new docstrings.
Module-level functions use MCRF_METHOD(<name>, ...) (expands identically to
the intended MCRF_FUNCTION; the audit's compliance set is METHOD/PROPERTY).
Experimental 3D/Voxel bindings (src/3d/) remain exempt from the freeze.
Pre-existing failures unrelated to this change: test_animation_*,
test_constructor_comprehensive (reference the removed mcrfpy.Animation and
old constructor arity).
Refs #314
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 01:20:55 -04:00
|
|
|
Vector; or pass x and y separately
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Returns:\f[R] Tile index at the specified cell, or -1 if empty
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Raises:\f[R] IndexError: If coordinates are out of bounds
|
|
|
|
|
.SS \f[V]fill(index: int) -> None\f[R]
|
2026-01-23 20:49:11 -05:00
|
|
|
.PP
|
|
|
|
|
Fill the entire layer with the specified tile index.
|
F15: convert frozen binding docstrings to MCRF_* macros (#314)
Convert 289 raw PyMethodDef/PyGetSetDef docstring slots to MCRF_METHOD /
MCRF_PROPERTY across the 20 frozen (non-3D) binding files, bringing the
frozen surface to 100% macro compliance (check_frozen_docstrings.sh PASS).
Done via a one-agent-per-file workflow gated by validate_file_docstrings.sh
and per-wave build/doc-rebuild checks.
- Adds #include "McRFPy_Doc.h" where missing; fills the lone genuine doc
gap (UIGrid.at, which was MISSING a doc field in two arrays).
- McRFPy_Doc.h: comment documenting the MCRF_METHOD_DOC comma rule (the
trap that broke the GridLayers conversion mid-run).
- Rebaseline api_surface golden: property types now resolve to real types
instead of "Any" (e.g. grid_pos: Vector, on_cell_click: Callable | None),
and 11 properties correctly flip rw->ro now that their docstrings carry
"read-only" (collections, grid_size, hovered_cell, texture, view — all
verified against NULL setter slots).
- Regenerate docs/stubs/man page from the new docstrings.
Module-level functions use MCRF_METHOD(<name>, ...) (expands identically to
the intended MCRF_FUNCTION; the audit's compliance set is METHOD/PROPERTY).
Experimental 3D/Voxel bindings (src/3d/) remain exempt from the freeze.
Pre-existing failures unrelated to this change: test_animation_*,
test_constructor_comprehensive (reference the removed mcrfpy.Animation and
old constructor arity).
Refs #314
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 01:20:55 -04:00
|
|
|
.PP
|
|
|
|
|
\f[B]Arguments:\f[R] - \f[V]index\f[R]: Tile index to fill with (-1 for
|
|
|
|
|
no tile)
|
|
|
|
|
.SS \f[V]fill_rect(pos: tuple, size: tuple, index: int) -> None\f[R]
|
2026-01-23 20:49:11 -05:00
|
|
|
.PP
|
|
|
|
|
Fill a rectangular region with a tile index.
|
|
|
|
|
.PP
|
F15: convert frozen binding docstrings to MCRF_* macros (#314)
Convert 289 raw PyMethodDef/PyGetSetDef docstring slots to MCRF_METHOD /
MCRF_PROPERTY across the 20 frozen (non-3D) binding files, bringing the
frozen surface to 100% macro compliance (check_frozen_docstrings.sh PASS).
Done via a one-agent-per-file workflow gated by validate_file_docstrings.sh
and per-wave build/doc-rebuild checks.
- Adds #include "McRFPy_Doc.h" where missing; fills the lone genuine doc
gap (UIGrid.at, which was MISSING a doc field in two arrays).
- McRFPy_Doc.h: comment documenting the MCRF_METHOD_DOC comma rule (the
trap that broke the GridLayers conversion mid-run).
- Rebaseline api_surface golden: property types now resolve to real types
instead of "Any" (e.g. grid_pos: Vector, on_cell_click: Callable | None),
and 11 properties correctly flip rw->ro now that their docstrings carry
"read-only" (collections, grid_size, hovered_cell, texture, view — all
verified against NULL setter slots).
- Regenerate docs/stubs/man page from the new docstrings.
Module-level functions use MCRF_METHOD(<name>, ...) (expands identically to
the intended MCRF_FUNCTION; the audit's compliance set is METHOD/PROPERTY).
Experimental 3D/Voxel bindings (src/3d/) remain exempt from the freeze.
Pre-existing failures unrelated to this change: test_animation_*,
test_constructor_comprehensive (reference the removed mcrfpy.Animation and
old constructor arity).
Refs #314
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 01:20:55 -04:00
|
|
|
\f[B]Arguments:\f[R] - \f[V]pos\f[R]: Top-left corner as (x, y) -
|
|
|
|
|
\f[V]size\f[R]: Dimensions as (width, height) - \f[V]index\f[R]: Tile
|
|
|
|
|
index to fill with (-1 for no tile)
|
|
|
|
|
.SS \f[V]set(pos, index: int) -> None\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Set the tile index at a cell position.
|
|
|
|
|
Use -1 to clear the tile.
|
2026-01-23 20:49:11 -05:00
|
|
|
.PP
|
|
|
|
|
\f[B]Arguments:\f[R] - \f[V]pos\f[R]: Position as (x, y) tuple, list, or
|
|
|
|
|
Vector - \f[V]index\f[R]: Tile index (-1 for no tile)
|
F15: convert frozen binding docstrings to MCRF_* macros (#314)
Convert 289 raw PyMethodDef/PyGetSetDef docstring slots to MCRF_METHOD /
MCRF_PROPERTY across the 20 frozen (non-3D) binding files, bringing the
frozen surface to 100% macro compliance (check_frozen_docstrings.sh PASS).
Done via a one-agent-per-file workflow gated by validate_file_docstrings.sh
and per-wave build/doc-rebuild checks.
- Adds #include "McRFPy_Doc.h" where missing; fills the lone genuine doc
gap (UIGrid.at, which was MISSING a doc field in two arrays).
- McRFPy_Doc.h: comment documenting the MCRF_METHOD_DOC comma rule (the
trap that broke the GridLayers conversion mid-run).
- Rebaseline api_surface golden: property types now resolve to real types
instead of "Any" (e.g. grid_pos: Vector, on_cell_click: Callable | None),
and 11 properties correctly flip rw->ro now that their docstrings carry
"read-only" (collections, grid_size, hovered_cell, texture, view — all
verified against NULL setter slots).
- Regenerate docs/stubs/man page from the new docstrings.
Module-level functions use MCRF_METHOD(<name>, ...) (expands identically to
the intended MCRF_FUNCTION; the audit's compliance set is METHOD/PROPERTY).
Experimental 3D/Voxel bindings (src/3d/) remain exempt from the freeze.
Pre-existing failures unrelated to this change: test_animation_*,
test_constructor_comprehensive (reference the removed mcrfpy.Animation and
old constructor arity).
Refs #314
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 01:20:55 -04:00
|
|
|
.PP
|
|
|
|
|
\f[B]Raises:\f[R] IndexError: If coordinates are out of bounds
|
Replace UIEntity gridstate with DiscreteMap perspective_map; closes #294
Per-entity FOV memory moves from std::vector<UIGridPointState> (two-bool
visible/discovered pairs) to a 3-state DiscreteMap (0=UNKNOWN, 1=DISCOVERED,
2=VISIBLE), exposed as entity.perspective_map. The invariant
visible-subset-of-discovered becomes structural (single value per cell), and
the map is a live, serializable, first-class object rather than an implicit
internal array.
Changes:
- New DiscreteMap C++ class with shared ownership; PyDiscreteMapObject now
holds shared_ptr<DiscreteMap>. UIEntity holds the same shared_ptr.
- New mcrfpy.Perspective IntEnum (UNKNOWN/DISCOVERED/VISIBLE), modelled on
PyInputState.
- entity.perspective_map: lazy-allocated on first access with a grid;
setter validates size against grid and raises ValueError on mismatch;
None clears (next access lazy-reallocates fresh).
- updateVisibility() now demotes 2->1 then promotes visible cells to 2.
- entity.at(x, y) returns grid.at(x, y) when VISIBLE, else None.
- Fog-of-war rendering in UIGridView and UIGrid reads the 3-state map.
- Removed: UIEntity::gridstate, ensureGridstate(), entity.gridstate getter,
UIGridPointState struct + PyUIGridPointStateType.
- Obsolete tests deleted (test_gridpointstate_point,
issue_265_gridpointstate_dangle); 4 new tests cover lazy allocation,
identity, serialization round-trip, size validation, and the
visible-subset-of-discovered invariant.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-17 23:04:27 -04:00
|
|
|
.SS TileMapFile
|
|
|
|
|
.PP
|
|
|
|
|
TileMapFile(path: str)
|
|
|
|
|
.PP
|
|
|
|
|
Load a Tiled map file (.tmx or .tmj).
|
|
|
|
|
.PP
|
|
|
|
|
Parses the map and its referenced tilesets, providing access to tile
|
|
|
|
|
layers, object layers, and GID resolution.
|
|
|
|
|
.PP
|
|
|
|
|
Args: path: Path to the .tmx or .tmj map file.
|
|
|
|
|
.PP
|
|
|
|
|
Properties: width (int, read-only): Map width in tiles.
|
|
|
|
|
height (int, read-only): Map height in tiles.
|
|
|
|
|
tile_width (int, read-only): Tile width in pixels.
|
|
|
|
|
tile_height (int, read-only): Tile height in pixels.
|
|
|
|
|
orientation (str, read-only): Map orientation (e.g.\ `orthogonal').
|
|
|
|
|
properties (dict, read-only): Custom map properties.
|
|
|
|
|
tileset_count (int, read-only): Number of referenced tilesets.
|
|
|
|
|
tile_layer_names (list, read-only): Names of tile layers.
|
|
|
|
|
object_layer_names (list, read-only): Names of object layers.
|
|
|
|
|
.PP
|
|
|
|
|
Example: tm = mcrfpy.TileMapFile(`map.tmx') data =
|
|
|
|
|
tm.tile_layer_data(`Ground') tm.apply_to_tile_layer(my_tile_layer,
|
|
|
|
|
`Ground')
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Properties:\f[R] - \f[V]height\f[R] \f[I](read-only)\f[R]: Map
|
|
|
|
|
height in tiles (int, read-only).
|
|
|
|
|
- \f[V]object_layer_names\f[R] \f[I](read-only)\f[R]: List of object
|
|
|
|
|
layer names (read-only).
|
|
|
|
|
- \f[V]orientation\f[R] \f[I](read-only)\f[R]: Map orientation,
|
|
|
|
|
e.g.\ `orthogonal' (str, read-only).
|
|
|
|
|
- \f[V]properties\f[R] \f[I](read-only)\f[R]: Custom map properties as a
|
|
|
|
|
dict (read-only).
|
|
|
|
|
- \f[V]tile_height\f[R] \f[I](read-only)\f[R]: Tile height in pixels
|
|
|
|
|
(int, read-only).
|
|
|
|
|
- \f[V]tile_layer_names\f[R] \f[I](read-only)\f[R]: List of tile layer
|
|
|
|
|
names (read-only).
|
|
|
|
|
- \f[V]tile_width\f[R] \f[I](read-only)\f[R]: Tile width in pixels (int,
|
|
|
|
|
read-only).
|
|
|
|
|
- \f[V]tileset_count\f[R] \f[I](read-only)\f[R]: Number of referenced
|
|
|
|
|
tilesets (int, read-only).
|
|
|
|
|
- \f[V]width\f[R] \f[I](read-only)\f[R]: Map width in tiles (int,
|
|
|
|
|
read-only).
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Methods:\f[R]
|
|
|
|
|
.SS \f[V]apply_to_tile_layer(tile_layer: TileLayer, layer_name: str, tileset_index: int = 0) -> None\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Resolve GIDs and write sprite indices into a TileLayer.
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Arguments:\f[R] - \f[V]tile_layer\f[R]: Target TileLayer to write
|
|
|
|
|
into - \f[V]layer_name\f[R]: Name of the tile layer in this map -
|
|
|
|
|
\f[V]tileset_index\f[R]: Which tileset to resolve GIDs against (default
|
|
|
|
|
0)
|
|
|
|
|
.SS \f[V]object_layer(name: str) -> list[dict]\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Get objects from an object layer as Python dicts.
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Arguments:\f[R] - \f[V]name\f[R]: Name of the object layer
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Returns:\f[R] List of dicts with object properties (id, name, x, y,
|
|
|
|
|
width, height, etc.).
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Raises:\f[R] KeyError: If no object layer with that name exists
|
|
|
|
|
.SS \f[V]resolve_gid(gid: int) -> tuple[int, int]\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Resolve a global tile ID to tileset index and local tile ID.
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Arguments:\f[R] - \f[V]gid\f[R]: Global tile ID from
|
|
|
|
|
tile_layer_data()
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Returns:\f[R] Tuple of (tileset_index, local_tile_id).
|
|
|
|
|
(-1, -1) for empty/invalid.
|
|
|
|
|
.SS \f[V]tile_layer_data(name: str) -> list[int]\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Get raw global GID data for a tile layer.
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Arguments:\f[R] - \f[V]name\f[R]: Name of the tile layer
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Returns:\f[R] Flat list of global GIDs (0 = empty tile).
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Raises:\f[R] KeyError: If no tile layer with that name exists
|
|
|
|
|
.SS \f[V]tileset(index: int) -> tuple[int, TileSetFile]\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Get a referenced tileset by index.
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Arguments:\f[R] - \f[V]index\f[R]: Tileset index (0-based)
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Returns:\f[R] Tuple of (firstgid, TileSetFile).
|
|
|
|
|
.SS TileSetFile
|
|
|
|
|
.PP
|
|
|
|
|
TileSetFile(path: str)
|
|
|
|
|
.PP
|
|
|
|
|
Load a Tiled tileset file (.tsx or .tsj).
|
|
|
|
|
.PP
|
|
|
|
|
Parses the tileset and provides access to tile metadata, properties,
|
|
|
|
|
Wang sets, and texture creation.
|
|
|
|
|
.PP
|
|
|
|
|
Args: path: Path to the .tsx or .tsj tileset file.
|
|
|
|
|
.PP
|
|
|
|
|
Properties: name (str, read-only): Tileset name.
|
|
|
|
|
tile_width (int, read-only): Width of each tile in pixels.
|
|
|
|
|
tile_height (int, read-only): Height of each tile in pixels.
|
|
|
|
|
tile_count (int, read-only): Total number of tiles.
|
|
|
|
|
columns (int, read-only): Number of columns in the tileset image.
|
|
|
|
|
image_source (str, read-only): Resolved path to the tileset image.
|
|
|
|
|
properties (dict, read-only): Custom properties from the tileset.
|
|
|
|
|
wang_sets (list, read-only): List of WangSet objects.
|
|
|
|
|
.PP
|
|
|
|
|
Example: ts = mcrfpy.TileSetFile(`tileset.tsx') texture =
|
|
|
|
|
ts.to_texture() print(f\[cq]{ts.name}: {ts.tile_count} tiles\[cq])
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Properties:\f[R] - \f[V]columns\f[R] \f[I](read-only)\f[R]: Number
|
|
|
|
|
of columns in tileset image (int, read-only).
|
|
|
|
|
- \f[V]image_source\f[R] \f[I](read-only)\f[R]: Resolved path to the
|
|
|
|
|
tileset image file (str, read-only).
|
|
|
|
|
- \f[V]margin\f[R] \f[I](read-only)\f[R]: Margin around tiles in pixels
|
|
|
|
|
(int, read-only).
|
|
|
|
|
- \f[V]name\f[R] \f[I](read-only)\f[R]: Tileset name (str, read-only).
|
|
|
|
|
- \f[V]properties\f[R] \f[I](read-only)\f[R]: Custom tileset properties
|
|
|
|
|
as a dict (read-only).
|
|
|
|
|
- \f[V]spacing\f[R] \f[I](read-only)\f[R]: Spacing between tiles in
|
|
|
|
|
pixels (int, read-only).
|
|
|
|
|
- \f[V]tile_count\f[R] \f[I](read-only)\f[R]: Total number of tiles
|
|
|
|
|
(int, read-only).
|
|
|
|
|
- \f[V]tile_height\f[R] \f[I](read-only)\f[R]: Height of each tile in
|
|
|
|
|
pixels (int, read-only).
|
|
|
|
|
- \f[V]tile_width\f[R] \f[I](read-only)\f[R]: Width of each tile in
|
|
|
|
|
pixels (int, read-only).
|
|
|
|
|
- \f[V]wang_sets\f[R] \f[I](read-only)\f[R]: List of WangSet objects
|
|
|
|
|
from this tileset (read-only).
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Methods:\f[R]
|
|
|
|
|
.SS \f[V]tile_info(tile_id: int) -> dict | None\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Get metadata for a specific tile.
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Arguments:\f[R] - \f[V]tile_id\f[R]: Local tile ID (0-based)
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Returns:\f[R] Dict with `properties' and `animation' keys, or None
|
|
|
|
|
if no metadata.
|
|
|
|
|
.SS \f[V]to_texture() -> Texture\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Create a Texture from the tileset image.
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Returns:\f[R] A Texture object for use with TileLayer.
|
|
|
|
|
.SS \f[V]wang_set(name: str) -> WangSet\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Look up a WangSet by name.
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Arguments:\f[R] - \f[V]name\f[R]: Name of the Wang set
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Returns:\f[R] The WangSet object.
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Raises:\f[R] KeyError: If no WangSet with that name exists
|
2026-01-23 20:49:11 -05:00
|
|
|
.SS Timer
|
|
|
|
|
.PP
|
|
|
|
|
Timer(name, callback, interval, once=False, start=True)
|
|
|
|
|
.PP
|
|
|
|
|
Create a timer that calls a function at regular intervals.
|
|
|
|
|
.PP
|
|
|
|
|
Args: name (str): Unique identifier for the timer callback (callable):
|
|
|
|
|
Function to call - receives (timer, runtime) args interval (int): Time
|
|
|
|
|
between calls in milliseconds once (bool): If True, timer stops after
|
|
|
|
|
first call.
|
|
|
|
|
Default: False start (bool): If True, timer starts immediately.
|
|
|
|
|
Default: True
|
|
|
|
|
.PP
|
|
|
|
|
Attributes: interval (int): Time between calls in milliseconds remaining
|
|
|
|
|
(int): Time until next call in milliseconds (read-only) paused (bool):
|
|
|
|
|
Whether timer is paused (read-only) stopped (bool): Whether timer is
|
|
|
|
|
stopped (read-only) active (bool): Running state (read-write).
|
|
|
|
|
Set True to start, False to pause callback (callable): The callback
|
|
|
|
|
function (preserved when stopped) once (bool): Whether timer stops after
|
|
|
|
|
firing once
|
|
|
|
|
.PP
|
|
|
|
|
Methods: start(): Start the timer, adding to engine tick loop stop():
|
|
|
|
|
Stop the timer (removes from engine, preserves callback) pause(): Pause
|
|
|
|
|
the timer, preserving time remaining resume(): Resume a paused timer
|
|
|
|
|
restart(): Reset timer and ensure it\[cq]s running
|
|
|
|
|
.PP
|
|
|
|
|
Example: def on_timer(timer, runtime): print(f\[cq]Timer {timer} fired
|
|
|
|
|
at {runtime}ms\[cq]) if runtime > 5000: timer.stop() # Stop but can
|
|
|
|
|
restart later
|
|
|
|
|
.IP
|
|
|
|
|
.nf
|
|
|
|
|
\f[C]
|
|
|
|
|
timer = mcrfpy.Timer(\[aq]my_timer\[aq], on_timer, 1000)
|
|
|
|
|
timer.pause() # Pause timer
|
|
|
|
|
timer.resume() # Resume timer
|
|
|
|
|
timer.stop() # Stop completely
|
|
|
|
|
timer.start() # Restart from beginning
|
|
|
|
|
\f[R]
|
|
|
|
|
.fi
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Properties:\f[R] - \f[V]active\f[R]: Running state (bool,
|
|
|
|
|
read-write).
|
|
|
|
|
True if running (not paused, not stopped).
|
|
|
|
|
Set True to start/resume, False to pause.
|
|
|
|
|
- \f[V]callback\f[R]: The callback function (callable).
|
|
|
|
|
Preserved when stopped, allowing timer restart.
|
|
|
|
|
- \f[V]interval\f[R]: Timer interval in milliseconds (int).
|
|
|
|
|
Must be positive.
|
|
|
|
|
Can be changed while timer is running.
|
|
|
|
|
- \f[V]name\f[R] \f[I](read-only)\f[R]: Timer name (str, read-only).
|
|
|
|
|
Unique identifier for this timer.
|
|
|
|
|
- \f[V]once\f[R]: Whether the timer stops after firing once (bool).
|
|
|
|
|
One-shot timers can be restarted.
|
|
|
|
|
- \f[V]paused\f[R] \f[I](read-only)\f[R]: Whether the timer is paused
|
|
|
|
|
(bool, read-only).
|
|
|
|
|
Paused timers preserve their remaining time.
|
|
|
|
|
- \f[V]remaining\f[R] \f[I](read-only)\f[R]: Time remaining until next
|
|
|
|
|
trigger in milliseconds (int, read-only).
|
|
|
|
|
Full interval when stopped.
|
|
|
|
|
- \f[V]stopped\f[R] \f[I](read-only)\f[R]: Whether the timer is stopped
|
|
|
|
|
(bool, read-only).
|
|
|
|
|
Stopped timers are not in the engine tick loop but preserve their
|
|
|
|
|
callback.
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Methods:\f[R]
|
|
|
|
|
.SS \f[V]pause() -> None\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Pause the timer, preserving the time remaining until next trigger.
|
|
|
|
|
.PP
|
|
|
|
|
Note:
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Returns:\f[R] None The timer can be resumed later with resume().
|
|
|
|
|
Time spent paused does not count toward the interval.
|
|
|
|
|
.SS \f[V]restart() -> None\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Restart the timer from the beginning and ensure it\[cq]s running.
|
|
|
|
|
.PP
|
|
|
|
|
Note:
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Returns:\f[R] None Resets progress and adds timer to engine if
|
|
|
|
|
stopped.
|
|
|
|
|
Equivalent to stop() followed by start().
|
|
|
|
|
.SS \f[V]resume() -> None\f[R]
|
2025-10-30 21:20:50 -04:00
|
|
|
.PP
|
|
|
|
|
Resume a paused timer from where it left off.
|
|
|
|
|
.PP
|
|
|
|
|
Note:
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Returns:\f[R] None Has no effect if the timer is not paused.
|
|
|
|
|
Timer will fire after the remaining time elapses.
|
2026-01-23 20:49:11 -05:00
|
|
|
.SS \f[V]start() -> None\f[R]
|
2025-10-30 21:20:50 -04:00
|
|
|
.PP
|
2026-01-23 20:49:11 -05:00
|
|
|
Start the timer, adding it to the engine tick loop.
|
2025-10-30 21:20:50 -04:00
|
|
|
.PP
|
2026-01-23 20:49:11 -05:00
|
|
|
Note:
|
2025-12-02 09:21:43 -05:00
|
|
|
.PP
|
2026-01-23 20:49:11 -05:00
|
|
|
\f[B]Returns:\f[R] None Resets progress and begins counting toward the
|
|
|
|
|
next fire.
|
|
|
|
|
If another timer has this name, it will be stopped.
|
|
|
|
|
.SS \f[V]stop() -> None\f[R]
|
2025-12-02 09:21:43 -05:00
|
|
|
.PP
|
2026-01-23 20:49:11 -05:00
|
|
|
Stop the timer and remove it from the engine tick loop.
|
|
|
|
|
.PP
|
|
|
|
|
Note:
|
2025-12-02 09:21:43 -05:00
|
|
|
.PP
|
2026-01-23 20:49:11 -05:00
|
|
|
\f[B]Returns:\f[R] None The callback is preserved, so the timer can be
|
|
|
|
|
restarted with start() or restart().
|
|
|
|
|
.SS Transition
|
2025-12-02 09:21:43 -05:00
|
|
|
.PP
|
2026-01-23 20:49:11 -05:00
|
|
|
\f[I]Inherits from: IntEnum\f[R]
|
2025-12-02 09:21:43 -05:00
|
|
|
.PP
|
2026-01-23 20:49:11 -05:00
|
|
|
\f[B]Properties:\f[R] - \f[V]denominator\f[R]: the denominator of a
|
|
|
|
|
rational number in lowest terms - \f[V]imag\f[R]: the imaginary part of
|
|
|
|
|
a complex number - \f[V]numerator\f[R]: the numerator of a rational
|
|
|
|
|
number in lowest terms - \f[V]real\f[R]: the real part of a complex
|
|
|
|
|
number
|
2025-12-02 09:21:43 -05:00
|
|
|
.PP
|
2026-01-23 20:49:11 -05:00
|
|
|
\f[B]Methods:\f[R]
|
|
|
|
|
.SS \f[V]as_integer_ratio(...)\f[R]
|
2025-12-02 09:21:43 -05:00
|
|
|
.PP
|
2026-01-23 20:49:11 -05:00
|
|
|
Return a pair of integers, whose ratio is equal to the original int.
|
|
|
|
|
The ratio is in lowest terms and has a positive denominator.
|
|
|
|
|
>>> (10).as_integer_ratio() (10, 1) >>> (-10).as_integer_ratio() (-10,
|
|
|
|
|
1) >>> (0).as_integer_ratio() (0, 1)
|
|
|
|
|
.SS \f[V]bit_count(...)\f[R]
|
2025-12-02 09:21:43 -05:00
|
|
|
.PP
|
2026-01-23 20:49:11 -05:00
|
|
|
Number of ones in the binary representation of the absolute value of
|
|
|
|
|
self.
|
|
|
|
|
Also known as the population count.
|
|
|
|
|
>>> bin(13) `0b1101' >>> (13).bit_count() 3
|
|
|
|
|
.SS \f[V]bit_length(...)\f[R]
|
2025-12-02 09:21:43 -05:00
|
|
|
.PP
|
2026-01-23 20:49:11 -05:00
|
|
|
Number of bits necessary to represent self in binary.
|
|
|
|
|
>>> bin(37) `0b100101' >>> (37).bit_length() 6
|
|
|
|
|
.SS \f[V]conjugate(...)\f[R]
|
2025-12-02 09:21:43 -05:00
|
|
|
.PP
|
2026-01-23 20:49:11 -05:00
|
|
|
Returns self, the complex conjugate of any int.
|
|
|
|
|
.SS \f[V]from_bytes(...)\f[R]
|
2025-12-02 09:21:43 -05:00
|
|
|
.PP
|
2026-01-23 20:49:11 -05:00
|
|
|
Return the integer represented by the given array of bytes.
|
|
|
|
|
bytes Holds the array of bytes to convert.
|
|
|
|
|
The argument must either support the buffer protocol or be an iterable
|
|
|
|
|
object producing bytes.
|
|
|
|
|
Bytes and bytearray are examples of built-in objects that support the
|
|
|
|
|
buffer protocol.
|
|
|
|
|
byteorder The byte order used to represent the integer.
|
|
|
|
|
If byteorder is `big', the most significant byte is at the beginning of
|
|
|
|
|
the byte array.
|
|
|
|
|
If byteorder is `little', the most significant byte is at the end of the
|
|
|
|
|
byte array.
|
|
|
|
|
To request the native byte order of the host system, use sys.byteorder
|
|
|
|
|
as the byte order value.
|
|
|
|
|
Default is to use `big'.
|
|
|
|
|
signed Indicates whether two\[cq]s complement is used to represent the
|
|
|
|
|
integer.
|
|
|
|
|
.SS \f[V]is_integer(...)\f[R]
|
2025-10-30 21:20:50 -04:00
|
|
|
.PP
|
2026-01-23 20:49:11 -05:00
|
|
|
Returns True.
|
|
|
|
|
Exists for duck type compatibility with float.is_integer.
|
|
|
|
|
.SS \f[V]to_bytes(...)\f[R]
|
2025-10-30 21:20:50 -04:00
|
|
|
.PP
|
2026-01-23 20:49:11 -05:00
|
|
|
Return an array of bytes representing an integer.
|
|
|
|
|
length Length of bytes object to use.
|
|
|
|
|
An OverflowError is raised if the integer is not representable with the
|
|
|
|
|
given number of bytes.
|
|
|
|
|
Default is length 1.
|
|
|
|
|
byteorder The byte order used to represent the integer.
|
|
|
|
|
If byteorder is `big', the most significant byte is at the beginning of
|
|
|
|
|
the byte array.
|
|
|
|
|
If byteorder is `little', the most significant byte is at the end of the
|
|
|
|
|
byte array.
|
|
|
|
|
To request the native byte order of the host system, use sys.byteorder
|
|
|
|
|
as the byte order value.
|
|
|
|
|
Default is to use `big'.
|
|
|
|
|
signed Determines whether two\[cq]s complement is used to represent the
|
|
|
|
|
integer.
|
|
|
|
|
If signed is False and a negative integer is given, an OverflowError is
|
|
|
|
|
raised.
|
|
|
|
|
.SS Traversal
|
2025-10-30 21:20:50 -04:00
|
|
|
.PP
|
2026-01-23 20:49:11 -05:00
|
|
|
\f[I]Inherits from: IntEnum\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Properties:\f[R] - \f[V]denominator\f[R]: the denominator of a
|
|
|
|
|
rational number in lowest terms - \f[V]imag\f[R]: the imaginary part of
|
|
|
|
|
a complex number - \f[V]numerator\f[R]: the numerator of a rational
|
|
|
|
|
number in lowest terms - \f[V]real\f[R]: the real part of a complex
|
|
|
|
|
number
|
2025-10-30 21:20:50 -04:00
|
|
|
.PP
|
|
|
|
|
\f[B]Methods:\f[R]
|
2026-01-23 20:49:11 -05:00
|
|
|
.SS \f[V]as_integer_ratio(...)\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Return a pair of integers, whose ratio is equal to the original int.
|
|
|
|
|
The ratio is in lowest terms and has a positive denominator.
|
|
|
|
|
>>> (10).as_integer_ratio() (10, 1) >>> (-10).as_integer_ratio() (-10,
|
|
|
|
|
1) >>> (0).as_integer_ratio() (0, 1)
|
|
|
|
|
.SS \f[V]bit_count(...)\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Number of ones in the binary representation of the absolute value of
|
|
|
|
|
self.
|
|
|
|
|
Also known as the population count.
|
|
|
|
|
>>> bin(13) `0b1101' >>> (13).bit_count() 3
|
|
|
|
|
.SS \f[V]bit_length(...)\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Number of bits necessary to represent self in binary.
|
|
|
|
|
>>> bin(37) `0b100101' >>> (37).bit_length() 6
|
|
|
|
|
.SS \f[V]conjugate(...)\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Returns self, the complex conjugate of any int.
|
|
|
|
|
.SS \f[V]from_bytes(...)\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Return the integer represented by the given array of bytes.
|
|
|
|
|
bytes Holds the array of bytes to convert.
|
|
|
|
|
The argument must either support the buffer protocol or be an iterable
|
|
|
|
|
object producing bytes.
|
|
|
|
|
Bytes and bytearray are examples of built-in objects that support the
|
|
|
|
|
buffer protocol.
|
|
|
|
|
byteorder The byte order used to represent the integer.
|
|
|
|
|
If byteorder is `big', the most significant byte is at the beginning of
|
|
|
|
|
the byte array.
|
|
|
|
|
If byteorder is `little', the most significant byte is at the end of the
|
|
|
|
|
byte array.
|
|
|
|
|
To request the native byte order of the host system, use sys.byteorder
|
|
|
|
|
as the byte order value.
|
|
|
|
|
Default is to use `big'.
|
|
|
|
|
signed Indicates whether two\[cq]s complement is used to represent the
|
|
|
|
|
integer.
|
|
|
|
|
.SS \f[V]is_integer(...)\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Returns True.
|
|
|
|
|
Exists for duck type compatibility with float.is_integer.
|
|
|
|
|
.SS \f[V]to_bytes(...)\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Return an array of bytes representing an integer.
|
|
|
|
|
length Length of bytes object to use.
|
|
|
|
|
An OverflowError is raised if the integer is not representable with the
|
|
|
|
|
given number of bytes.
|
|
|
|
|
Default is length 1.
|
|
|
|
|
byteorder The byte order used to represent the integer.
|
|
|
|
|
If byteorder is `big', the most significant byte is at the beginning of
|
|
|
|
|
the byte array.
|
|
|
|
|
If byteorder is `little', the most significant byte is at the end of the
|
|
|
|
|
byte array.
|
|
|
|
|
To request the native byte order of the host system, use sys.byteorder
|
|
|
|
|
as the byte order value.
|
|
|
|
|
Default is to use `big'.
|
|
|
|
|
signed Determines whether two\[cq]s complement is used to represent the
|
|
|
|
|
integer.
|
|
|
|
|
If signed is False and a negative integer is given, an OverflowError is
|
|
|
|
|
raised.
|
Replace UIEntity gridstate with DiscreteMap perspective_map; closes #294
Per-entity FOV memory moves from std::vector<UIGridPointState> (two-bool
visible/discovered pairs) to a 3-state DiscreteMap (0=UNKNOWN, 1=DISCOVERED,
2=VISIBLE), exposed as entity.perspective_map. The invariant
visible-subset-of-discovered becomes structural (single value per cell), and
the map is a live, serializable, first-class object rather than an implicit
internal array.
Changes:
- New DiscreteMap C++ class with shared ownership; PyDiscreteMapObject now
holds shared_ptr<DiscreteMap>. UIEntity holds the same shared_ptr.
- New mcrfpy.Perspective IntEnum (UNKNOWN/DISCOVERED/VISIBLE), modelled on
PyInputState.
- entity.perspective_map: lazy-allocated on first access with a grid;
setter validates size against grid and raises ValueError on mismatch;
None clears (next access lazy-reallocates fresh).
- updateVisibility() now demotes 2->1 then promotes visible cells to 2.
- entity.at(x, y) returns grid.at(x, y) when VISIBLE, else None.
- Fog-of-war rendering in UIGridView and UIGrid reads the 3-state map.
- Removed: UIEntity::gridstate, ensureGridstate(), entity.gridstate getter,
UIGridPointState struct + PyUIGridPointStateType.
- Obsolete tests deleted (test_gridpointstate_point,
issue_265_gridpointstate_dangle); 4 new tests cover lazy allocation,
identity, serialization round-trip, size validation, and the
visible-subset-of-discovered invariant.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-17 23:04:27 -04:00
|
|
|
.SS Trigger
|
|
|
|
|
.PP
|
|
|
|
|
\f[I]Inherits from: IntEnum\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Enum representing trigger types passed to entity step() callbacks.
|
|
|
|
|
.PP
|
|
|
|
|
Values: DONE: Behavior completed (path exhausted, sleep finished, etc.)
|
|
|
|
|
BLOCKED: Movement blocked by wall or collision TARGET: Target entity
|
|
|
|
|
spotted in FOV
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Properties:\f[R] - \f[V]denominator\f[R]: the denominator of a
|
|
|
|
|
rational number in lowest terms - \f[V]imag\f[R]: the imaginary part of
|
|
|
|
|
a complex number - \f[V]numerator\f[R]: the numerator of a rational
|
|
|
|
|
number in lowest terms - \f[V]real\f[R]: the real part of a complex
|
|
|
|
|
number
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Methods:\f[R]
|
|
|
|
|
.SS \f[V]as_integer_ratio(...)\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Return a pair of integers, whose ratio is equal to the original int.
|
|
|
|
|
The ratio is in lowest terms and has a positive denominator.
|
|
|
|
|
>>> (10).as_integer_ratio() (10, 1) >>> (-10).as_integer_ratio() (-10,
|
|
|
|
|
1) >>> (0).as_integer_ratio() (0, 1)
|
|
|
|
|
.SS \f[V]bit_count(...)\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Number of ones in the binary representation of the absolute value of
|
|
|
|
|
self.
|
|
|
|
|
Also known as the population count.
|
|
|
|
|
>>> bin(13) `0b1101' >>> (13).bit_count() 3
|
|
|
|
|
.SS \f[V]bit_length(...)\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Number of bits necessary to represent self in binary.
|
|
|
|
|
>>> bin(37) `0b100101' >>> (37).bit_length() 6
|
|
|
|
|
.SS \f[V]conjugate(...)\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Returns self, the complex conjugate of any int.
|
|
|
|
|
.SS \f[V]from_bytes(...)\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Return the integer represented by the given array of bytes.
|
|
|
|
|
bytes Holds the array of bytes to convert.
|
|
|
|
|
The argument must either support the buffer protocol or be an iterable
|
|
|
|
|
object producing bytes.
|
|
|
|
|
Bytes and bytearray are examples of built-in objects that support the
|
|
|
|
|
buffer protocol.
|
|
|
|
|
byteorder The byte order used to represent the integer.
|
|
|
|
|
If byteorder is `big', the most significant byte is at the beginning of
|
|
|
|
|
the byte array.
|
|
|
|
|
If byteorder is `little', the most significant byte is at the end of the
|
|
|
|
|
byte array.
|
|
|
|
|
To request the native byte order of the host system, use sys.byteorder
|
|
|
|
|
as the byte order value.
|
|
|
|
|
Default is to use `big'.
|
|
|
|
|
signed Indicates whether two\[cq]s complement is used to represent the
|
|
|
|
|
integer.
|
|
|
|
|
.SS \f[V]is_integer(...)\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Returns True.
|
|
|
|
|
Exists for duck type compatibility with float.is_integer.
|
|
|
|
|
.SS \f[V]to_bytes(...)\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Return an array of bytes representing an integer.
|
|
|
|
|
length Length of bytes object to use.
|
|
|
|
|
An OverflowError is raised if the integer is not representable with the
|
|
|
|
|
given number of bytes.
|
|
|
|
|
Default is length 1.
|
|
|
|
|
byteorder The byte order used to represent the integer.
|
|
|
|
|
If byteorder is `big', the most significant byte is at the beginning of
|
|
|
|
|
the byte array.
|
|
|
|
|
If byteorder is `little', the most significant byte is at the end of the
|
|
|
|
|
byte array.
|
|
|
|
|
To request the native byte order of the host system, use sys.byteorder
|
|
|
|
|
as the byte order value.
|
|
|
|
|
Default is to use `big'.
|
|
|
|
|
signed Determines whether two\[cq]s complement is used to represent the
|
|
|
|
|
integer.
|
|
|
|
|
If signed is False and a negative integer is given, an OverflowError is
|
|
|
|
|
raised.
|
2025-10-30 21:20:50 -04:00
|
|
|
.SS Vector
|
|
|
|
|
.PP
|
Replace UIEntity gridstate with DiscreteMap perspective_map; closes #294
Per-entity FOV memory moves from std::vector<UIGridPointState> (two-bool
visible/discovered pairs) to a 3-state DiscreteMap (0=UNKNOWN, 1=DISCOVERED,
2=VISIBLE), exposed as entity.perspective_map. The invariant
visible-subset-of-discovered becomes structural (single value per cell), and
the map is a live, serializable, first-class object rather than an implicit
internal array.
Changes:
- New DiscreteMap C++ class with shared ownership; PyDiscreteMapObject now
holds shared_ptr<DiscreteMap>. UIEntity holds the same shared_ptr.
- New mcrfpy.Perspective IntEnum (UNKNOWN/DISCOVERED/VISIBLE), modelled on
PyInputState.
- entity.perspective_map: lazy-allocated on first access with a grid;
setter validates size against grid and raises ValueError on mismatch;
None clears (next access lazy-reallocates fresh).
- updateVisibility() now demotes 2->1 then promotes visible cells to 2.
- entity.at(x, y) returns grid.at(x, y) when VISIBLE, else None.
- Fog-of-war rendering in UIGridView and UIGrid reads the 3-state map.
- Removed: UIEntity::gridstate, ensureGridstate(), entity.gridstate getter,
UIGridPointState struct + PyUIGridPointStateType.
- Obsolete tests deleted (test_gridpointstate_point,
issue_265_gridpointstate_dangle); 4 new tests cover lazy allocation,
identity, serialization round-trip, size validation, and the
visible-subset-of-discovered invariant.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-17 23:04:27 -04:00
|
|
|
Vector(x: float = 0, y: float = 0)
|
|
|
|
|
.PP
|
|
|
|
|
2D vector for positions, sizes, and directions.
|
|
|
|
|
.PP
|
|
|
|
|
Args: x: X component.
|
|
|
|
|
y: Y component.
|
|
|
|
|
.PP
|
|
|
|
|
Supports arithmetic (+, -, *, /), abs(), len() == 2, indexing ([0] for
|
|
|
|
|
x, [1] for y), hashing, and equality.
|
|
|
|
|
.PP
|
|
|
|
|
Properties: x (float): X component.
|
|
|
|
|
y (float): Y component.
|
|
|
|
|
int (tuple[int, int], read-only): Integer floor of (x, y).
|
2025-10-30 21:20:50 -04:00
|
|
|
.PP
|
2026-01-23 20:49:11 -05:00
|
|
|
\f[B]Properties:\f[R] - \f[V]int\f[R] \f[I](read-only)\f[R]: Integer
|
|
|
|
|
tuple (floor of x and y) for use as dict keys.
|
|
|
|
|
Read-only.
|
|
|
|
|
- \f[V]x\f[R]: X coordinate of the vector (float) - \f[V]y\f[R]: Y
|
|
|
|
|
coordinate of the vector (float)
|
|
|
|
|
.PP
|
2025-10-30 21:20:50 -04:00
|
|
|
\f[B]Methods:\f[R]
|
|
|
|
|
.SS \f[V]angle() -> float\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Get the angle of this vector in radians.
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Returns:\f[R] float: Angle in radians from positive x-axis
|
|
|
|
|
.SS \f[V]copy() -> Vector\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Create a copy of this vector.
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Returns:\f[R] Vector: New Vector object with same x and y values
|
|
|
|
|
.SS \f[V]distance_to(other: Vector) -> float\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Calculate the distance to another vector.
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Arguments:\f[R] - \f[V]other\f[R]: The other vector
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Returns:\f[R] float: Distance between the two vectors
|
|
|
|
|
.SS \f[V]dot(other: Vector) -> float\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Calculate the dot product with another vector.
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Arguments:\f[R] - \f[V]other\f[R]: The other vector
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Returns:\f[R] float: Dot product of the two vectors
|
2025-12-02 09:21:43 -05:00
|
|
|
.SS \f[V]floor() -> Vector\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Return a new vector with floored (integer) coordinates.
|
|
|
|
|
.PP
|
|
|
|
|
Note:
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Returns:\f[R] Vector: New Vector with floor(x) and floor(y) Useful
|
|
|
|
|
for grid-based positioning.
|
|
|
|
|
For a hashable tuple, use the .int property instead.
|
2025-10-30 21:20:50 -04:00
|
|
|
.SS \f[V]magnitude() -> float\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Calculate the length/magnitude of this vector.
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Returns:\f[R] float: The magnitude of the vector
|
|
|
|
|
.SS \f[V]magnitude_squared() -> float\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Calculate the squared magnitude of this vector.
|
|
|
|
|
.PP
|
|
|
|
|
Note:
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Returns:\f[R] float: The squared magnitude (faster than
|
|
|
|
|
magnitude()) Use this for comparisons to avoid expensive square root
|
|
|
|
|
calculation.
|
|
|
|
|
.SS \f[V]normalize() -> Vector\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Return a unit vector in the same direction.
|
|
|
|
|
.PP
|
|
|
|
|
Note:
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Returns:\f[R] Vector: New normalized vector with magnitude 1.0 For
|
|
|
|
|
zero vectors (magnitude 0.0), returns a zero vector rather than raising
|
|
|
|
|
an exception
|
Replace UIEntity gridstate with DiscreteMap perspective_map; closes #294
Per-entity FOV memory moves from std::vector<UIGridPointState> (two-bool
visible/discovered pairs) to a 3-state DiscreteMap (0=UNKNOWN, 1=DISCOVERED,
2=VISIBLE), exposed as entity.perspective_map. The invariant
visible-subset-of-discovered becomes structural (single value per cell), and
the map is a live, serializable, first-class object rather than an implicit
internal array.
Changes:
- New DiscreteMap C++ class with shared ownership; PyDiscreteMapObject now
holds shared_ptr<DiscreteMap>. UIEntity holds the same shared_ptr.
- New mcrfpy.Perspective IntEnum (UNKNOWN/DISCOVERED/VISIBLE), modelled on
PyInputState.
- entity.perspective_map: lazy-allocated on first access with a grid;
setter validates size against grid and raises ValueError on mismatch;
None clears (next access lazy-reallocates fresh).
- updateVisibility() now demotes 2->1 then promotes visible cells to 2.
- entity.at(x, y) returns grid.at(x, y) when VISIBLE, else None.
- Fog-of-war rendering in UIGridView and UIGrid reads the 3-state map.
- Removed: UIEntity::gridstate, ensureGridstate(), entity.gridstate getter,
UIGridPointState struct + PyUIGridPointStateType.
- Obsolete tests deleted (test_gridpointstate_point,
issue_265_gridpointstate_dangle); 4 new tests cover lazy allocation,
identity, serialization round-trip, size validation, and the
visible-subset-of-discovered invariant.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-17 23:04:27 -04:00
|
|
|
.SS Viewport3D
|
|
|
|
|
.PP
|
|
|
|
|
\f[I]Inherits from: Drawable\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Viewport3D(pos=None, size=None, **kwargs)
|
|
|
|
|
.PP
|
|
|
|
|
A 3D rendering viewport that displays a 3D scene as a UI element.
|
|
|
|
|
.PP
|
|
|
|
|
Args: pos (tuple, optional): Position as (x, y) tuple.
|
|
|
|
|
Default: (0, 0) size (tuple, optional): Display size as (width, height).
|
|
|
|
|
Default: (320, 240)
|
|
|
|
|
.PP
|
|
|
|
|
Keyword Args: render_resolution (tuple): Internal render resolution
|
|
|
|
|
(width, height).
|
|
|
|
|
Default: (320, 240) fov (float): Camera field of view in degrees.
|
|
|
|
|
Default: 60 camera_pos (tuple): Camera position (x, y, z).
|
|
|
|
|
Default: (0, 0, 5) camera_target (tuple): Camera look-at point (x, y,
|
|
|
|
|
z).
|
|
|
|
|
Default: (0, 0, 0) bg_color (Color): Background clear color.
|
|
|
|
|
Default: (25, 25, 50) enable_vertex_snap (bool): PS1-style vertex
|
|
|
|
|
snapping.
|
|
|
|
|
Default: True enable_affine (bool): PS1-style affine texture mapping.
|
|
|
|
|
Default: True enable_dither (bool): PS1-style color dithering.
|
|
|
|
|
Default: True enable_fog (bool): Distance fog.
|
|
|
|
|
Default: True fog_color (Color): Fog color.
|
|
|
|
|
Default: (128, 128, 153) fog_near (float): Fog start distance.
|
|
|
|
|
Default: 10 fog_far (float): Fog end distance.
|
|
|
|
|
Default: 100
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Properties:\f[R] - \f[V]bg_color\f[R]: Background clear color.
|
F15: correct docstring accuracy from adversarial verify pass (#314)
Follow-up to the macro conversion: an adversarial verify pass (one agent per
file vs. the C++ implementation + stubs) found 62 content issues; the real
ones are fixed here.
Callbacks (centralized):
- on_click: receives (pos, MouseButton, InputState), not str (8 files).
- on_enter/on_exit/on_move (UIBase.h): hover passes only (pos) -- removed the
fictional button/action args.
- bounds/global_bounds (UIBase.h): mark (tuple, read-only).
Signatures / types:
- Grid.find_path: document heuristic + weight; get_dijkstra_map: document roots;
compute_fov: FOV | int = FOV.BASIC (not the C constant FOV_BASIC) + Returns;
at/is_in_fov: document (pos) and (x, y) call forms.
- get_metrics: document all 16 returned dict keys (was 8); bresenham: drop the
bogus '*' keyword-only separator.
- Nullable defaults typed correctly: BSP seed/size, ColorLayer draw_fov/
apply_perspective Color|None, Entity.visible_entities radius int=-1 (None is
rejected by the 'i' parser -> see #319).
- Type-token fixes: GridView.center -> Vector; GridView.texture -> (None,
read-only) (unimplemented, #318); GridPoint.grid_pos -> (tuple, read-only);
EntityCollection.find -> Entity | list[Entity] | None; extend RuntimeError;
UniformCollection.values -> list[float | tuple | None].
- automation: onScreen (x, y) form documented; scroll notes x is ignored (#317).
Also: correct stale AStarPath/DijkstraMap signatures in docs/api-audit-2026-04.md
(the bindings were right, the audit table was outdated). Rebaseline the API
snapshot golden and regenerate docs/stubs.
Code-level bugs surfaced by the pass are filed as #317, #318, #319.
Refs #314, #317, #318, #319
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 06:43:47 -04:00
|
|
|
- \f[V]bounds\f[R] \f[I](read-only)\f[R]: Axis-aligned bounding box
|
|
|
|
|
(tuple, read-only) as a (pos, size) pair of Vectors: (Vector(x, y),
|
|
|
|
|
Vector(width, height)).
|
Replace UIEntity gridstate with DiscreteMap perspective_map; closes #294
Per-entity FOV memory moves from std::vector<UIGridPointState> (two-bool
visible/discovered pairs) to a 3-state DiscreteMap (0=UNKNOWN, 1=DISCOVERED,
2=VISIBLE), exposed as entity.perspective_map. The invariant
visible-subset-of-discovered becomes structural (single value per cell), and
the map is a live, serializable, first-class object rather than an implicit
internal array.
Changes:
- New DiscreteMap C++ class with shared ownership; PyDiscreteMapObject now
holds shared_ptr<DiscreteMap>. UIEntity holds the same shared_ptr.
- New mcrfpy.Perspective IntEnum (UNKNOWN/DISCOVERED/VISIBLE), modelled on
PyInputState.
- entity.perspective_map: lazy-allocated on first access with a grid;
setter validates size against grid and raises ValueError on mismatch;
None clears (next access lazy-reallocates fresh).
- updateVisibility() now demotes 2->1 then promotes visible cells to 2.
- entity.at(x, y) returns grid.at(x, y) when VISIBLE, else None.
- Fog-of-war rendering in UIGridView and UIGrid reads the 3-state map.
- Removed: UIEntity::gridstate, ensureGridstate(), entity.gridstate getter,
UIGridPointState struct + PyUIGridPointStateType.
- Obsolete tests deleted (test_gridpointstate_point,
issue_265_gridpointstate_dangle); 4 new tests cover lazy allocation,
identity, serialization round-trip, size validation, and the
visible-subset-of-discovered invariant.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-17 23:04:27 -04:00
|
|
|
- \f[V]camera_pos\f[R]: Camera position as (x, y, z) tuple.
|
|
|
|
|
- \f[V]camera_target\f[R]: Camera look-at target as (x, y, z) tuple.
|
|
|
|
|
- \f[V]cell_size\f[R]: World units per navigation grid cell.
|
|
|
|
|
- \f[V]enable_affine\f[R]: Enable PS1-style affine texture mapping
|
|
|
|
|
(warped textures).
|
|
|
|
|
- \f[V]enable_dither\f[R]: Enable PS1-style color dithering.
|
|
|
|
|
- \f[V]enable_fog\f[R]: Enable distance fog.
|
|
|
|
|
- \f[V]enable_vertex_snap\f[R]: Enable PS1-style vertex snapping
|
|
|
|
|
(jittery vertices).
|
|
|
|
|
- \f[V]entities\f[R] \f[I](read-only)\f[R]: Collection of Entity3D
|
|
|
|
|
objects (read-only).
|
|
|
|
|
Use append/remove to modify.
|
|
|
|
|
- \f[V]fog_color\f[R]: Fog color.
|
|
|
|
|
- \f[V]fog_far\f[R]: Fog end distance.
|
|
|
|
|
- \f[V]fog_near\f[R]: Fog start distance.
|
|
|
|
|
- \f[V]fov\f[R]: Camera field of view in degrees.
|
F15: correct docstring accuracy from adversarial verify pass (#314)
Follow-up to the macro conversion: an adversarial verify pass (one agent per
file vs. the C++ implementation + stubs) found 62 content issues; the real
ones are fixed here.
Callbacks (centralized):
- on_click: receives (pos, MouseButton, InputState), not str (8 files).
- on_enter/on_exit/on_move (UIBase.h): hover passes only (pos) -- removed the
fictional button/action args.
- bounds/global_bounds (UIBase.h): mark (tuple, read-only).
Signatures / types:
- Grid.find_path: document heuristic + weight; get_dijkstra_map: document roots;
compute_fov: FOV | int = FOV.BASIC (not the C constant FOV_BASIC) + Returns;
at/is_in_fov: document (pos) and (x, y) call forms.
- get_metrics: document all 16 returned dict keys (was 8); bresenham: drop the
bogus '*' keyword-only separator.
- Nullable defaults typed correctly: BSP seed/size, ColorLayer draw_fov/
apply_perspective Color|None, Entity.visible_entities radius int=-1 (None is
rejected by the 'i' parser -> see #319).
- Type-token fixes: GridView.center -> Vector; GridView.texture -> (None,
read-only) (unimplemented, #318); GridPoint.grid_pos -> (tuple, read-only);
EntityCollection.find -> Entity | list[Entity] | None; extend RuntimeError;
UniformCollection.values -> list[float | tuple | None].
- automation: onScreen (x, y) form documented; scroll notes x is ignored (#317).
Also: correct stale AStarPath/DijkstraMap signatures in docs/api-audit-2026-04.md
(the bindings were right, the audit table was outdated). Rebaseline the API
snapshot golden and regenerate docs/stubs.
Code-level bugs surfaced by the pass are filed as #317, #318, #319.
Refs #314, #317, #318, #319
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 06:43:47 -04:00
|
|
|
- \f[V]global_bounds\f[R] \f[I](read-only)\f[R]: Axis-aligned bounding
|
|
|
|
|
box in screen coordinates (tuple, read-only) as a (pos, size) pair of
|
|
|
|
|
Vectors: (Vector(x, y), Vector(width, height)).
|
Replace UIEntity gridstate with DiscreteMap perspective_map; closes #294
Per-entity FOV memory moves from std::vector<UIGridPointState> (two-bool
visible/discovered pairs) to a 3-state DiscreteMap (0=UNKNOWN, 1=DISCOVERED,
2=VISIBLE), exposed as entity.perspective_map. The invariant
visible-subset-of-discovered becomes structural (single value per cell), and
the map is a live, serializable, first-class object rather than an implicit
internal array.
Changes:
- New DiscreteMap C++ class with shared ownership; PyDiscreteMapObject now
holds shared_ptr<DiscreteMap>. UIEntity holds the same shared_ptr.
- New mcrfpy.Perspective IntEnum (UNKNOWN/DISCOVERED/VISIBLE), modelled on
PyInputState.
- entity.perspective_map: lazy-allocated on first access with a grid;
setter validates size against grid and raises ValueError on mismatch;
None clears (next access lazy-reallocates fresh).
- updateVisibility() now demotes 2->1 then promotes visible cells to 2.
- entity.at(x, y) returns grid.at(x, y) when VISIBLE, else None.
- Fog-of-war rendering in UIGridView and UIGrid reads the 3-state map.
- Removed: UIEntity::gridstate, ensureGridstate(), entity.gridstate getter,
UIGridPointState struct + PyUIGridPointStateType.
- Obsolete tests deleted (test_gridpointstate_point,
issue_265_gridpointstate_dangle); 4 new tests cover lazy allocation,
identity, serialization round-trip, size validation, and the
visible-subset-of-discovered invariant.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-17 23:04:27 -04:00
|
|
|
- \f[V]global_position\f[R] \f[I](read-only)\f[R]: Global screen
|
|
|
|
|
position (read-only).
|
|
|
|
|
Calculates absolute position by walking up the parent chain.
|
|
|
|
|
- \f[V]grid_size\f[R]: Navigation grid dimensions as (width, depth)
|
|
|
|
|
tuple.
|
|
|
|
|
- \f[V]h\f[R]: Display height in pixels.
|
|
|
|
|
- \f[V]hovered\f[R] \f[I](read-only)\f[R]: Whether mouse is currently
|
|
|
|
|
over this element (read-only).
|
|
|
|
|
Updated automatically by the engine during mouse movement.
|
|
|
|
|
- \f[V]on_click\f[R]: Callable executed when object is clicked.
|
F15: correct docstring accuracy from adversarial verify pass (#314)
Follow-up to the macro conversion: an adversarial verify pass (one agent per
file vs. the C++ implementation + stubs) found 62 content issues; the real
ones are fixed here.
Callbacks (centralized):
- on_click: receives (pos, MouseButton, InputState), not str (8 files).
- on_enter/on_exit/on_move (UIBase.h): hover passes only (pos) -- removed the
fictional button/action args.
- bounds/global_bounds (UIBase.h): mark (tuple, read-only).
Signatures / types:
- Grid.find_path: document heuristic + weight; get_dijkstra_map: document roots;
compute_fov: FOV | int = FOV.BASIC (not the C constant FOV_BASIC) + Returns;
at/is_in_fov: document (pos) and (x, y) call forms.
- get_metrics: document all 16 returned dict keys (was 8); bresenham: drop the
bogus '*' keyword-only separator.
- Nullable defaults typed correctly: BSP seed/size, ColorLayer draw_fov/
apply_perspective Color|None, Entity.visible_entities radius int=-1 (None is
rejected by the 'i' parser -> see #319).
- Type-token fixes: GridView.center -> Vector; GridView.texture -> (None,
read-only) (unimplemented, #318); GridPoint.grid_pos -> (tuple, read-only);
EntityCollection.find -> Entity | list[Entity] | None; extend RuntimeError;
UniformCollection.values -> list[float | tuple | None].
- automation: onScreen (x, y) form documented; scroll notes x is ignored (#317).
Also: correct stale AStarPath/DijkstraMap signatures in docs/api-audit-2026-04.md
(the bindings were right, the audit table was outdated). Rebaseline the API
snapshot golden and regenerate docs/stubs.
Code-level bugs surfaced by the pass are filed as #317, #318, #319.
Refs #314, #317, #318, #319
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 06:43:47 -04:00
|
|
|
Function receives (pos: Vector, button: MouseButton, action:
|
|
|
|
|
InputState).
|
Replace UIEntity gridstate with DiscreteMap perspective_map; closes #294
Per-entity FOV memory moves from std::vector<UIGridPointState> (two-bool
visible/discovered pairs) to a 3-state DiscreteMap (0=UNKNOWN, 1=DISCOVERED,
2=VISIBLE), exposed as entity.perspective_map. The invariant
visible-subset-of-discovered becomes structural (single value per cell), and
the map is a live, serializable, first-class object rather than an implicit
internal array.
Changes:
- New DiscreteMap C++ class with shared ownership; PyDiscreteMapObject now
holds shared_ptr<DiscreteMap>. UIEntity holds the same shared_ptr.
- New mcrfpy.Perspective IntEnum (UNKNOWN/DISCOVERED/VISIBLE), modelled on
PyInputState.
- entity.perspective_map: lazy-allocated on first access with a grid;
setter validates size against grid and raises ValueError on mismatch;
None clears (next access lazy-reallocates fresh).
- updateVisibility() now demotes 2->1 then promotes visible cells to 2.
- entity.at(x, y) returns grid.at(x, y) when VISIBLE, else None.
- Fog-of-war rendering in UIGridView and UIGrid reads the 3-state map.
- Removed: UIEntity::gridstate, ensureGridstate(), entity.gridstate getter,
UIGridPointState struct + PyUIGridPointStateType.
- Obsolete tests deleted (test_gridpointstate_point,
issue_265_gridpointstate_dangle); 4 new tests cover lazy allocation,
identity, serialization round-trip, size validation, and the
visible-subset-of-discovered invariant.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-17 23:04:27 -04:00
|
|
|
- \f[V]on_enter\f[R]: Callback for mouse enter events.
|
F15: correct docstring accuracy from adversarial verify pass (#314)
Follow-up to the macro conversion: an adversarial verify pass (one agent per
file vs. the C++ implementation + stubs) found 62 content issues; the real
ones are fixed here.
Callbacks (centralized):
- on_click: receives (pos, MouseButton, InputState), not str (8 files).
- on_enter/on_exit/on_move (UIBase.h): hover passes only (pos) -- removed the
fictional button/action args.
- bounds/global_bounds (UIBase.h): mark (tuple, read-only).
Signatures / types:
- Grid.find_path: document heuristic + weight; get_dijkstra_map: document roots;
compute_fov: FOV | int = FOV.BASIC (not the C constant FOV_BASIC) + Returns;
at/is_in_fov: document (pos) and (x, y) call forms.
- get_metrics: document all 16 returned dict keys (was 8); bresenham: drop the
bogus '*' keyword-only separator.
- Nullable defaults typed correctly: BSP seed/size, ColorLayer draw_fov/
apply_perspective Color|None, Entity.visible_entities radius int=-1 (None is
rejected by the 'i' parser -> see #319).
- Type-token fixes: GridView.center -> Vector; GridView.texture -> (None,
read-only) (unimplemented, #318); GridPoint.grid_pos -> (tuple, read-only);
EntityCollection.find -> Entity | list[Entity] | None; extend RuntimeError;
UniformCollection.values -> list[float | tuple | None].
- automation: onScreen (x, y) form documented; scroll notes x is ignored (#317).
Also: correct stale AStarPath/DijkstraMap signatures in docs/api-audit-2026-04.md
(the bindings were right, the audit table was outdated). Rebaseline the API
snapshot golden and regenerate docs/stubs.
Code-level bugs surfaced by the pass are filed as #317, #318, #319.
Refs #314, #317, #318, #319
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 06:43:47 -04:00
|
|
|
Called with (pos: Vector) when mouse enters this element\[cq]s bounds.
|
Replace UIEntity gridstate with DiscreteMap perspective_map; closes #294
Per-entity FOV memory moves from std::vector<UIGridPointState> (two-bool
visible/discovered pairs) to a 3-state DiscreteMap (0=UNKNOWN, 1=DISCOVERED,
2=VISIBLE), exposed as entity.perspective_map. The invariant
visible-subset-of-discovered becomes structural (single value per cell), and
the map is a live, serializable, first-class object rather than an implicit
internal array.
Changes:
- New DiscreteMap C++ class with shared ownership; PyDiscreteMapObject now
holds shared_ptr<DiscreteMap>. UIEntity holds the same shared_ptr.
- New mcrfpy.Perspective IntEnum (UNKNOWN/DISCOVERED/VISIBLE), modelled on
PyInputState.
- entity.perspective_map: lazy-allocated on first access with a grid;
setter validates size against grid and raises ValueError on mismatch;
None clears (next access lazy-reallocates fresh).
- updateVisibility() now demotes 2->1 then promotes visible cells to 2.
- entity.at(x, y) returns grid.at(x, y) when VISIBLE, else None.
- Fog-of-war rendering in UIGridView and UIGrid reads the 3-state map.
- Removed: UIEntity::gridstate, ensureGridstate(), entity.gridstate getter,
UIGridPointState struct + PyUIGridPointStateType.
- Obsolete tests deleted (test_gridpointstate_point,
issue_265_gridpointstate_dangle); 4 new tests cover lazy allocation,
identity, serialization round-trip, size validation, and the
visible-subset-of-discovered invariant.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-17 23:04:27 -04:00
|
|
|
- \f[V]on_exit\f[R]: Callback for mouse exit events.
|
F15: correct docstring accuracy from adversarial verify pass (#314)
Follow-up to the macro conversion: an adversarial verify pass (one agent per
file vs. the C++ implementation + stubs) found 62 content issues; the real
ones are fixed here.
Callbacks (centralized):
- on_click: receives (pos, MouseButton, InputState), not str (8 files).
- on_enter/on_exit/on_move (UIBase.h): hover passes only (pos) -- removed the
fictional button/action args.
- bounds/global_bounds (UIBase.h): mark (tuple, read-only).
Signatures / types:
- Grid.find_path: document heuristic + weight; get_dijkstra_map: document roots;
compute_fov: FOV | int = FOV.BASIC (not the C constant FOV_BASIC) + Returns;
at/is_in_fov: document (pos) and (x, y) call forms.
- get_metrics: document all 16 returned dict keys (was 8); bresenham: drop the
bogus '*' keyword-only separator.
- Nullable defaults typed correctly: BSP seed/size, ColorLayer draw_fov/
apply_perspective Color|None, Entity.visible_entities radius int=-1 (None is
rejected by the 'i' parser -> see #319).
- Type-token fixes: GridView.center -> Vector; GridView.texture -> (None,
read-only) (unimplemented, #318); GridPoint.grid_pos -> (tuple, read-only);
EntityCollection.find -> Entity | list[Entity] | None; extend RuntimeError;
UniformCollection.values -> list[float | tuple | None].
- automation: onScreen (x, y) form documented; scroll notes x is ignored (#317).
Also: correct stale AStarPath/DijkstraMap signatures in docs/api-audit-2026-04.md
(the bindings were right, the audit table was outdated). Rebaseline the API
snapshot golden and regenerate docs/stubs.
Code-level bugs surfaced by the pass are filed as #317, #318, #319.
Refs #314, #317, #318, #319
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 06:43:47 -04:00
|
|
|
Called with (pos: Vector) when mouse leaves this element\[cq]s bounds.
|
Replace UIEntity gridstate with DiscreteMap perspective_map; closes #294
Per-entity FOV memory moves from std::vector<UIGridPointState> (two-bool
visible/discovered pairs) to a 3-state DiscreteMap (0=UNKNOWN, 1=DISCOVERED,
2=VISIBLE), exposed as entity.perspective_map. The invariant
visible-subset-of-discovered becomes structural (single value per cell), and
the map is a live, serializable, first-class object rather than an implicit
internal array.
Changes:
- New DiscreteMap C++ class with shared ownership; PyDiscreteMapObject now
holds shared_ptr<DiscreteMap>. UIEntity holds the same shared_ptr.
- New mcrfpy.Perspective IntEnum (UNKNOWN/DISCOVERED/VISIBLE), modelled on
PyInputState.
- entity.perspective_map: lazy-allocated on first access with a grid;
setter validates size against grid and raises ValueError on mismatch;
None clears (next access lazy-reallocates fresh).
- updateVisibility() now demotes 2->1 then promotes visible cells to 2.
- entity.at(x, y) returns grid.at(x, y) when VISIBLE, else None.
- Fog-of-war rendering in UIGridView and UIGrid reads the 3-state map.
- Removed: UIEntity::gridstate, ensureGridstate(), entity.gridstate getter,
UIGridPointState struct + PyUIGridPointStateType.
- Obsolete tests deleted (test_gridpointstate_point,
issue_265_gridpointstate_dangle); 4 new tests cover lazy allocation,
identity, serialization round-trip, size validation, and the
visible-subset-of-discovered invariant.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-17 23:04:27 -04:00
|
|
|
- \f[V]on_move\f[R]: Callback for mouse movement within bounds.
|
F15: correct docstring accuracy from adversarial verify pass (#314)
Follow-up to the macro conversion: an adversarial verify pass (one agent per
file vs. the C++ implementation + stubs) found 62 content issues; the real
ones are fixed here.
Callbacks (centralized):
- on_click: receives (pos, MouseButton, InputState), not str (8 files).
- on_enter/on_exit/on_move (UIBase.h): hover passes only (pos) -- removed the
fictional button/action args.
- bounds/global_bounds (UIBase.h): mark (tuple, read-only).
Signatures / types:
- Grid.find_path: document heuristic + weight; get_dijkstra_map: document roots;
compute_fov: FOV | int = FOV.BASIC (not the C constant FOV_BASIC) + Returns;
at/is_in_fov: document (pos) and (x, y) call forms.
- get_metrics: document all 16 returned dict keys (was 8); bresenham: drop the
bogus '*' keyword-only separator.
- Nullable defaults typed correctly: BSP seed/size, ColorLayer draw_fov/
apply_perspective Color|None, Entity.visible_entities radius int=-1 (None is
rejected by the 'i' parser -> see #319).
- Type-token fixes: GridView.center -> Vector; GridView.texture -> (None,
read-only) (unimplemented, #318); GridPoint.grid_pos -> (tuple, read-only);
EntityCollection.find -> Entity | list[Entity] | None; extend RuntimeError;
UniformCollection.values -> list[float | tuple | None].
- automation: onScreen (x, y) form documented; scroll notes x is ignored (#317).
Also: correct stale AStarPath/DijkstraMap signatures in docs/api-audit-2026-04.md
(the bindings were right, the audit table was outdated). Rebaseline the API
snapshot golden and regenerate docs/stubs.
Code-level bugs surfaced by the pass are filed as #317, #318, #319.
Refs #314, #317, #318, #319
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 06:43:47 -04:00
|
|
|
Called with (pos: Vector) for each mouse movement while inside.
|
Replace UIEntity gridstate with DiscreteMap perspective_map; closes #294
Per-entity FOV memory moves from std::vector<UIGridPointState> (two-bool
visible/discovered pairs) to a 3-state DiscreteMap (0=UNKNOWN, 1=DISCOVERED,
2=VISIBLE), exposed as entity.perspective_map. The invariant
visible-subset-of-discovered becomes structural (single value per cell), and
the map is a live, serializable, first-class object rather than an implicit
internal array.
Changes:
- New DiscreteMap C++ class with shared ownership; PyDiscreteMapObject now
holds shared_ptr<DiscreteMap>. UIEntity holds the same shared_ptr.
- New mcrfpy.Perspective IntEnum (UNKNOWN/DISCOVERED/VISIBLE), modelled on
PyInputState.
- entity.perspective_map: lazy-allocated on first access with a grid;
setter validates size against grid and raises ValueError on mismatch;
None clears (next access lazy-reallocates fresh).
- updateVisibility() now demotes 2->1 then promotes visible cells to 2.
- entity.at(x, y) returns grid.at(x, y) when VISIBLE, else None.
- Fog-of-war rendering in UIGridView and UIGrid reads the 3-state map.
- Removed: UIEntity::gridstate, ensureGridstate(), entity.gridstate getter,
UIGridPointState struct + PyUIGridPointStateType.
- Obsolete tests deleted (test_gridpointstate_point,
issue_265_gridpointstate_dangle); 4 new tests cover lazy allocation,
identity, serialization round-trip, size validation, and the
visible-subset-of-discovered invariant.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-17 23:04:27 -04:00
|
|
|
Performance note: Called frequently during movement - keep handlers
|
|
|
|
|
fast.
|
|
|
|
|
- \f[V]opacity\f[R]: Opacity level (0.0 = transparent, 1.0 = opaque).
|
|
|
|
|
Automatically clamped to valid range [0.0, 1.0].
|
|
|
|
|
- \f[V]parent\f[R]: Parent drawable.
|
|
|
|
|
Get: Returns the parent Frame/Grid if nested, or None if at scene level.
|
|
|
|
|
Set: Assign a Frame/Grid to reparent, or None to remove from parent.
|
|
|
|
|
- \f[V]pos\f[R]: Position as Vector (x, y).
|
|
|
|
|
- \f[V]render_resolution\f[R]: Internal render resolution (width,
|
|
|
|
|
height).
|
|
|
|
|
Lower values for PS1 effect.
|
|
|
|
|
- \f[V]visible\f[R]: Whether the object is visible (bool).
|
|
|
|
|
Invisible objects are not rendered or clickable.
|
|
|
|
|
- \f[V]w\f[R]: Display width in pixels.
|
|
|
|
|
- \f[V]x\f[R]: X position in pixels.
|
|
|
|
|
- \f[V]y\f[R]: Y position in pixels.
|
|
|
|
|
- \f[V]z_index\f[R]: Z-order for rendering (lower values rendered
|
|
|
|
|
first).
|
|
|
|
|
Automatically triggers scene resort when changed.
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Methods:\f[R]
|
|
|
|
|
.SS \f[V]add_billboard(billboard)\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Add a Billboard to the viewport.
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Arguments:\f[R] - \f[V]billboard\f[R]: Billboard object to add
|
|
|
|
|
.SS \f[V]add_layer(name, z_index=0) -> dict\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Add a new mesh layer to the viewport.
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Arguments:\f[R] - \f[V]name\f[R]: Unique identifier for the layer -
|
|
|
|
|
\f[V]z_index\f[R]: Render order (lower = rendered first)
|
|
|
|
|
.SS \f[V]add_mesh(layer_name, model, pos, rotation=0, scale=1.0) -> int\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Add a Model3D instance to a layer at the specified position.
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Arguments:\f[R] - \f[V]layer_name\f[R]: Name of layer to add mesh
|
|
|
|
|
to (created if needed) - \f[V]model\f[R]: Model3D object to place -
|
|
|
|
|
\f[V]pos\f[R]: World position as (x, y, z) tuple - \f[V]rotation\f[R]:
|
|
|
|
|
Y-axis rotation in degrees - \f[V]scale\f[R]: Uniform scale factor
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Returns:\f[R] Index of the mesh instance
|
|
|
|
|
.SS \f[V]add_voxel_layer(voxel_grid, z_index=0)\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Add a VoxelGrid as a renderable layer.
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Arguments:\f[R] - \f[V]voxel_grid\f[R]: VoxelGrid object to render
|
|
|
|
|
- \f[V]z_index\f[R]: Render order (lower = rendered first)
|
|
|
|
|
.SS \f[V]animate(property: str, target: Any, duration: float, easing=None, delta=False, loop=False, callback=None, conflict_mode=\[aq]replace\[aq]) -> Animation\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Create and start an animation on this drawable\[cq]s property.
|
|
|
|
|
.PP
|
|
|
|
|
Note:
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Arguments:\f[R] - \f[V]property\f[R]: Name of the property to
|
|
|
|
|
animate (e.g., `x', `fill_color', `opacity') - \f[V]target\f[R]: Target
|
|
|
|
|
value - type depends on property (float, tuple for color/vector, etc.)
|
|
|
|
|
- \f[V]duration\f[R]: Animation duration in seconds - \f[V]easing\f[R]:
|
|
|
|
|
Easing function: Easing enum value, string name, or None for linear -
|
|
|
|
|
\f[V]delta\f[R]: If True, target is relative to current value; if False,
|
|
|
|
|
target is absolute - \f[V]loop\f[R]: If True, animation repeats from
|
|
|
|
|
start when it reaches the end (default False) - \f[V]callback\f[R]:
|
|
|
|
|
Optional callable invoked when animation completes (not called for
|
|
|
|
|
looping animations) - \f[V]conflict_mode\f[R]: `replace' (default),
|
|
|
|
|
`queue', or `error' if property already animating
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Returns:\f[R] Animation object for monitoring progress
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Raises:\f[R] ValueError: If property name is not valid for this
|
|
|
|
|
drawable type This is a convenience method that creates an Animation,
|
|
|
|
|
starts it, and adds it to the AnimationManager.
|
|
|
|
|
.SS \f[V]apply_heightmap(heightmap, y_scale=1.0)\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Set cell heights from HeightMap.
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Arguments:\f[R] - \f[V]heightmap\f[R]: HeightMap object -
|
|
|
|
|
\f[V]y_scale\f[R]: Vertical scale factor
|
|
|
|
|
.SS \f[V]apply_terrain_colors(layer_name, r_map, g_map, b_map)\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Apply per-vertex colors to terrain from RGB HeightMaps.
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Arguments:\f[R] - \f[V]layer_name\f[R]: Name of terrain layer to
|
|
|
|
|
colorize - \f[V]r_map\f[R]: HeightMap for red channel (0-1 values) -
|
|
|
|
|
\f[V]g_map\f[R]: HeightMap for green channel (0-1 values) -
|
|
|
|
|
\f[V]b_map\f[R]: HeightMap for blue channel (0-1 values)
|
|
|
|
|
.SS \f[V]apply_threshold(heightmap, min_height, max_height, walkable=True)\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Set cell walkability based on height thresholds.
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Arguments:\f[R] - \f[V]heightmap\f[R]: HeightMap object -
|
|
|
|
|
\f[V]min_height\f[R]: Minimum height (0-1) - \f[V]max_height\f[R]:
|
|
|
|
|
Maximum height (0-1) - \f[V]walkable\f[R]: Walkability value for cells
|
|
|
|
|
in range
|
|
|
|
|
.SS \f[V]at(x, z) -> VoxelPoint\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Get VoxelPoint at grid coordinates.
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Arguments:\f[R] - \f[V]x\f[R]: X coordinate in grid - \f[V]z\f[R]:
|
|
|
|
|
Z coordinate in grid
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Returns:\f[R] VoxelPoint object for the cell
|
|
|
|
|
.SS \f[V]billboard_count() -> int\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Get the number of billboards.
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Returns:\f[R] Number of billboards in the viewport
|
|
|
|
|
.SS \f[V]build_terrain(layer_name, heightmap, y_scale=1.0, cell_size=1.0) -> int\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Build terrain mesh from HeightMap on specified layer.
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Arguments:\f[R] - \f[V]layer_name\f[R]: Name of layer to build
|
|
|
|
|
terrain on (created if doesn\[cq]t exist) - \f[V]heightmap\f[R]:
|
|
|
|
|
HeightMap object with height data - \f[V]y_scale\f[R]: Vertical
|
|
|
|
|
exaggeration factor - \f[V]cell_size\f[R]: World-space size of each grid
|
|
|
|
|
cell
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Returns:\f[R] Number of vertices in the generated mesh
|
|
|
|
|
.SS \f[V]clear_billboards()\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Remove all billboards from the viewport.
|
|
|
|
|
.SS \f[V]clear_meshes(layer_name)\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Clear all mesh instances from a layer.
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Arguments:\f[R] - \f[V]layer_name\f[R]: Name of layer to clear
|
|
|
|
|
.SS \f[V]clear_voxel_nav_region(voxel_grid)\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Clear navigation cells in a voxel grid\[cq]s footprint.
|
|
|
|
|
Resets walkability, transparency, height, and cost to defaults for all
|
|
|
|
|
nav cells corresponding to the voxel grid\[cq]s XZ extent.
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Arguments:\f[R] - \f[V]voxel_grid\f[R]: VoxelGrid whose nav region
|
|
|
|
|
to clear
|
|
|
|
|
.SS \f[V]compute_fov(origin, radius=10) -> list\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Compute field of view from a position.
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Arguments:\f[R] - \f[V]origin\f[R]: Origin point as (x, z) tuple -
|
|
|
|
|
\f[V]radius\f[R]: FOV radius
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Returns:\f[R] List of visible (x, z) positions
|
|
|
|
|
.SS \f[V]find_path(start, end) -> list\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Find A* path between two points.
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Arguments:\f[R] - \f[V]start\f[R]: Starting point as (x, z) tuple -
|
|
|
|
|
\f[V]end\f[R]: End point as (x, z) tuple
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Returns:\f[R] List of (x, z) tuples forming the path, or empty list
|
|
|
|
|
if no path
|
|
|
|
|
.SS \f[V]follow(entity, distance=10, height=5, smoothing=1.0)\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Position camera to follow an entity.
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Arguments:\f[R] - \f[V]entity\f[R]: Entity3D to follow -
|
|
|
|
|
\f[V]distance\f[R]: Distance behind entity - \f[V]height\f[R]: Camera
|
|
|
|
|
height above entity - \f[V]smoothing\f[R]: Interpolation factor (0-1).
|
|
|
|
|
1 = instant, lower = smoother
|
|
|
|
|
.SS \f[V]get_billboard(index) -> Billboard\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Get a Billboard by index.
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Arguments:\f[R] - \f[V]index\f[R]: Index of the billboard
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Returns:\f[R] Billboard object
|
|
|
|
|
.SS \f[V]get_layer(name) -> dict or None\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Get a layer by name.
|
|
|
|
|
.SS \f[V]is_in_fov(x, z) -> bool\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Check if a cell is in the current FOV (after compute_fov).
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Arguments:\f[R] - \f[V]x\f[R]: X coordinate - \f[V]z\f[R]: Z
|
|
|
|
|
coordinate
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Returns:\f[R] True if the cell is visible
|
|
|
|
|
.SS \f[V]layer_count() -> int\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Get the number of mesh layers.
|
|
|
|
|
.SS \f[V]move(dx, dy) or (delta) -> None\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Move the element by a relative offset.
|
|
|
|
|
.PP
|
|
|
|
|
Note:
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Arguments:\f[R] - \f[V]dx\f[R]: Horizontal offset in pixels (or use
|
|
|
|
|
delta) - \f[V]dy\f[R]: Vertical offset in pixels (or use delta) -
|
|
|
|
|
\f[V]delta\f[R]: Offset as tuple, list, or Vector: (dx, dy)
|
|
|
|
|
.SS \f[V]orbit_camera(angle=0, distance=10, height=5)\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Position camera to orbit around origin.
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Arguments:\f[R] - \f[V]angle\f[R]: Orbit angle in radians -
|
|
|
|
|
\f[V]distance\f[R]: Distance from origin - \f[V]height\f[R]: Camera
|
|
|
|
|
height above XZ plane
|
|
|
|
|
.SS \f[V]place_blocking(grid_pos, footprint, walkable=False, transparent=False)\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Mark grid cells as blocking for pathfinding and FOV.
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Arguments:\f[R] - \f[V]grid_pos\f[R]: Top-left grid position as (x,
|
|
|
|
|
z) tuple - \f[V]footprint\f[R]: Size in cells as (width, depth) tuple -
|
|
|
|
|
\f[V]walkable\f[R]: Whether cells should be walkable (default: False) -
|
|
|
|
|
\f[V]transparent\f[R]: Whether cells should be transparent (default:
|
|
|
|
|
False)
|
|
|
|
|
.SS \f[V]project_all_voxels_to_nav(headroom=2)\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Project all voxel layers to the navigation grid.
|
|
|
|
|
Resets navigation grid and projects each voxel layer in z_index order.
|
|
|
|
|
Later layers (higher z_index) overwrite earlier ones.
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Arguments:\f[R] - \f[V]headroom\f[R]: Required air voxels above
|
|
|
|
|
floor for walkability (default: 2)
|
|
|
|
|
.SS \f[V]project_voxel_to_nav(voxel_grid, headroom=2)\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Project a VoxelGrid to the navigation grid.
|
|
|
|
|
Scans each column of the voxel grid and updates corresponding navigation
|
|
|
|
|
cells with walkability, transparency, height, and cost.
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Arguments:\f[R] - \f[V]voxel_grid\f[R]: VoxelGrid to project -
|
|
|
|
|
\f[V]headroom\f[R]: Required air voxels above floor for walkability
|
|
|
|
|
(default: 2)
|
|
|
|
|
.SS \f[V]realign() -> None\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Reapply alignment relative to parent, useful for responsive layouts.
|
|
|
|
|
.PP
|
|
|
|
|
Note: Call this to recalculate position after parent changes size.
|
|
|
|
|
For elements with align=None, this has no effect.
|
|
|
|
|
.SS \f[V]remove_billboard(billboard)\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Remove a Billboard from the viewport.
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Arguments:\f[R] - \f[V]billboard\f[R]: Billboard object to remove
|
|
|
|
|
.SS \f[V]remove_layer(name) -> bool\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Remove a layer by name.
|
|
|
|
|
Returns True if found and removed.
|
|
|
|
|
.SS \f[V]remove_voxel_layer(voxel_grid) -> bool\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Remove a VoxelGrid layer from the viewport.
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Arguments:\f[R] - \f[V]voxel_grid\f[R]: VoxelGrid object to remove
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Returns:\f[R] True if the layer was found and removed
|
|
|
|
|
.SS \f[V]resize(width, height) or (size) -> None\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Resize the element to new dimensions.
|
|
|
|
|
.PP
|
|
|
|
|
Note:
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Arguments:\f[R] - \f[V]width\f[R]: New width in pixels (or use
|
|
|
|
|
size) - \f[V]height\f[R]: New height in pixels (or use size) -
|
|
|
|
|
\f[V]size\f[R]: Size as tuple, list, or Vector: (width, height)
|
|
|
|
|
.SS \f[V]screen_to_world(x, y, y_plane=0.0) -> tuple or None\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Convert screen coordinates to world position via ray casting.
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Arguments:\f[R] - \f[V]x\f[R]: Screen X coordinate relative to
|
|
|
|
|
viewport - \f[V]y\f[R]: Screen Y coordinate relative to viewport -
|
|
|
|
|
\f[V]y_plane\f[R]: Y value of horizontal plane to intersect (default:
|
|
|
|
|
0.0)
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Returns:\f[R] (x, y, z) world position tuple, or None if no
|
|
|
|
|
intersection with the plane
|
|
|
|
|
.SS \f[V]set_grid_size(width, depth)\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Initialize navigation grid with specified dimensions.
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Arguments:\f[R] - \f[V]width\f[R]: Grid width (X axis) -
|
|
|
|
|
\f[V]depth\f[R]: Grid depth (Z axis)
|
|
|
|
|
.SS \f[V]set_slope_cost(max_slope=0.5, cost_multiplier=1.0)\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Calculate slope costs and mark steep cells unwalkable.
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Arguments:\f[R] - \f[V]max_slope\f[R]: Maximum height difference
|
|
|
|
|
before marking unwalkable - \f[V]cost_multiplier\f[R]: Cost increase per
|
|
|
|
|
unit slope
|
|
|
|
|
.SS \f[V]voxel_layer_count() -> int\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Get the number of voxel layers.
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Returns:\f[R] Number of voxel layers in the viewport
|
|
|
|
|
.SS VoxelGrid
|
|
|
|
|
.PP
|
|
|
|
|
VoxelGrid(size: tuple[int, int, int], cell_size: float = 1.0)
|
|
|
|
|
.PP
|
|
|
|
|
A dense 3D grid of voxel material IDs with a material palette.
|
|
|
|
|
.PP
|
|
|
|
|
VoxelGrids provide volumetric storage for 3D structures like buildings,
|
|
|
|
|
caves, and dungeon walls.
|
|
|
|
|
Each cell stores a uint8 material ID (0-255), where 0 is always air.
|
|
|
|
|
.PP
|
|
|
|
|
Args: size: (width, height, depth) dimensions.
|
|
|
|
|
Immutable after creation.
|
|
|
|
|
cell_size: World units per voxel.
|
|
|
|
|
Default 1.0.
|
|
|
|
|
.PP
|
|
|
|
|
Properties: size (tuple, read-only): Grid dimensions as (width, height,
|
|
|
|
|
depth) width, height, depth (int, read-only): Individual dimensions
|
|
|
|
|
cell_size (float, read-only): World units per voxel offset (tuple):
|
|
|
|
|
World-space position (x, y, z) rotation (float): Y-axis rotation in
|
|
|
|
|
degrees material_count (int, read-only): Number of defined materials
|
|
|
|
|
.PP
|
|
|
|
|
Example: voxels = mcrfpy.VoxelGrid(size=(16, 8, 16), cell_size=1.0)
|
|
|
|
|
stone = voxels.add_material(`stone', color=mcrfpy.Color(128, 128, 128))
|
|
|
|
|
voxels.set(5, 0, 5, stone) assert voxels.get(5, 0, 5) == stone
|
|
|
|
|
print(f\[cq]Non-air voxels: {voxels.count_non_air()}\[cq])
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Properties:\f[R] - \f[V]cell_size\f[R] \f[I](read-only)\f[R]: World
|
|
|
|
|
units per voxel.
|
|
|
|
|
Read-only.
|
|
|
|
|
- \f[V]depth\f[R] \f[I](read-only)\f[R]: Grid depth (Z dimension).
|
|
|
|
|
Read-only.
|
|
|
|
|
- \f[V]greedy_meshing\f[R]: Enable greedy meshing optimization (reduces
|
|
|
|
|
vertex count for uniform regions).
|
|
|
|
|
- \f[V]height\f[R] \f[I](read-only)\f[R]: Grid height (Y dimension).
|
|
|
|
|
Read-only.
|
|
|
|
|
- \f[V]material_count\f[R] \f[I](read-only)\f[R]: Number of materials in
|
|
|
|
|
the palette.
|
|
|
|
|
Read-only.
|
|
|
|
|
- \f[V]offset\f[R]: World-space position (x, y, z) of the grid origin.
|
|
|
|
|
- \f[V]rotation\f[R]: Y-axis rotation in degrees.
|
|
|
|
|
- \f[V]size\f[R] \f[I](read-only)\f[R]: Dimensions (width, height,
|
|
|
|
|
depth) of the grid.
|
|
|
|
|
Read-only.
|
|
|
|
|
- \f[V]vertex_count\f[R] \f[I](read-only)\f[R]: Number of vertices after
|
|
|
|
|
mesh generation.
|
|
|
|
|
Read-only.
|
|
|
|
|
- \f[V]visible\f[R]: Show or hide this voxel grid in rendering.
|
|
|
|
|
- \f[V]width\f[R] \f[I](read-only)\f[R]: Grid width (X dimension).
|
|
|
|
|
Read-only.
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Methods:\f[R]
|
|
|
|
|
.SS \f[V]add_material(name, color=Color(255,255,255), sprite_index=-1, transparent=False, path_cost=1.0) -> int\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Add a new material to the palette.
|
|
|
|
|
Returns the material ID (1-indexed).
|
|
|
|
|
Material 0 is always air (implicit, never stored in palette).
|
|
|
|
|
Maximum 255 materials can be added.
|
|
|
|
|
.SS \f[V]clear() -> None\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Clear the grid (fill with air, material 0).
|
|
|
|
|
.SS \f[V]copy_region(min_coord, max_coord) -> VoxelRegion\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Copy a rectangular region to a VoxelRegion prefab.
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Arguments:\f[R] - \f[V]min_coord\f[R]: (x0, y0, z0) - minimum
|
|
|
|
|
corner (inclusive) - \f[V]max_coord\f[R]: (x1, y1, z1) - maximum corner
|
|
|
|
|
(inclusive)
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Returns:\f[R] VoxelRegion object that can be pasted elsewhere.
|
|
|
|
|
.SS \f[V]count_material(material) -> int\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Count the number of voxels with the specified material ID.
|
|
|
|
|
.SS \f[V]count_non_air() -> int\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Count the number of non-air voxels in the grid.
|
|
|
|
|
.SS \f[V]fill(material) -> None\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Fill the entire grid with the specified material ID.
|
|
|
|
|
.SS \f[V]fill_box(min_coord, max_coord, material) -> None\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Fill a rectangular region with the specified material.
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Arguments:\f[R] - \f[V]min_coord\f[R]: (x0, y0, z0) - minimum
|
|
|
|
|
corner (inclusive) - \f[V]max_coord\f[R]: (x1, y1, z1) - maximum corner
|
|
|
|
|
(inclusive) - \f[V]material\f[R]: material ID (0-255)
|
|
|
|
|
.SS \f[V]fill_box_hollow(min_coord, max_coord, material, thickness=1) -> None\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Create a hollow rectangular room (walls only, hollow inside).
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Arguments:\f[R] - \f[V]min_coord\f[R]: (x0, y0, z0) - minimum
|
|
|
|
|
corner (inclusive) - \f[V]max_coord\f[R]: (x1, y1, z1) - maximum corner
|
|
|
|
|
(inclusive) - \f[V]material\f[R]: material ID for walls (0-255) -
|
|
|
|
|
\f[V]thickness\f[R]: wall thickness in voxels (default 1)
|
|
|
|
|
.SS \f[V]fill_cylinder(base_pos, radius, height, material) -> None\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Fill a vertical cylinder (Y-axis aligned).
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Arguments:\f[R] - \f[V]base_pos\f[R]: (cx, cy, cz) - base center
|
|
|
|
|
position - \f[V]radius\f[R]: cylinder radius in voxels -
|
|
|
|
|
\f[V]height\f[R]: cylinder height in voxels - \f[V]material\f[R]:
|
|
|
|
|
material ID (0-255)
|
|
|
|
|
.SS \f[V]fill_noise(min_coord, max_coord, material, threshold=0.5, scale=0.1, seed=0) -> None\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Fill region with 3D noise-based pattern (caves, clouds).
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Arguments:\f[R] - \f[V]min_coord\f[R]: (x0, y0, z0) - minimum
|
|
|
|
|
corner - \f[V]max_coord\f[R]: (x1, y1, z1) - maximum corner -
|
|
|
|
|
\f[V]material\f[R]: material ID for solid areas - \f[V]threshold\f[R]:
|
|
|
|
|
noise threshold (0-1, higher = more solid) - \f[V]scale\f[R]: noise
|
|
|
|
|
scale (smaller = larger features) - \f[V]seed\f[R]: random seed (0 for
|
|
|
|
|
default)
|
|
|
|
|
.SS \f[V]fill_sphere(center, radius, material) -> None\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Fill a spherical region.
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Arguments:\f[R] - \f[V]center\f[R]: (cx, cy, cz) - sphere center
|
|
|
|
|
coordinates - \f[V]radius\f[R]: sphere radius in voxels -
|
|
|
|
|
\f[V]material\f[R]: material ID (0-255, use 0 to carve)
|
|
|
|
|
.SS \f[V]from_bytes(data) -> bool\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Load voxel data from a bytes object.
|
|
|
|
|
.PP
|
|
|
|
|
Note: This replaces the current grid data entirely.
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Arguments:\f[R] - \f[V]data\f[R]: bytes object containing
|
|
|
|
|
serialized grid data
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Returns:\f[R] True on success, False on failure.
|
|
|
|
|
.SS \f[V]get(x, y, z) -> int\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Get the material ID at integer coordinates.
|
|
|
|
|
Returns 0 (air) for out-of-bounds coordinates.
|
|
|
|
|
.SS \f[V]get_material(id) -> dict\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Get material properties by ID.
|
|
|
|
|
Returns dict with keys: name, color, sprite_index, transparent,
|
|
|
|
|
path_cost.
|
|
|
|
|
ID 0 returns the implicit air material.
|
|
|
|
|
.SS \f[V]load(path) -> bool\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Load voxel data from a binary file.
|
|
|
|
|
.PP
|
|
|
|
|
Note: This replaces the current grid data entirely, including
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Arguments:\f[R] - \f[V]path\f[R]: File path to load from
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Returns:\f[R] True on success, False on failure.
|
|
|
|
|
dimensions and material palette.
|
|
|
|
|
.SS \f[V]paste_region(region, position, skip_air=True) -> None\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Paste a VoxelRegion prefab at the specified position.
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Arguments:\f[R] - \f[V]region\f[R]: VoxelRegion from copy_region()
|
|
|
|
|
- \f[V]position\f[R]: (x, y, z) - paste destination -
|
|
|
|
|
\f[V]skip_air\f[R]: if True, air voxels don\[cq]t overwrite (default
|
|
|
|
|
True)
|
|
|
|
|
.SS \f[V]project_column(x, z, headroom=2) -> dict\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Project a single column to navigation info.
|
|
|
|
|
Scans the column from top to bottom, finding the topmost floor (solid
|
|
|
|
|
voxel with air above) and checking for adequate headroom.
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Arguments:\f[R] - \f[V]x\f[R]: X coordinate in voxel grid -
|
|
|
|
|
\f[V]z\f[R]: Z coordinate in voxel grid - \f[V]headroom\f[R]: Required
|
|
|
|
|
air voxels above floor (default 2)
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Returns:\f[R] dict with keys: height (float): World Y of floor
|
|
|
|
|
surface walkable (bool): True if floor found with adequate headroom
|
|
|
|
|
transparent (bool): True if no opaque voxels in column path_cost
|
|
|
|
|
(float): Floor material\[cq]s path cost
|
|
|
|
|
.SS \f[V]rebuild_mesh() -> None\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Force immediate mesh rebuild for rendering.
|
|
|
|
|
.SS \f[V]save(path) -> bool\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Save the voxel grid to a binary file.
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Arguments:\f[R] - \f[V]path\f[R]: File path to save to (.mcvg
|
|
|
|
|
extension recommended)
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Returns:\f[R] True on success, False on failure.
|
|
|
|
|
The file format includes grid dimensions, cell size, material palette,
|
|
|
|
|
and RLE-compressed voxel data.
|
|
|
|
|
.SS \f[V]set(x, y, z, material) -> None\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Set the material ID at integer coordinates.
|
|
|
|
|
Out-of-bounds coordinates are silently ignored.
|
|
|
|
|
.SS \f[V]to_bytes() -> bytes\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Serialize the voxel grid to a bytes object.
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Returns:\f[R] bytes object containing the serialized grid data.
|
|
|
|
|
Useful for network transmission or custom storage.
|
|
|
|
|
.SS VoxelRegion
|
|
|
|
|
.PP
|
|
|
|
|
VoxelRegion - Portable voxel data for copy/paste operations.
|
|
|
|
|
.PP
|
|
|
|
|
Created by VoxelGrid.copy_region(), used with paste_region().
|
|
|
|
|
Cannot be instantiated directly.
|
|
|
|
|
.PP
|
|
|
|
|
Properties: size (tuple, read-only): Dimensions as (width, height,
|
|
|
|
|
depth) width, height, depth (int, read-only): Individual dimensions
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Properties:\f[R] - \f[V]depth\f[R] \f[I](read-only)\f[R]: Region
|
|
|
|
|
depth.
|
|
|
|
|
Read-only.
|
|
|
|
|
- \f[V]height\f[R] \f[I](read-only)\f[R]: Region height.
|
|
|
|
|
Read-only.
|
|
|
|
|
- \f[V]size\f[R] \f[I](read-only)\f[R]: Dimensions (width, height,
|
|
|
|
|
depth) of the region.
|
|
|
|
|
Read-only.
|
|
|
|
|
- \f[V]width\f[R] \f[I](read-only)\f[R]: Region width.
|
|
|
|
|
Read-only.
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Methods:\f[R]
|
|
|
|
|
.SS WangSet
|
|
|
|
|
.PP
|
|
|
|
|
WangSet - Wang terrain auto-tile set from a Tiled tileset.
|
|
|
|
|
.PP
|
|
|
|
|
WangSets are obtained from TileSetFile.wang_sets or
|
|
|
|
|
TileSetFile.wang_set().
|
|
|
|
|
They map abstract terrain types to concrete sprite indices using
|
|
|
|
|
Tiled\[cq]s Wang tile algorithm.
|
|
|
|
|
.PP
|
|
|
|
|
Properties: name (str, read-only): Wang set name.
|
|
|
|
|
type (str, read-only): `corner', `edge', or `mixed'.
|
|
|
|
|
color_count (int, read-only): Number of terrain colors.
|
|
|
|
|
colors (list, read-only): List of color dicts.
|
|
|
|
|
.PP
|
|
|
|
|
Example: ws = tileset.wang_set(`overworld') Terrain = ws.terrain_enum()
|
|
|
|
|
tiles = ws.resolve(discrete_map)
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Properties:\f[R] - \f[V]color_count\f[R] \f[I](read-only)\f[R]:
|
|
|
|
|
Number of terrain colors (int, read-only).
|
|
|
|
|
- \f[V]colors\f[R] \f[I](read-only)\f[R]: List of color dicts with name,
|
|
|
|
|
index, tile_id, probability (read-only).
|
|
|
|
|
- \f[V]name\f[R] \f[I](read-only)\f[R]: Wang set name (str, read-only).
|
|
|
|
|
- \f[V]type\f[R] \f[I](read-only)\f[R]: Wang set type: `corner', `edge',
|
|
|
|
|
or `mixed' (str, read-only).
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Methods:\f[R]
|
|
|
|
|
.SS \f[V]apply(discrete_map: DiscreteMap, tile_layer: TileLayer) -> None\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Resolve terrain and write tile indices directly into a TileLayer.
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Arguments:\f[R] - \f[V]discrete_map\f[R]: A DiscreteMap with
|
|
|
|
|
terrain IDs - \f[V]tile_layer\f[R]: Target TileLayer to write resolved
|
|
|
|
|
tiles into
|
|
|
|
|
.SS \f[V]resolve(discrete_map: DiscreteMap) -> list[int]\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Resolve terrain data to tile indices using Wang tile rules.
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Arguments:\f[R] - \f[V]discrete_map\f[R]: A DiscreteMap with
|
|
|
|
|
terrain IDs matching this WangSet\[cq]s colors
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Returns:\f[R] List of tile IDs (one per cell).
|
|
|
|
|
-1 means no matching Wang tile.
|
|
|
|
|
.SS \f[V]terrain_enum() -> IntEnum\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Generate a Python IntEnum from this WangSet\[cq]s terrain colors.
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Returns:\f[R] IntEnum class with NONE=0 and one member per color
|
|
|
|
|
(UPPER_SNAKE_CASE).
|
2025-10-30 21:20:50 -04:00
|
|
|
.SS Window
|
|
|
|
|
.PP
|
|
|
|
|
Window singleton for accessing and modifying the game window properties
|
|
|
|
|
.PP
|
2026-01-23 20:49:11 -05:00
|
|
|
\f[B]Properties:\f[R] - \f[V]framerate_limit\f[R]: Frame rate limit in
|
|
|
|
|
FPS (int, 0 for unlimited).
|
|
|
|
|
Caps maximum frame rate.
|
|
|
|
|
- \f[V]fullscreen\f[R]: Window fullscreen state (bool).
|
|
|
|
|
Setting this recreates the window.
|
|
|
|
|
- \f[V]game_resolution\f[R]: Fixed game resolution as (width, height)
|
|
|
|
|
tuple.
|
|
|
|
|
Enables resolution-independent rendering with scaling.
|
|
|
|
|
- \f[V]resolution\f[R]: Window resolution as (width, height) tuple.
|
|
|
|
|
Setting this recreates the window.
|
|
|
|
|
- \f[V]scaling_mode\f[R]: Viewport scaling mode (str): `center' (no
|
|
|
|
|
scaling), `stretch' (fill window), or `fit' (maintain aspect ratio).
|
|
|
|
|
- \f[V]title\f[R]: Window title string (str).
|
|
|
|
|
Displayed in the window title bar.
|
|
|
|
|
- \f[V]visible\f[R]: Window visibility state (bool).
|
|
|
|
|
Hidden windows still process events.
|
|
|
|
|
- \f[V]vsync\f[R]: Vertical sync enabled state (bool).
|
|
|
|
|
Prevents screen tearing but may limit framerate.
|
|
|
|
|
.PP
|
2025-10-30 21:20:50 -04:00
|
|
|
\f[B]Methods:\f[R]
|
|
|
|
|
.SS \f[V]center() -> None\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Center the window on the screen.
|
|
|
|
|
.PP
|
|
|
|
|
Note:
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Returns:\f[R] None Only works in windowed mode.
|
|
|
|
|
Has no effect when fullscreen or in headless mode.
|
|
|
|
|
.SS \f[V]get() -> Window\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Get the Window singleton instance.
|
|
|
|
|
.PP
|
|
|
|
|
Note:
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Returns:\f[R] Window: The global window object This is a class
|
|
|
|
|
method.
|
|
|
|
|
Call as Window.get().
|
|
|
|
|
There is only one window instance per application.
|
|
|
|
|
.SS \f[V]screenshot(filename: str = None) -> bytes | None\f[R]
|
|
|
|
|
.PP
|
|
|
|
|
Take a screenshot of the current window contents.
|
|
|
|
|
.PP
|
|
|
|
|
Note:
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Arguments:\f[R] - \f[V]filename\f[R]: Optional path to save
|
|
|
|
|
screenshot.
|
|
|
|
|
If omitted, returns raw RGBA bytes.
|
|
|
|
|
.PP
|
|
|
|
|
\f[B]Returns:\f[R] bytes | None: Raw RGBA pixel data if no filename
|
|
|
|
|
given, otherwise None after saving Screenshot is taken at the actual
|
|
|
|
|
window resolution.
|
|
|
|
|
Use after render loop update for current frame.
|
|
|
|
|
.SS Constants
|