-
Notifications
You must be signed in to change notification settings - Fork 7
/
main.cpp
65 lines (58 loc) · 1.97 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
54
55
56
57
58
59
60
61
62
63
64
65
/******************************************************************************
* @file main.cpp
* @author Andrés Gavín Murillo, 716358
* @author Rubén Rodríguez Esteban, 737215
* @date Mayo 2020
* @coms Videojuegos - OutRun
******************************************************************************/
#include <SFML/Graphics.hpp>
#include "Menu.hpp"
#include "Game.hpp"
using namespace sf;
using namespace std;
int main() {
Config c;
State state = ANIMATION;
while (c.window.isOpen() && state != EXIT) {
Game engine(c);
sleep(milliseconds(500));
if (state == START)
state = startMenu(c);
while (c.window.isOpen() && state != START) {
switch (state) {
case ANIMATION: {
state = introAnimation(c);
break;
}
case MUSIC: {
sleep(milliseconds(500));
state = selectMusicSoundtrack(c);
break;
}
case OPTIONS: {
sleep(milliseconds(500));
bool inGame = engine.isInGame();
state = optionsMenu(c, inGame);
engine.checkDifficulty(c);
break;
}
case GAME: {
state = engine.play(c);
break;
}
case RANKING: {
unsigned long scorePlayer = engine.getScore();
int minutes = int(engine.getMinutesTrip());
int secs = int(engine.getSecsTrip());
int cents_Second = int(engine.getCents_SecondTrip());
state = rankingMenu(c, scorePlayer, minutes, secs, cents_Second);
break;
}
default: {
c.window.close();
break;
}
}
}
}
}