-
Notifications
You must be signed in to change notification settings - Fork 123
/
Main.cpp
72 lines (58 loc) · 1.5 KB
/
Main.cpp
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 <stdbool.h>
#include <SDL_main.h>
#include <hxcpp.h>
#include <wrl.h>
#ifdef main
#undef main
#endif
#ifndef SDL_WINRT_METADATA_FILE_AVAILABLE
#ifndef __cplusplus_winrt
#error Main.cpp must be compiled with /ZW, otherwise build errors due to missing .winmd files can occur.
#endif
#endif
#ifdef _MSC_VER
#pragma warning(disable:4447)
#endif
#ifdef _MSC_VER
#pragma comment(lib, "runtimeobject.lib")
#endif
#define DEBUG_PRINTF
#ifdef DEBUG_PRINTF
# ifdef UNICODE
# define DLOG(fmt, ...) {wchar_t buf[1024];swprintf(buf,L"****LOG: %s(%d): %s \n [" fmt "]\n",__FILE__,__LINE__,__FUNCTION__, __VA_ARGS__);OutputDebugString(buf);}
# else
# define DLOG(fmt, ...) {char buf[1024];sprintf(buf,"****LOG: %s(%d): %s \n [" fmt "]\n",__FILE__,__LINE__,__FUNCTION__, __VA_ARGS__);OutputDebugString(buf);}
# endif
#else
# define DLOG(fmt, ...) {}
#endif
#ifndef INCLUDED_ApplicationMain
#include <ApplicationMain.h>
#endif
extern "C" void __hxcpp_lib_main() { }
int _main(int argc, char *argv[])
{
HX_TOP_OF_STACK
hx::Boot();
try
{
__boot_all();
::ApplicationMain_obj::main();
}
catch (Dynamic e)
{
__hx_dump_stack();
return -1;
}
return 0;
}
int CALLBACK WinMain(HINSTANCE, HINSTANCE, LPSTR, int)
{
if (FAILED(Windows::Foundation::Initialize(RO_INIT_MULTITHREADED)))
{
DLOG("ERROR: Main.cpp can't initialize ");
return 1;
}
SDL_WinRTRunApp(_main, NULL);
return 0;
}