-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
65 lines (52 loc) · 1.67 KB
/
Copy pathmain.py
File metadata and controls
65 lines (52 loc) · 1.67 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
59
60
61
62
63
64
65
import pygame
import sys
# Importation correcte des modules
from screens.menu import run_menu
from screens.input_form import run_input_form
from screens.theme_select import run_theme_selection
from screens.difficulty_select import run_difficulty_selection
from game import run_quiz
from screens.result import show_result # Renommé pour éviter le conflit avec run_menu
# Initialisation de Pygame
pygame.init()
pygame.font.init()
# Définition de la fenêtre principale
SCREEN_WIDTH, SCREEN_HEIGHT = 800, 600
screen = pygame.display.set_mode((SCREEN_WIDTH, SCREEN_HEIGHT))
pygame.display.set_caption("Jeu de Quiz")
# Couleur de fond
BACKGROUND_COLOR = (30, 30, 30)
# Boucle principale
def main():
# 1. Formulaire pour entrer le nom et le prénom
user_info = run_input_form(screen)
if not user_info:
pygame.quit()
sys.exit()
# 2. Menu Jouer / Quitter
choice = run_menu(screen)
if choice != "Jouer": # Vérification de la valeur retournée
pygame.quit()
sys.exit()
# 3. Sélection du thème
theme = run_theme_selection(screen)
if not theme:
pygame.quit()
sys.exit()
user_info['theme'] = theme # Ajout
# 4. Sélection de la difficulté
difficulty = run_difficulty_selection(screen)
if not difficulty:
pygame.quit()
sys.exit()
user_info['difficulty'] = difficulty # Ajout
# 5. Lancer le quiz
score = run_quiz(screen, theme, difficulty)
total_questions = 10 # Nombre fixe de questions dans le quiz
# 6. Afficher le résultat
show_result(screen, user_info, score, total_questions)
# Fin
pygame.quit()
sys.exit()
if __name__ == "__main__":
main()