Parent-Child UI System (#122): - Add parent weak_ptr to UIDrawable for hierarchy tracking - Add setParent(), getParent(), removeFromParent() methods - UICollection now tracks owner and sets parent on append/insert - Auto-remove from old parent when adding to new collection Global Position Property (#102): - Add get_global_position() that walks up parent chain - Expose as read-only 'global_position' property on all UI types - Add UIDRAWABLE_PARENT_GETSETTERS macro for consistent bindings Dirty Flag System (#116): - Modify markDirty() to propagate up the parent chain - Add isDirty() and clearDirty() methods for render optimization Scene as Drawable (#118): - Add position, visible, opacity properties to Scene - Add setProperty()/getProperty() for animation support - Apply scene transformations in PyScene::render() - Fix lifecycle callbacks to clear errors when methods don't exist - Add GameEngine::getScene() public accessor 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
bfadab7486
commit
e3d8f54d46
19 changed files with 988 additions and 67 deletions
14
src/UIBase.h
14
src/UIBase.h
|
|
@ -162,4 +162,18 @@ static int UIDrawable_set_opacity(T* self, PyObject* value, void* closure)
|
|||
"Automatically clamped to valid range [0.0, 1.0]." \
|
||||
), NULL}
|
||||
|
||||
// #122 & #102: Macro for parent/global_position properties (requires closure with type enum)
|
||||
// These need the PyObjectsEnum value in closure, so they're added separately in each class
|
||||
#define UIDRAWABLE_PARENT_GETSETTERS(type_enum) \
|
||||
{"parent", (getter)UIDrawable::get_parent, NULL, \
|
||||
MCRF_PROPERTY(parent, \
|
||||
"Parent drawable (read-only). " \
|
||||
"Returns the parent Frame/Grid if nested, or None if at scene level." \
|
||||
), (void*)type_enum}, \
|
||||
{"global_position", (getter)UIDrawable::get_global_pos, NULL, \
|
||||
MCRF_PROPERTY(global_position, \
|
||||
"Global screen position (read-only). " \
|
||||
"Calculates absolute position by walking up the parent chain." \
|
||||
), (void*)type_enum}
|
||||
|
||||
// UIEntity specializations are defined in UIEntity.cpp after UIEntity class is complete
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue