-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmenu_settings.py
More file actions
31 lines (27 loc) · 1.05 KB
/
menu_settings.py
File metadata and controls
31 lines (27 loc) · 1.05 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
from settings import *
import pygame
class Settings_menu:
def __init__(self):
self.options = [
"Video Settings [Soon]",
"Audio Settings [Soon]",
"Back"
]
self.selected = 0
self.font = pygame.font.SysFont("Calibri", 30, bold = False)
self.selected_font = pygame.font.SysFont("Calibri", 60, bold = False)
def draw(self, surface):
for i in range(len(self.options)):
if i == self.selected:
text = self.selected_font.render(self.options[i], True, WHITE)
else:
text = self.font.render(self.options[i], True, GREY)
rect = text.get_rect(topleft = (surface.get_width() / 9, 50 + 70 * i))
surface.blit(text, rect)
def handle_event(self, event):
if event.type == pygame.KEYDOWN:
if event.key == pygame.K_DOWN:
self.selected += 1
if event.key == pygame.K_UP:
self.selected -= 1
self.selected = self.selected % len(self.options)