-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
68 lines (57 loc) · 1.66 KB
/
main.cpp
File metadata and controls
68 lines (57 loc) · 1.66 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
56
57
58
59
60
61
62
63
64
65
66
67
68
#include "Core/App/Application.h"
#include "Core/App/FatalErrorReport.h"
#include <Windows.h>
#include <exception>
#include "Game/Katamari/KatamariGame.h"
#include "Game/LightingTest/LightingTestGame.h"
#include "Game/Pong/PongGame.h"
#include "Game/SolarSystem/SolarSystemGame.h"
enum class DemoType
{
Pong,
SolarSystem,
Katamari,
LightingTest
};
int main()
{
try
{
HINSTANCE__ *const hInstance = GetModuleHandleW(nullptr);
constexpr auto demo = DemoType::Katamari;
std::unique_ptr<IGame> game;
switch (demo)
{
case DemoType::Pong:
game = std::make_unique<PongGame>();
break;
case DemoType::SolarSystem:
game = std::make_unique<SolarSystemGame>();
break;
case DemoType::Katamari:
game = std::make_unique<KatamariGame>();
break;
case DemoType::LightingTest:
game = std::make_unique<LightingTestGame>();
break;
}
ApplicationDesc applicationDescription{};
if (demo == DemoType::Katamari)
{
applicationDescription.ClearColor = Color(0.015f, 0.03f, 0.08f, 1.0f);
}
Application app(hInstance, std::move(game), applicationDescription);
return app.Run();
}
catch (const std::exception &exception)
{
const std::string message = std::string("Fatal error:\n") + exception.what();
FatalErrorReport::Report(message);
return -1;
}
catch (...)
{
FatalErrorReport::Report("Unknown fatal error (non-std::exception).");
return -1;
}
}