wip!: add scenes to the game
This commit is contained in:
33
tetris/scene.py
Normal file
33
tetris/scene.py
Normal file
@@ -0,0 +1,33 @@
|
||||
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
|
||||
Reference in New Issue
Block a user