Add UIDrawable children collection to Grid #132
Labels
No Label
Alpha Release Requirement
Bugfix
Demo Target
Documentation
Major Feature
Minor Feature
priority:tier1-active
priority:tier2-foundation
priority:tier3-future
Refactoring & Cleanup
system:animation
system:documentation
system:grid
system:input
system:performance
system:python-binding
system:rendering
system:ui-hierarchy
Tiny Feature
workflow:blocked
workflow:needs-benchmark
workflow:needs-documentation
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
No due date set.
Blocks
#128 Line and Arc drawing primitives for path visualization
john/McRogueFace
#129 Circle drawing primitives for range visualization
john/McRogueFace
Reference: john/McRogueFace#132
Loading…
Reference in New Issue
No description provided.
Delete Branch "%!s(<nil>)"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Feature Request
Allow Grid to contain arbitrary UIDrawable children (speech bubbles, effects, highlights, etc.) that automatically transform with the grid's camera (pan/zoom), just like Frame contains children.
Use Cases
Problem Statement
Currently, Grid can only render:
UIGridPoint)entitiescollection)To add visual elements like speech bubbles, you must:
This violates the "fail early" principle - developers will introduce coordinate bugs.
Proposed Solution
Add a
childrencollection to Grid, following the pattern established by Frame:Design Decisions
Coordinate Space: Children positioned in grid-world pixels (not cells)
child.position = (160, 96)= 160 pixels right in grid-world spaceRender Order:
Children render after entities but before FOV, so they get dimmed in unexplored areas (correct for roguelike).
Culling: Same pattern as entities
Implementation Pattern
Based on Frame's existing children pattern (UIFrame.cpp:162-164) and Grid's entity rendering (UIGrid.cpp:198-203):
Benefits (Abstraction Criteria Met)
✅ Eliminates bugs: No manual coordinate updates when camera changes
✅ Makes common case trivial:
✅ Aligns with domain: Grid-world coordinates match roguelike mental model
Technical Details
No hidden nightmares found:
Performance: Negligible impact
Optional Helper API
For convenience when working in cell coordinates:
Definition of Done
UIGridhasstd::shared_ptr<std::vector<std::shared_ptr<UIDrawable>>> childrenmembergrid.childrenreturns UICollectionRelated Issues
Labels
[Major Feature][priority:tier2-foundation][system:grid][system:ui-hierarchy]Implementation Complete
Commit
4d6808eimplements Grid.children collection with all requested features:Features Implemented
childrenmember (std::shared_ptr<std::vector<std::shared_ptr<UIDrawable>>>)grid.childrenreturns UICollectionUsage Example
Children automatically pan/zoom with the grid camera - no manual coordinate updates needed.
Test
Added
tests/test_grid_children.pywith comprehensive tests for all features.closed by
4d6808e34d