Repository navigation
Expand file tree
/
Copy pathmain.cpp
More file actions
45 lines (43 loc) · 1.45 KB
/
Copy pathmain.cpp
File metadata and controls
45 lines (43 loc) · 1.45 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
#include <filesystem>
#include "root.magic"
#include "EngineCode/Application.h"
#include "GameCode/Game.h"
#include "EngineCode/Log.h"
#include "EngineCode/MemoryManager.h"
int main()
{
Magic::Logger::Info(std::format("Original working directory: {}", std::filesystem::current_path().string()));
try
{
// Change the current working directory
std::filesystem::current_path(PROJECT_ROOT);
Magic::Logger::Info(std::format("Working directory changed to: {}", std::filesystem::current_path().string()));
}
catch (const std::filesystem::filesystem_error& e)
{
Magic::Logger::Err(std::format("Error changing working directory: {}", e.what()));
exit(1);
}
// Double check:
{
std::filesystem::path check_root_path = std::filesystem::current_path() / std::string("root.magic");
if (std::filesystem::exists(check_root_path))
{
Magic::Logger::Info("You found the root...");
}
else
{
Magic::Logger::Info("You failed to find the root, looks like you're not cut out for this after all...");
}
}
Magic::GMemoryManager = new Magic::MemoryManager();
Magic::GMemoryManager->Initialize();
Magic::Application app;
app.Startup();
std::unique_ptr<Magic::Game> pGame = std::make_unique<Magic::Game>();
app.Run(*pGame);
app.Shutdown();
Magic::GMemoryManager->Shutdown();
delete Magic::GMemoryManager;
return 0;
}