-
Notifications
You must be signed in to change notification settings - Fork 1
/
main_menu.py
91 lines (68 loc) · 2.58 KB
/
main_menu.py
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
# External
from random import sample # for testing
# pygame
import pygame
import pygame.freetype
from pygame.locals import (
RLEACCEL,
MOUSEBUTTONDOWN,
QUIT
)
# literature
from literature.view.global_constants import *
from literature.view.my_text_input import Text_box
from literature.game.people import Player, Team
from literature.game.literature import Literature # should fix this naming
# Initialize pygame
pygame.init()
#--------------------------------------------------------------------------------
# Sign in menu
# set up the drawing window
screen = pygame.display.set_mode([SCREEN_WIDTH, SCREEN_HEIGHT])
# Fill the background with black
screen.fill((0, 0, 0))
# Add the table as the background
table = pygame.image.load("literature/images/table/table.png").convert()
table.set_colorkey((255, 255, 255), RLEACCEL)
table = pygame.transform.scale(table, (SCREEN_WIDTH, SCREEN_HEIGHT))
screen.blit(table, (0,0))
#--------------------------------------------------------------------------------
# Add the title
# Make font
MENU_FONT = pygame.freetype.Font("literature/images/fonts/Confetti_Stream.ttf", 175)
# create a text suface object, center the rect
title, title_rect = MENU_FONT.render("Literature", (225,225,225))
title_rect.center = (SCREEN_WIDTH / 2, SCREEN_HEIGHT / 4 )
screen.blit(title, title_rect)
#--------------------------------------------------------------------------------
# Add input getter
# Create TextInput objects from team name and player name
#name_input = Text_box(box_size = (200, 35), box_color = (0,0,0), text_color=(225,225,225), cursor_color=(225,225,225), max_string_length=14)
#
## Blit the text surface to the screen
#name_input.rect.center = (SCREEN_WIDTH / 2, SCREEN_HEIGHT / 2)
#screen.blit(name_input.surface, name_input.rect)
#
#clock = pygame.time.Clock()
# flip the display
pygame.display.flip()
running = True
while running:
events = pygame.event.get()
#name_input.update(events)
for event in events:
if event.type == pygame.QUIT:
running = False
#screen.blit(name_input.surface, ( (SCREEN_WIDTH - name_input.rect.width) / 2, (SCREEN_HEIGHT - name_input.rect.height) / 2))
# if name_input.update(events):
# username = name_input.get_text()
# name_input.clear_text()
# else:
# # Blit the text surface to the screen
# screen.blit(name_input_surface, (name_input_rect.left, name_input_rect.top))
#--------------------------------------------------------------------------------
# Flip the display
pygame.display.flip()
#clock.tick(30)
# Done! Time to quit.
pygame.quit()