Imagine++
Interface.h
1// ===========================================================================
2// Imagine++ Libraries
3// Copyright (C) Imagine
4// For detailed information: http://imagine.enpc.fr/software
5// ===========================================================================
6
7#include <stdarg.h>
8
9// SPECIAL MACRO.
10// The graphics thread has to be the main thread on some platforms (eg MacOS).
11// Therefore, we have to play tricks to let the user believe it is in the main
12// function, while her instructions are __main, running in a secondary thread.
13// argc >= 1 & argv[0] = relative .exe path.
14// __VA_ARGS__ catches ... (variadic macro).
15int __main(int argc, char** argv);
16
17#define main(...) \
18 main(int argc, char** argv) { \
19 return Imagine::GraphicsThread(argc, argv).exec(); \
20 } \
21 int __main(int argc, char** argv)
22
23namespace Imagine {
26
27#ifndef DOXYGEN_SHOULD_SKIP_THIS
28 class GraphicsApplication; // Opaque class the user does not need to know
29 class GraphicsThread { // Encapsulate the global application instance
30
31 public:
32 GraphicsThread(int& argc, char** argv);
33 ~GraphicsThread();
34 int exec();
35 private:
36 GraphicsApplication* app;
37 };
38#endif
43}
void endGraphics()
Terminate graphics application.
Imagine++ namespace.