Linted code, added documentation

This commit is contained in:
2025-06-24 06:04:20 +01:00
parent a9d95c65cb
commit 9d6f775ab9

View File

@ -1,9 +1,11 @@
from .events import Timeout
from .anim import AnimatedObject
import NoPELib
import tomllib
import time
import NoPELib
from .events import Timeout
from .anim import AnimatedObject
class Game:
def __init__(self, surface):
"""
@ -27,16 +29,24 @@ class Game:
Updates some core things in the background.
"""
# Handle timeouts
for timeout in self._timeouts.copy():
if timeout.fireOn <= time.perf_counter():
self.onEvent(timeout)
self._timeouts.remove(timeout)
def onEvent(self, event):
pass
"""
Intended to be overridden by the game developer.
See BaseGame for documentation.
"""
def close(self):
pass
"""
Intended to be overridden by the game developer.
See BaseGame for documentation.
"""
def createAnimObj(self, *args, **kwargs):
"""
@ -62,12 +72,12 @@ class Game:
self._timeouts.append(Timeout(id, time.perf_counter()+delay))
def awaitingTimeout(self, id: str):
def awaitingTimeout(self, timeoutID: str):
"""
Tells you if a timeout ID is on the timeout stack.
Args:
id (str): The timeout ID.
timeoutID (str): The timeout ID.
Returns:
bool: True if there is a timeout with that ID