Plasma Engine  2.0
Loading...
Searching...
No Matches
ApplicationEntryPoint_posix.h
1
2#pragma once
3
5
6
8#define PL_CONSOLEAPP_ENTRY_POINT PL_APPLICATION_ENTRY_POINT
9
10
15#define PL_APPLICATION_ENTRY_POINT(AppClass, ...) \
16 alignas(PL_ALIGNMENT_OF(AppClass)) static char appBuffer[sizeof(AppClass)]; /* Not on the stack to cope with smaller stacks */ \
17 \
18 PL_APPLICATION_ENTRY_POINT_CODE_INJECTION \
19 int main(int argc, const char** argv) \
20 { \
21 \
22 AppClass* pApp = new (appBuffer) AppClass(__VA_ARGS__); \
23 pApp->SetCommandLineArguments((plUInt32)argc, argv); \
24 plRun(pApp); /* Life cycle & run method calling */ \
25 const int iReturnCode = pApp->GetReturnCode(); \
26 if (iReturnCode != 0) \
27 { \
28 const char* szReturnCode = pApp->TranslateReturnCode(); \
29 if (szReturnCode != nullptr && szReturnCode[0] != '\0') \
30 plLog::Printf("Return Code: '%s'\n", szReturnCode); \
31 } \
32 pApp->~AppClass(); \
33 memset((void*)pApp, 0, sizeof(AppClass)); \
34 return iReturnCode; \
35 }