-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathInterface.py
More file actions
59 lines (50 loc) · 1.71 KB
/
Interface.py
File metadata and controls
59 lines (50 loc) · 1.71 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
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
import pygame
from pygame.constants import K_ESCAPE, KEYDOWN, MOUSEBUTTONDOWN, MOUSEBUTTONUP
from assets.classes.eductrigaming import *
from assets.classes.maintenance import Reglages
from assets.classes.menu import Menu
pygame.init()
pygame.display.set_caption("Educ'Tri G@ming")
resolution = [1024, 600]
fenetre = pygame.display.set_mode(resolution)
click = False
jeu = Jeu()
reglages = Reglages()
menu = Menu(jeu, reglages)
running = True
while running:
#inputs
for event in pygame.event.get():
if event.type == pygame.QUIT:
running = False
pygame.quit()
if event.type == KEYDOWN:
if event.key == K_ESCAPE:
running = False
pygame.quit()
if event.type == MOUSEBUTTONDOWN:
if event.button == 1: #1 => gauche | 2 => molette | 3 => droit
if menu.lanced:
menu.click = True
if jeu.lanced:
jeu.click = True
if reglages.lanced:
reglages.click = True
if event.type == MOUSEBUTTONUP:
if event.button == 1:
if menu.lanced:
menu.click = False
if jeu.lanced:
jeu.click = False
if reglages.lanced:
reglages.click = False
if jeu.lanced:
jeu.update(fenetre)
else: #à enlever quand il y aura un screen de fin de game
menu.lanced = True
if menu.lanced:
menu.update(fenetre)
if reglages.lanced:
reglages.update(fenetre)
#maj de la fenetre (.update() fait la meme chose si pas d'argument)
pygame.display.flip()