summaryrefslogtreecommitdiffstats
path: root/platform/web/web_main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'platform/web/web_main.cpp')
-rw-r--r--platform/web/web_main.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/platform/web/web_main.cpp b/platform/web/web_main.cpp
index f199f8ffd8..ad2a801881 100644
--- a/platform/web/web_main.cpp
+++ b/platform/web/web_main.cpp
@@ -40,7 +40,10 @@
#include <stdlib.h>
static OS_Web *os = nullptr;
+#ifndef PROXY_TO_PTHREAD_ENABLED
static uint64_t target_ticks = 0;
+#endif
+
static bool main_started = false;
static bool shutdown_complete = false;
@@ -63,15 +66,20 @@ void cleanup_after_sync() {
}
void main_loop_callback() {
+#ifndef PROXY_TO_PTHREAD_ENABLED
uint64_t current_ticks = os->get_ticks_usec();
+#endif
bool force_draw = DisplayServerWeb::get_singleton()->check_size_force_redraw();
if (force_draw) {
Main::force_redraw();
+#ifndef PROXY_TO_PTHREAD_ENABLED
} else if (current_ticks < target_ticks) {
return; // Skip frame.
+#endif
}
+#ifndef PROXY_TO_PTHREAD_ENABLED
int max_fps = Engine::get_singleton()->get_max_fps();
if (max_fps > 0) {
if (current_ticks - target_ticks > 1000000) {
@@ -81,6 +89,8 @@ void main_loop_callback() {
}
target_ticks += (uint64_t)(1000000 / max_fps);
}
+#endif
+
if (os->main_loop_iterate()) {
emscripten_cancel_main_loop(); // Cancel current loop and set the cleanup one.
emscripten_set_main_loop(exit_callback, -1, false);