2023-12-18 17:06:11 +01:00
|
|
|
#ifdef __EMSCRIPTEN__
|
|
|
|
#include <emscripten.h>
|
|
|
|
#endif // __EMSCRIPTEN__
|
|
|
|
|
|
|
|
#include "game_application.h"
|
2023-12-31 16:20:14 +01:00
|
|
|
|
2023-12-18 17:06:11 +01:00
|
|
|
Application *application = NULL;
|
|
|
|
|
|
|
|
void handle_frame() {
|
2024-01-03 13:52:39 +01:00
|
|
|
application->core_loop();
|
2023-12-18 17:06:11 +01:00
|
|
|
}
|
|
|
|
|
2023-12-19 15:23:49 +01:00
|
|
|
int main(int argc, char **argv) {
|
2024-01-03 13:52:39 +01:00
|
|
|
application = memnew(GameApplication());
|
2023-12-18 17:06:11 +01:00
|
|
|
|
2023-12-19 15:23:49 +01:00
|
|
|
#ifdef __EMSCRIPTEN__
|
|
|
|
emscripten_set_main_loop(handle_frame, 0, 1);
|
|
|
|
#else
|
|
|
|
|
|
|
|
while (application->running) {
|
2024-01-03 13:52:39 +01:00
|
|
|
application->core_loop();
|
2023-12-19 15:23:49 +01:00
|
|
|
}
|
2023-12-18 17:06:11 +01:00
|
|
|
|
2024-01-03 13:52:39 +01:00
|
|
|
memdelete(application);
|
2023-12-19 15:23:49 +01:00
|
|
|
|
|
|
|
#endif // __EMSCRIPTEN__
|
2023-12-18 17:06:11 +01:00
|
|
|
|
2023-12-19 15:23:49 +01:00
|
|
|
return 0;
|
2023-12-18 17:06:11 +01:00
|
|
|
}
|