Monkey Patch support + Robust callback tracking

McRogueFace needs to accept callable objects (properties on C++ objects)
and also support subclassing (getattr on user objects). Only direct
properties were supported previously, now shadowing a callback by name
will allow custom objects to "just work".
- Added CallbackCache struct and is_python_subclass flag to UIDrawable.h
- Created metaclass for tracking class-level callback changes
- Updated all UI type init functions to detect subclasses
- Modified PyScene.cpp event dispatch to try subclass methods
This commit is contained in:
John McCardle 2026-01-09 21:37:23 -05:00
commit a77ac6c501
14 changed files with 1003 additions and 25 deletions

View file

@ -153,8 +153,8 @@ def test_scene_subclass():
self.exit_count += 1
print(f" GameScene.on_exit() called (count: {self.exit_count})")
def on_keypress(self, key, action):
print(f" GameScene.on_keypress({key}, {action})")
def on_key(self, key, action):
print(f" GameScene.on_key({key}, {action})")
def update(self, dt):
self.update_count += 1