-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
67 lines (54 loc) · 1.75 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
66
67
#include <SFML/Audio.hpp>
#include <vector>
#include "GlobalVariables.h"
#include "ScreenIncluder.h"
#include "MusicManager.h"
#include "SoundManager.h"
#include <iostream>
int main() {
MusicManager* musicManager = MusicManager::getInstance();
musicManager->play();
// Create the main window
sf::VideoMode desktopMode = sf::VideoMode::getDesktopMode();
sf::RenderWindow app(
sf::VideoMode(
desktopMode.width,
desktopMode.height,
desktopMode.bitsPerPixel),
"Skydda",
sf::Style::Fullscreen
);
app.setFramerateLimit(GlobalVariables::FPS);
std::vector<Screen*> screens;
int screen = 0;
/// Screens preparations
MenuScreen menuScreen; // 0
screens.push_back(&menuScreen);
PrematchScreen prematchScreen; // 1
screens.push_back(&prematchScreen);
OptionScreen optionScreen; // 2
screens.push_back(&optionScreen);
std::vector<std::string> data;
//Main loop
while (screen >= 0) {
data.clear();
GameScreenRound gameScreenRound; // 3
screens.push_back(&gameScreenRound);
GameScreenTimer gameScreenTimer; // 4
screens.push_back(&gameScreenTimer);
if(screen == 3 || screen == 4) {
data.push_back(prematchScreen.strFirstPlayerName);
data.push_back(prematchScreen.pathSpriteFirstPlayer);
data.push_back(prematchScreen.strSecondPlayerName);
data.push_back(prematchScreen.pathSpriteSecondPlayer);
screen = screens[screen]->run(app, data, prematchScreen.map_);
}
else {
screen = screens[screen]->run(app, data, 0);
}
screens.erase(screens.end()-1);
screens.erase(screens.end()-1);
}
delete musicManager;
return EXIT_SUCCESS;
}