-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmenu.c
87 lines (71 loc) · 1.44 KB
/
menu.c
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
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "menu.h"
#include "affichage.h"
#include "sauvegarde.h"
void liste_options(void)
{
char** options = malloc(sizeof(char*) * 5);
for (int i=0;i<5;i++) {
options[i] = malloc(sizeof(char) * 25);
}
strcpy(options[0],"lancer simulation");
strcpy(options[1],"reprendre simulation");
strcpy(options[2],"sauvegarder la simulation");
strcpy(options[3],"charger une sauvegarde");
strcpy(options[4],"quitter le programme");
strcpy(options[5],"retour menu principal");
}
int nombre_options(void)
{
return 5;
}
int menu(int choix)
{
switch(choix)
{
case 1:
return lancer_simulation();
case 4:
return charger();
case 5:
quitter();
break;
}
return 0;
}
int mini_menu(int choix, ElementAstre *ptElementAstreInitial, time_t t)
{
switch(choix)
{
case 2:
return reprendre();
case 3:
sauvegarde(ptElementAstreInitial, t);
break;
case 6:
return retour();
}
return 0;
}
StateAffichage lancer_simulation(){
return Simulation;
}
StateAffichage reprendre() {
return Simulation;
}
void sauvegarde(ElementAstre *ptElementAstreInitial, time_t t){
printf("sauvegarde\n");
nomdesauvegarde(ptElementAstreInitial, t);
}
StateAffichage charger() {
return MenuSauvegardes;
}
void quitter() {
termineBoucleEvenements();
printf("Quitter le programme...");
}
StateAffichage retour(){
return MenuPrincipal;
}