-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathWinMain.cpp
More file actions
46 lines (39 loc) · 900 Bytes
/
Copy pathWinMain.cpp
File metadata and controls
46 lines (39 loc) · 900 Bytes
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
#include "App/NeneEngineApp.h"
#include <iostream>
#include <sstream>
#include <string_view>
namespace
{
bool HasCommandLineFlag(LPWSTR commandLine, std::wstring_view flag)
{
if (commandLine == nullptr || *commandLine == L'\0') return false;
std::wistringstream input(commandLine);
std::wstring argument;
while (input >> argument)
{
if (argument == flag) return true;
}
return false;
}
} // namespace
int WINAPI wWinMain(HINSTANCE, HINSTANCE, LPWSTR commandLine, int)
{
try
{
const bool smokeTestMode = HasCommandLineFlag(commandLine, L"--smoke-test");
NeneEngine::NeneEngineApp app;
if (!app.Init(1280, 720, "NeneEngine"))
{
std::cerr << "Failed to initialize application\n";
return -1;
}
if (smokeTestMode) return 0;
app.Run();
return 0;
}
catch (const std::exception& e)
{
std::cerr << "Fatal error: " << e.what() << "\n";
return -1;
}
}