From 8893fd90c647df9968dcce7c7823079e5f7b20cc Mon Sep 17 00:00:00 2001 From: Brosef Date: Tue, 24 Jun 2025 06:06:21 +0100 Subject: [PATCH] Separated some functinos into different "front end" and "back end" sides --- src/gameUtils/base.py | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) 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): """