refactor(game): Menu to Main

This commit is contained in:
Kristofers Solo 2024-01-04 00:31:48 +02:00
parent 9c306df840
commit 9767d54424
3 changed files with 8 additions and 4 deletions

View File

@ -72,7 +72,7 @@ def main(args: argparse.ArgumentParser) -> None:
ai.log.debug("Training the AI")
else:
game.log.debug("Running the game")
game.Menu().run()
game.Main().run()
if __name__ == "__main__":

View File

@ -1,5 +1,6 @@
from .game import Game
from .log import log
from .menu import Menu
from .main import Main
from .score import Score
__all__ = ["log", "Menu", "Game"]
__all__ = ["log", "Main", "Game", "Score"]

View File

@ -4,9 +4,10 @@ import pygame
from utils import CONFIG
from .game import Game
from .score import Score
class Menu:
class Main:
def __init__(self) -> None:
pygame.init()
pygame.display.set_caption(CONFIG.window.title)
@ -14,6 +15,7 @@ class Menu:
self.clock = pygame.time.Clock()
self.game = Game()
self.score = Score()
def draw(self) -> None:
self.display_surface.fill(CONFIG.colors.bg)
@ -25,6 +27,7 @@ class Menu:
self.handle_events()
self.game.run()
self.score.run()
pygame.display.update()
self.clock.tick(CONFIG.fps)