Create Python base class for UIDrawables, and derive Python UI types from it #71
Labels
No Label
Alpha Release Requirement
Bugfix
Demo Target
Documentation
Major Feature
Minor Feature
Refactoring & Cleanup
Tiny Feature
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: john/McRogueFace#71
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?
It just makes good sense to mirror the type hierarchy in both Python and C++.
if
.tp_base
of each UIDrawable type points to amcrfpy.Drawable
class, then I wouldn't have to do this:which is also fragile to new UIDrawable derived classes.
Probably the new base class should be
mcrfpy._Drawable
, an abstract base class which Python code can't derive from. But I can also define a separatemcrfpy.Drawable
class, which derives from the base class, CAN be subclassed, and has a C++ implementation (asUserDrawable
or something) to implement the interface by calling Python code.It would be a good opportunity to test the performance of using a Python rendering function... ...but Python doesn't have draw functions yet, so user render will have to wait.
An additional possibility is making UICollection derive from
mcrfpy._Drawable
, and allowing users to subclass that - they could define any__init__
they want, manage the collection internally withself.append
,self.remove
, etc. This would be a great way to keep all render functions in C++ while making it easier to encapsulate behavior requiring multiple UI widgets, like text boxes with captions, dialogue with a sprite that changes or moves, etc.