closes#72
ref #69 - this resolves the "UICollection" (not "UIEntityCollection", perhaps renamed since the issue opened) and "UIEntityCollection" portion. The Grid point based iterators were not updated.
**RPATH updates**
Will this RPATH setting allow McRogueFace to execute using its included "lib" subdirectory after being unzipped on a new computer?
The change from "./lib" to "$ORIGIN/./lib" improves portability. The $ORIGIN token is a special Linux/Unix convention that refers to the directory containing the executable itself. This makes the path relative to the executable's location rather than the current working directory, which means McRogueFace will correctly find its libraries in the lib subdirectory regardless of where it's run from after being unzipped on a new computer.
**New standard object initialization**
PyColor, PyVector
- Fixed all 15 PyTypeObject definitions to use proper designated initializer syntax
- Replaced PyType_GenericAlloc usage in PyColor.cpp and PyVector.cpp
- Updated PyObject_New usage in UIEntity.cpp
- All object creation now uses module-based type lookups instead of static references
- Created centralized utilities in PyObjectUtils.h
**RAII Wrappers**
automatic reference counting via C++ object lifecycle
- Created PyRAII.h with PyObjectRef and PyTypeRef classes
- These provide automatic reference counting management
- Updated PyColor::from_arg() to demonstrate RAII usage
- Prevents memory leaks and reference counting errors
**Python object base in type defs:**
`.ob_base = {.ob_base = {.ob_refcnt = 1, .ob_type = NULL}, .ob_size = 0}`
PyColor, PyTexture, PyVector, UICaption, UICollection, UIEntity, UIFrame, UIGrid
**convertDrawableToPython**
replace crazy macro to detect the correct Python type of a UIDrawable instance
- Removed the problematic macro from UIDrawable.h
- Created template-based functions in PyObjectUtils.h
- Updated UICollection.cpp to use local helper function
- The new approach is cleaner, more debuggable, and avoids static type references
**Iterator fixes**
tp_iter on UICollection, UIGrid, UIGridPoint, UISprite
UIGrid logic improved, standard
**List vs Vector usage analysis**
there are different use cases that weren't standardized:
- UICollection (for Frame children) uses std::vector<std::shared_ptr<UIDrawable>>
- UIEntityCollection (for Grid entities) uses std::list<std::shared_ptr<UIEntity>>
The rationale is currently connected to frequency of expected changes.
* A "UICollection" is likely either all visible or not; it's also likely to be created once and have a static set of contents. They should be contiguous in memory in hopes that this helps rendering speed.
* A "UIEntityCollection" is expected to be rendered as a subset within the visible rectangle of the UIGrid. Scrolling the grid or gameplay logic is likely to frequently create and destroy entities. In general I expect Entity collections to have a much higher common size than UICollections. For these reasons I've made them Lists in hopes that they never have to be reallocated or moved during a frame.
This squash commit includes changes from April 21st through 28th, 2024, and the past 3 days of work at 7DRL.
Rather than resume my feature branch work, I made minor changes to safe the C++ functionality and wrote workarounds in Python.
I'm very likely to delete this commit from history by rolling master back to the previous commit, and squash merging a finished feature branch.
Closes#43
No segfault found in cos_play after completing the checklist. Maybe I accidentally fixed it...?
commit 6aa151aba3
Author: John McCardle <mccardle.john@gmail.com>
Date: Fri Apr 19 21:43:58 2024 -0400
UISprite.h/.cpp cleanup
commit ec0374ef50
Author: John McCardle <mccardle.john@gmail.com>
Date: Fri Apr 19 21:37:39 2024 -0400
UIGridPoint.h/.cpp reorganization
commit 2cb7339535
Author: John McCardle <mccardle.john@gmail.com>
Date: Fri Apr 19 21:19:25 2024 -0400
UIGrid.h/.cpp cleanup. I have reservations about the UIEntityCollection[Iter] classes + methods living there, but not enough to fix it right now.
commit 5d6af324bf
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Apr 18 22:14:57 2024 -0400
UIFrame - moving static method into class namespace; no type object access
commit 567218cd7b
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Apr 18 21:23:49 2024 -0400
UIEntity fixes for the UI.h split: There are segfaults in cos_play, I may have missed a type usage or something
commit 76693acd28
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Apr 13 00:18:37 2024 -0400
delete leftover comments
commit 9efe998a33
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Apr 13 00:17:43 2024 -0400
some work on UICaption and UICollection; fixing segfaults resulting from mcrfpydef namepace TypeObject usage
commit 714965da45
Author: John McCardle <mccardle.john@gmail.com>
Date: Fri Apr 12 14:15:00 2024 -0400
eliminate extra includes on UICaption
commit 8efa25878f
Author: John McCardle <mccardle.john@gmail.com>
Date: Wed Apr 10 23:41:14 2024 -0400
remove a lot of stuff
commit c186d8c7f3
Author: John McCardle <mccardle.john@gmail.com>
Date: Wed Apr 10 23:10:15 2024 -0400
We are compiling again! Started refactoring UICaption to be more idiomatic
commit 1b6e2a709b
Author: John McCardle <mccardle.john@gmail.com>
Date: Tue Apr 9 22:42:02 2024 -0400
Still not quite compiling; as predicted, a lot of interdependency and definition order bugs to untangle
commit aa7553a818
Author: John McCardle <mccardle.john@gmail.com>
Date: Tue Apr 9 22:41:20 2024 -0400
PyTexture clean up scribbles and experiments
commit c0201d989a
Author: John McCardle <mccardle.john@gmail.com>
Date: Mon Apr 8 22:55:00 2024 -0400
additional unsaved changes
commit 83a63a3093
Author: John McCardle <mccardle.john@gmail.com>
Date: Mon Apr 8 22:45:00 2024 -0400
doesn't compile, but UI.h/.cpp code has been divvy'd up.
refs #43 @2h