-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
53 lines (41 loc) · 1.24 KB
/
main.cpp
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
#include <QApplication>
#include <QMainWindow>
#include <QVBoxLayout>
#include <QString>
#include "Qt_cmake/mainwindow.h"
#include "classes/jeu.h"
#include "classes/joueur.h"
#include "Qt_cmake/qt_popup_info.h"
#include "Qt_cmake/qt_popup_yesno.h"
#include "main.h"
int main(int argc, char *argv[]) {
QApplication app(argc, argv);
InfoDialog info_dialog("Bienvenue dans le jeu Splendor Duel !");
info_dialog.exec();
popupYesNo yesno(nullptr, "Voulez vous commencer une nouvelle partie ou finir la dernière partie en cours (Oui/Non) ?");
yesno.exec();
char tmp = yesno.getUserChoice();
if(tmp == 'Y'){
gameFromScratch(argc, argv);
}
else {
gameFromJson(argc, argv);
}
Jeu::libereJeu();
char tmp2 = 'Y';
while(tmp2 == 'Y'){
popupYesNo relaunch(nullptr, "Voulez vous rejouer (Oui) ou fermer (non) ?");
relaunch.exec();
try{
tmp2 = relaunch.getUserChoice();
if(tmp2 == 'Y'){
gameFromScratch(argc, argv);
}
}catch (SplendorException &e){
cout<<e.getInfos()<<endl;
MainWindow::getMainWindow().triggerInfo(e.getInfos());
}
}
History::freeHistory();
return app.exec();
}