diff options
author | Kae <80987908+Novaenia@users.noreply.github.com> | 2023-06-20 14:33:09 +1000 |
---|---|---|
committer | Kae <80987908+Novaenia@users.noreply.github.com> | 2023-06-20 14:33:09 +1000 |
commit | 6352e8e3196f78388b6c771073f9e03eaa612673 (patch) | |
tree | e23772f79a7fbc41bc9108951e9e136857484bf4 /source/application/StarMainApplication.hpp | |
parent | 6741a057e5639280d85d0f88ba26f000baa58f61 (diff) |
everything everywhere
all at once
Diffstat (limited to 'source/application/StarMainApplication.hpp')
-rw-r--r-- | source/application/StarMainApplication.hpp | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/source/application/StarMainApplication.hpp b/source/application/StarMainApplication.hpp new file mode 100644 index 0000000..515dfb9 --- /dev/null +++ b/source/application/StarMainApplication.hpp @@ -0,0 +1,34 @@ +#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 |