ezEngine  Milestone 7
ApplicationEntryPoint_win.h File Reference

Go to the source code of this file.

Macros

#define EZ_CONSOLEAPP_ENTRY_POINT(AppClass,...)
 Same as EZ_APPLICATION_ENTRY_POINT but should be used for applications that shall always show a console window. More...
 
#define EZ_APPLICATION_ENTRY_POINT(AppClass,...)
 This macro allows for easy creation of application entry points (since they can't be placed in DLLs) More...
 

Macro Definition Documentation

#define EZ_APPLICATION_ENTRY_POINT (   AppClass,
  ... 
)
Value:
static char appBuffer[sizeof(AppClass)]; /* Not on the stack to cope with smaller stacks */ \
\
int CALLBACK WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) \
{ \
\
AppClass* pApp = new (appBuffer) AppClass(__VA_ARGS__); \
pApp->SetCommandLineArguments((ezUInt32) __argc, const_cast<const char**>(__argv)); \
ezRun(pApp); /* Life cycle & run method calling */ \
int iReturnCode = pApp->GetReturnCode(); \
pApp->~AppClass(); \
memset(pApp, 0, sizeof(AppClass)); \
return iReturnCode; \
}

This macro allows for easy creation of application entry points (since they can't be placed in DLLs)

Just use the macro in a cpp file of your application and supply your app class (must be derived from ezApplication). The additional (optional) parameters are passed to the constructor of your app class.

#define EZ_CONSOLEAPP_ENTRY_POINT (   AppClass,
  ... 
)
Value:
static char appBuffer[sizeof(AppClass)]; /* Not on the stack to cope with smaller stacks */ \
\
int main(int argc, const char** argv) \
{ \
\
AppClass* pApp = new (appBuffer) AppClass(__VA_ARGS__); \
pApp->SetCommandLineArguments((ezUInt32) argc, argv); \
ezRun(pApp); /* Life cycle & run method calling */ \
int iReturnCode = pApp->GetReturnCode(); \
pApp->~AppClass(); \
memset(pApp, 0, sizeof(AppClass)); \
return iReturnCode; \
}

Same as EZ_APPLICATION_ENTRY_POINT but should be used for applications that shall always show a console window.