-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
55 lines (40 loc) · 1.39 KB
/
main.cpp
File metadata and controls
55 lines (40 loc) · 1.39 KB
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
#include "SFML/Graphics.hpp"
#include <memory>
#include <iostream>
#include "scene.h"
#include "menuScene.h"
#include "mainScene.h"
using namespace std::string_literals;
int main()
{
// настраиваем окно для рендеринга
sf::VideoMode defailtVideoMode = sf::VideoMode({ 1280, 900 });
std::unique_ptr<sf::RenderWindow> window = std::make_unique<sf::RenderWindow>(defailtVideoMode, "Logic Classic"s, sf::Style::Default);
window->setFramerateLimit(60);
window->setVerticalSyncEnabled(true);
int difficult = 1;
gamecore::ExitSceneCode exitCode = gamecore::ExitSceneCode::NewScene;
while (exitCode != gamecore::ExitSceneCode::CloseWindow) {
if (exitCode == gamecore::ExitSceneCode::NewScene) {
// запускаем сцену с меню
{
std::unique_ptr<gamecore::MenuScene> menuScena = std::make_unique<gamecore::MenuScene>(window.get());
menuScena->Initialization();
menuScena->MainLoop();
if (menuScena->GetExitCode() == gamecore::ExitSceneCode::CloseWindow)
{
return 0;
}
difficult = (int)menuScena->GetDifficulty();
}
}
// запускаем главную сцену
{
std::unique_ptr<gamecore::MainScene> mainScene = std::make_unique<gamecore::MainScene>(b2Vec2{ 0.f, 9.8f }, window.get());
mainScene->InitMainWorld(difficult);
mainScene->MainLoop();
exitCode = mainScene->GetExitCode();
}
}
return 0;
}