JNGL
main.hpp
1 // Copyright 2015-2020 Jan Niklas Hasse <[email protected]>
2 // For conditions of distribution and use, see copyright notice in LICENSE.txt
3 
4 #pragma once
5 
6 #include "Finally.hpp"
7 #include "other.hpp"
8 #include "window.hpp"
9 
10 #ifdef JNGL_UWP
11 #include <SDL.h>
12 
13 #define JNGL_MAIN_BEGIN /* NOLINT */ int main(int argc, char** argv) { \
14  jngl::Finally _ZtzNg47T5XSjogv(jngl::hideWindow);
15 #define JNGL_MAIN_END return 0; } // NOLINT
16 
17 #else
18 
19 #ifdef __APPLE__
20 #include "TargetConditionals.h"
21 #endif
22 
23 #if !defined(JNGL_MAIN_BEGIN)
24  #if defined(ANDROID)
25  #include <android_native_app_glue.h>
26 
27  namespace jngl {
28  extern android_app* androidApp;
29  }
30  #define JNGL_MAIN_BEGIN void android_main(android_app* __androidApp) { \
31  jngl::androidApp = __androidApp; \
32  jngl::setConfigPath(__androidApp->activity->internalDataPath); \
33  jngl::Finally _ZtzNg47T5XSjogv(jngl::hideWindow);
34  #define JNGL_MAIN_END }
35  #elif defined(__APPLE__) && TARGET_OS_IPHONE // iOS
36  #define JNGL_MAIN_BEGIN void shouldNotBeCalled() {
37  #define JNGL_MAIN_END }
38  #else
39  #define JNGL_MAIN_BEGIN /* NOLINT */ int main(int argc, char** argv) { \
40  { \
41  std::vector<std::string> tmp(argc - 1); \
42  for (int i = 1; i < argc; ++i) { \
43  tmp[i - 1] = argv[i]; \
44  } \
45  jngl::setArgs(tmp); \
46  } \
47  jngl::Finally _ZtzNg47T5XSjogv(jngl::hideWindow);
48  #define JNGL_MAIN_END } // NOLINT
49  #endif
50 #endif
51 
52 #endif
Finally.hpp
jngl
JNGL's main namespace.
Definition: App.hpp:9
window.hpp
Functions related to the main window.
other.hpp