diff --git a/src/gameUtils/base.py b/src/gameUtils/base.py index 3ead71f..db42aaf 100644 --- a/src/gameUtils/base.py +++ b/src/gameUtils/base.py @@ -26,7 +26,13 @@ class Game: def update(self): """ - Updates some core things in the background. + Intended to be overridden by the game developer. + See BaseGame for documentation. + """ + + def _update(self): + """ + Updates some core things in the background, and calls update() """ # Handle timeouts @@ -35,12 +41,24 @@ class Game: self.onEvent(timeout) self._timeouts.remove(timeout) + # Game update + self.update() + + # TODO: Draw things like debug menu, etc. + def onEvent(self, event): """ Intended to be overridden by the game developer. See BaseGame for documentation. """ + def _onEvent(self, event): + """ + Updates some core things in the background, and calls onEvent() + """ + + if not self._haltEvents: + self.onEvent(event) def close(self): """