Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

from enums import GameType
from game import SingleGame, CoopGame
from ui import show_menu
from ui import show_menu, show_splash
from config import SCREEN_WIDTH, SCREEN_HEIGHT

pygame.init()
Expand All @@ -13,13 +13,14 @@ def main():
"""Main function of this game"""

screen = pygame.display.set_mode((SCREEN_WIDTH, SCREEN_HEIGHT))

pygame.display.set_caption("Moje Střilečka")

show_splash(screen)

while True:
choice = show_menu(screen)

print("Choice", choice)
#print("Choice", choice)

if choice == GameType.SINGLE:
game = SingleGame(screen=screen)
Expand Down
24 changes: 24 additions & 0 deletions ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,27 @@ def show_menu(screen):

if event.key == pygame.K_ESCAPE:
return "quit"

def show_splash(screen):
"""Init splash screen"""

font = pygame.font.Font(None, 36)

# todo timer, aby se po par sekundach samo ukoncilo
while True:
screen.fill((0, 0, 0))

text = font.render("Our fancy game name", True, (255, 0, 0))
screen.blit(text, (50, 200))

text = font.render("press escape to continue", True, (255, 255, 255))
screen.blit(text, (50, 300))

pygame.display.flip()

for event in pygame.event.get():
if event.type == pygame.QUIT:
return

if event.type == pygame.KEYDOWN and event.key == pygame.K_ESCAPE:
return
Loading