33 lines
1.0 KiB
Python
33 lines
1.0 KiB
Python
import pygame
|
|
from tetris.util import ConfigurationManager
|
|
from tetris.util import TextGenerator
|
|
from tetris.util import Controller
|
|
|
|
"""
|
|
TODO
|
|
"""
|
|
class TitleScene:
|
|
|
|
# Title screen options
|
|
ONE_PLAYER = "ONE_PLAYER"
|
|
TWO_PLAYER = "TWO_PLAYER"
|
|
|
|
def __init__(self) -> None:
|
|
image_path = ConfigurationManager.get("image", "title-screen")
|
|
|
|
self.splash_image = pygame.image.load(image_path)
|
|
self.cursor_position = None
|
|
self.cursor_flash_timer = 0
|
|
|
|
def draw(self, screen) -> None:
|
|
screen.fill(pygame.Color(ConfigurationManager.get("color", "window-bg")))
|
|
screen.blit(self.splash_image, (300, 0))
|
|
|
|
TextGenerator.draw("1 PLAYER", (300, 400), screen)
|
|
TextGenerator.draw("2 PLAYER", (300, 450), screen)
|
|
|
|
def update(self) -> None:
|
|
if Controller.key_pressed(pygame.K_DOWN):
|
|
self.current_option = TitleScene.ONE_PLAYER
|
|
if Controller.key_pressed(pygame.K_UP):
|
|
self.current_option = TitleScene.TWO_PLAYER |