-
Notifications
You must be signed in to change notification settings - Fork 0
/
menu.py
36 lines (27 loc) · 863 Bytes
/
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
import pygame
from Button import Button
from scene import Scene
class Menu:
def play(self):
self.dir.scene = Scene(self.dir)
def quitt(self):
self.dir.running = False
def __init__(self, director):
from resources import Textures, Fonts
self.dir = director
self.play_button = Button(Textures["play"], (432, 465), self.play)
self.exit_button = Button(Textures["exit"], (1488-315, 500), self.quitt)
self.background = Textures["menu"]
def event(self):
pass
def update(self, delta_time):
for event in pygame.event.get():
if event.type == pygame.MOUSEBUTTONUP:
mx = pygame.mouse.get_pos()
self.play_button.isClicked(mx)
self.exit_button.isClicked(mx)
def draw(self):
self.dir.screen.blit(self.background, (0,0))
self.play_button.draw(self.dir.screen)
self.exit_button.draw(self.dir.screen)
pygame.display.update()