fix: set_scene would not trigger "on_window_removed" event
This commit is contained in:
parent
d6a65f3548
commit
d66b8db655
1 changed files with 3 additions and 3 deletions
|
@ -22,7 +22,7 @@ class Window(pyglet.window.Window): # NOQA - pycharm think pyglet window is abs
|
||||||
self.keys = pyglet.window.key.KeyStateHandler()
|
self.keys = pyglet.window.key.KeyStateHandler()
|
||||||
self.push_handlers(self.keys)
|
self.push_handlers(self.keys)
|
||||||
|
|
||||||
#
|
# a dictionary linking a key pressed to the corresponding event function
|
||||||
self._on_key_held_events: dict[(int, int), Callable] = {}
|
self._on_key_held_events: dict[(int, int), Callable] = {}
|
||||||
|
|
||||||
# scene methods
|
# scene methods
|
||||||
|
@ -32,8 +32,8 @@ class Window(pyglet.window.Window): # NOQA - pycharm think pyglet window is abs
|
||||||
Set the scene of the window
|
Set the scene of the window
|
||||||
:param scene: the scene to set
|
:param scene: the scene to set
|
||||||
"""
|
"""
|
||||||
self._scenes = [scene]
|
self.clear_scene()
|
||||||
scene.on_window_added(self)
|
self.add_scene(scene)
|
||||||
|
|
||||||
def clear_scene(self) -> None:
|
def clear_scene(self) -> None:
|
||||||
"""
|
"""
|
||||||
|
|
Loading…
Reference in a new issue