Separated some functinos into different "front end" and "back end" sides
This commit is contained in:
@ -26,7 +26,13 @@ class Game:
|
|||||||
|
|
||||||
def update(self):
|
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
|
# Handle timeouts
|
||||||
@ -35,12 +41,24 @@ class Game:
|
|||||||
self.onEvent(timeout)
|
self.onEvent(timeout)
|
||||||
self._timeouts.remove(timeout)
|
self._timeouts.remove(timeout)
|
||||||
|
|
||||||
|
# Game update
|
||||||
|
self.update()
|
||||||
|
|
||||||
|
# TODO: Draw things like debug menu, etc.
|
||||||
|
|
||||||
def onEvent(self, event):
|
def onEvent(self, event):
|
||||||
"""
|
"""
|
||||||
Intended to be overridden by the game developer.
|
Intended to be overridden by the game developer.
|
||||||
See BaseGame for documentation.
|
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):
|
def close(self):
|
||||||
"""
|
"""
|
||||||
|
|||||||
Reference in New Issue
Block a user