-
-
Notifications
You must be signed in to change notification settings - Fork 30
Expand file tree
/
Copy pathEntryPoint.cpp
More file actions
72 lines (55 loc) · 1.77 KB
/
EntryPoint.cpp
File metadata and controls
72 lines (55 loc) · 1.77 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
69
70
71
72
#include <CLI/CLI.hpp>
#include <Tetragrama/Editor.h>
#include <ZEngine/Applications/GameApplication.h>
#include <ZEngine/Core/Memory/MemoryManager.h>
#include <ZEngine/EngineConfiguration.h>
#include <ZEngine/Logging/Logger.h>
#ifdef ZENGINE_PLATFORM
using namespace ZEngine;
using namespace ZEngine::Logging;
using namespace ZEngine::Core::Memory;
using namespace ZEngine::Applications;
int applicationEntryPoint(int argc, char* argv[])
{
MemoryManager manager = {};
MemoryConfiguration config = {.DefaultSize = ZGiga(3u)};
manager.Initialize(config);
auto arena = &(manager.Allocator);
LoggerConfiguration logger_cfg = {};
Logger::Initialize(arena, logger_cfg);
GameApplicationPtr app = nullptr;
CLI::App cli{"ObeliskCLI"};
argv = cli.ensure_utf8(argv);
std::string config_file = "";
bool launch_editor = false;
cli.add_option("--projectConfigFile", config_file, "The project config file");
cli.add_option("--launchEditor", launch_editor, "The project config file");
CLI11_PARSE(cli, argc, argv);
if (launch_editor)
{
app = ZPushStructCtor(arena, Tetragrama::Editor);
app->EnableRenderOverlay = true;
}
app->ConfigFile = config_file.c_str();
app->Initialize(arena);
app->Run();
app->Shutdown();
Logger::Dispose();
manager.Shutdowm();
return 0;
}
#ifdef _WIN32
#include <windows.h>
#include <winrt/Windows.Foundation.h>
int APIENTRY WinMain(HINSTANCE hInst, HINSTANCE hInstPrev, PSTR cmdline, int cmdshow)
{
winrt::init_apartment();
return applicationEntryPoint(__argc, __argv);
}
#else
int main(int argc, char* argv[])
{
return applicationEntryPoint(argc, argv);
}
#endif
#endif