added docstrings to every file and function. (with claude, checked it)
tower and game_play dont meet pylint check yet.
This commit is contained in:
@@ -1,23 +1,48 @@
|
||||
"""Base screen module - shared interface for all game screens."""
|
||||
|
||||
class BaseScreen:
|
||||
"""Abstract base class defining the interface for all game screens.
|
||||
|
||||
Subclasses override :meth:`process_event`, :meth:`update`, and :meth:`draw`
|
||||
to implement screen-specific behaviour. UI elements added to ``self.elements``
|
||||
are shown and hidden automatically when the screen is switched.
|
||||
|
||||
Attributes:
|
||||
game (Game): The central game instance.
|
||||
elements (list): pygame_gui elements managed by this screen.
|
||||
"""
|
||||
|
||||
def __init__(self, game):
|
||||
self.game = game
|
||||
|
||||
self.elements = []
|
||||
|
||||
def process_event(self, event):
|
||||
pass
|
||||
"""Handle a single pygame event.
|
||||
|
||||
Args:
|
||||
event (pygame.event.Event): The event to process.
|
||||
"""
|
||||
|
||||
def update(self, dt):
|
||||
pass
|
||||
"""Update screen state for the current frame.
|
||||
|
||||
Args:
|
||||
dt (float): Time elapsed since the last frame in seconds.
|
||||
"""
|
||||
|
||||
def draw(self, surface):
|
||||
pass
|
||||
"""Draw the screen onto the given surface.
|
||||
|
||||
Args:
|
||||
surface (pygame.Surface): Target surface to draw onto.
|
||||
"""
|
||||
|
||||
def show(self):
|
||||
"""Make all UI elements on this screen visible."""
|
||||
for element in self.elements:
|
||||
element.show()
|
||||
|
||||
def hide(self):
|
||||
"""Hide all UI elements on this screen."""
|
||||
for element in self.elements:
|
||||
element.hide()
|
||||
element.hide()
|
||||
|
||||
Reference in New Issue
Block a user