MCPcopy Create free account
hub / github.com/antopilo/Nuake / ApplicationMain

Function ApplicationMain

Runtime/Source/Runtime.cpp:89–173  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

87}
88
89int ApplicationMain(int argc, char* argv[])
90{
91 using namespace Nuake;
92
93 const auto& arguments = ParseArguments(argc, argv);
94 LaunchSettings launchSettings = ParseLaunchSettings(arguments);
95
96 Engine::Init();
97
98 auto window = Nuake::Engine::GetCurrentWindow();
99
100 std::string projectPath;
101 if (launchSettings.projectPath.empty())
102 {
103 projectPath = "./game.project";
104 }
105 else
106 {
107 projectPath = launchSettings.projectPath;
108 }
109
110 FileSystem::SetRootDirectory(FileSystem::GetParentPath(projectPath));
111
112 Ref<Nuake::Project> project = Nuake::Project::New();
113 project->FullPath = projectPath;
114
115 if (!FileSystem::FileExists(projectPath))
116 {
117 Logger::Log("game.project not found", "runtime", CRITICAL);
118 return -1;
119 }
120
121 const std::string& projectfileContent = FileSystem::ReadFile(projectPath, true);
122 if (projectfileContent.empty())
123 {
124 Logger::Log("game.project was empty", "runtime", CRITICAL);
125 return -1;
126 }
127
128 project->Deserialize(json::parse(projectfileContent));
129
130 window->ShowTitleBar(true);
131 window->SetDecorated(true);
132 window->SetTitle(project->Name);
133
134 Nuake::Engine::LoadProject(project);
135 Nuake::Engine::EnterPlayMode();
136 window->SetVSync(false);
137
138 while (!window->ShouldClose())
139 {
140 Nuake::Engine::Tick();
141 Engine::Draw();
142
143 const auto& WindowSize = window->GetSize();
144 //glViewport(0, 0, WindowSize.x, WindowSize.y);
145 Nuake::Renderer2D::BeginDraw(WindowSize);
146

Callers 3

WinMainFunction · 0.85
mainFunction · 0.85
WinMainFunction · 0.85

Calls 15

GetCurrentWindowFunction · 0.85
LogFunction · 0.85
parseFunction · 0.85
DrawFunction · 0.85
PushStyleVarFunction · 0.85
PopStyleVarFunction · 0.85
ShowTitleBarMethod · 0.80
SetDecoratedMethod · 0.80
ShouldCloseMethod · 0.80
GetFrameBufferMethod · 0.80
ParseArgumentsFunction · 0.70
ParseLaunchSettingsFunction · 0.70

Tested by

no test coverage detected