osb/source/application/StarMainApplication.hpp
2023-06-20 14:33:09 +10:00

35 lines
1.3 KiB
C++

#ifndef STAR_MAIN_APPLICATION_HPP
#define STAR_MAIN_APPLICATION_HPP
#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])); \
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
#endif