blob: 172e2daeec8c87af77fec6327950eca8bb45ab86 (
plain)
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
|
#pragma once
#include "StarApplication.hpp"
#include "StarApplicationController.hpp"
#include "StarRenderer.hpp"
namespace Star {
int runMainApplication(ApplicationUPtr application, StringList cmdLineArgs);
}
#if defined STAR_SYSTEM_WINDOWS
#include <windows.h>
#define STAR_MAIN_APPLICATION(ApplicationClass) \
int __stdcall WinMain(HINSTANCE, HINSTANCE, LPSTR, int) { \
int nArgs; \
LPWSTR* argsList = CommandLineToArgvW(GetCommandLineW(), &nArgs); \
Star::StringList args; \
for (int i = 0; i < nArgs; ++i) args.append(Star::String(argsList[i])); \
if (IsDebuggerPresent() && AllocConsole()) { \
freopen("CONOUT$", "w", stdout); \
freopen("CONOUT$", "w", stderr); \
} \
unsigned long exceptionStackSize = 16384; \
SetThreadStackGuarantee(&exceptionStackSize); \
return Star::runMainApplication(Star::make_unique<ApplicationClass>(), args); \
}
#else
#define STAR_MAIN_APPLICATION(ApplicationClass) \
int main(int argc, char** argv) { \
return Star::runMainApplication(Star::make_unique<ApplicationClass>(), Star::StringList(argc, argv)); \
}
#endif
|