from abc import abstractmethod from physics.SpriteManager import SpriteManager from sprite.SpritesheetManager import SpritesheetManager from ui_elements.UiElement import UiElement class ScreenManager: def __init__(self, sprite_manager: SpriteManager, spritesheet_manager: SpritesheetManager, main_loop): self.sprite_manager = sprite_manager self.spritesheet_manager = spritesheet_manager self.main_loop = main_loop self.elements: list[UiElement] = [] def add_element(self, layer: str, ui_element: UiElement): self.elements.append(ui_element) self.sprite_manager.add_ui_element(layer, ui_element) @abstractmethod def initialize(self): pass def destroy(self): for element in self.elements: self.sprite_manager.remove_ui_element(element)