-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathloading_screen.py
More file actions
33 lines (31 loc) · 1.41 KB
/
loading_screen.py
File metadata and controls
33 lines (31 loc) · 1.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import pygame
from constants import *
def loading_screen(bg):
title_font = pygame.font.Font(FONT_PATH, TITLE_FONT_SIZE)
subtitle_font = pygame.font.Font(FONT_PATH, HUD_FONT_SIZE)
desktop_size = pygame.display.get_desktop_sizes()[0]
w, h = desktop_size
screen = pygame.display.get_surface()
surf = pygame.Surface(desktop_size)
bg_final = pygame.transform.scale(bg, desktop_size)
surf.blit(bg_final, (0, 0))
lines = [
title_font.render("BLOCKADE", True, "white", "black"),
title_font.render("", True, "white", "black"),
subtitle_font.render("<version {}>".format(VERSION), True, "white", "black"),
title_font.render("", True, "white", "black"),
title_font.render("", True, "white", "black"),
subtitle_font.render("~-~-~-~-~-~-~-___SECTOR 34 GAMES___~-~-~-~-~-~-~-", True, "white", "black"),
subtitle_font.render("...loading...".format(VERSION), True, "white", "black"),
subtitle_font.render("~-~-~-~-<roguelike + subsim = awesome>~-~-~-~-~-~", True, "white", "black"),
]
y = h // 2 - ((len(lines) - 1) * lines[1].get_height() + lines[0].get_height()) // 2
for line in lines:
x = w // 2 - line.get_width() // 2
surf.blit(line, (x, y))
if line is lines[0]:
y += lines[0].get_height()
else:
y += lines[1].get_height()
screen.blit(surf, (0, 0))
pygame.display.flip()