mirror of
https://github.com/kristoferssolo/Tetris.git
synced 2025-10-21 20:00:35 +00:00
refactor(game): Menu to Main
This commit is contained in:
parent
9c306df840
commit
9767d54424
2
main.py
2
main.py
@ -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__":
|
||||
|
||||
@ -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"]
|
||||
|
||||
@ -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)
|
||||
Loading…
Reference in New Issue
Block a user