sep-pm-platformer/project/level/selection/ScreenManager.py

31 lines
931 B
Python
Raw Permalink Normal View History

from abc import abstractmethod
from physics.SpriteManager import SpriteManager
2023-03-29 13:50:48 +02:00
from physics.TickData import TickData
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)
2023-03-29 13:50:48 +02:00
def tick(self, tick_data: TickData):
pass