"""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): """Handle a single pygame event. Args: event (pygame.event.Event): The event to process. """ def update(self, dt): """Update screen state for the current frame. Args: dt (float): Time elapsed since the last frame in seconds. """ def draw(self, surface): """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()