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:
parent
1d11b020b0
commit
a77ac6c501
14 changed files with 1003 additions and 25 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue