-
Notifications
You must be signed in to change notification settings - Fork 42
/
main.cpp
49 lines (33 loc) · 1.1 KB
/
main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#include "hello_triangle_app/hello_triangle_app.h"
/*
Not much to see here - main.cpp works as a stub.
Its main purpose is to load the main application module, and to
sustain the main `update()` loop.
For each iteration of the main loop, we're calling `update()` on the
application. This goes on until the application's `update()` method
returns `false`.
If hot-reloading is activated (via the `PLUGINS_DYNAMIC` compiler
flag) we're additionally checking if any modules need to be reloaded.
*/
// ----------------------------------------------------------------------
int main( int argc, char const* argv[] ) {
HelloTriangleApp::initialize();
{
// We instantiate HelloTriangleApp in its own scope - so that
// it will be destroyed before HelloTriangleApp::terminate
// is called.
HelloTriangleApp HelloTriangleApp{};
for ( ;; ) {
#ifdef PLUGINS_DYNAMIC
le_core_poll_for_module_reloads();
#endif
auto result = HelloTriangleApp.update();
if ( !result ) {
break;
}
}
}
// Must only be called once last HelloTriangleApp is destroyed
HelloTriangleApp::terminate();
return 0;
}