-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cpp
executable file
·46 lines (37 loc) · 1.19 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
#include <iostream>
#include <SFML/Graphics.hpp>
using namespace std;
#include "scenes/Scenes.h"
int main()
{
std::vector<Scene*> screens;
int screen = 0;
//Window creation
auto videoMode = sf::VideoMode::getFullscreenModes()[0];
sf::RenderWindow App(videoMode, "Game", sf::Style::Fullscreen);
App.setFramerateLimit(60);
//Mouse cursor no more visible
//App.setMouseCursorVisible(false);
//Screens preparations
MenuScene* menuScene = new MenuScene;
screens.push_back(menuScene);
GameScene* gameLoop = new GameScene(App);
screens.push_back(gameLoop);
TheEndScene* endScene = new TheEndScene;
screens.push_back(endScene);
//Main loop
// if returns 0 - menuScene, if 1 - GameScene if 2 ..
while (screen >= 0)
{
screen = screens[screen]->Run(App);
if(screen == 2) {
Scene *tmp = screens[1];
screens[screen]->result = screens[1]->getResult();
screens[1] = new GameScene(App);
delete (tmp);
menuScene->reset();
}
}
while(!screens.empty()) delete screens.back(), screens.pop_back();
return EXIT_SUCCESS;
}