From 77c509db6ef2fec8e46593fd05c1fa69e5955cb8 Mon Sep 17 00:00:00 2001 From: Anthony Carbajal <5776225+CrackedPixel@users.noreply.github.com> Date: Mon, 20 Jan 2025 05:14:18 -0600 Subject: [PATCH] removed hardcoded sleep (#4713) --- src/platforms/rcore_web.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/platforms/rcore_web.c b/src/platforms/rcore_web.c index 4faf5b87feba..55f5f11a0784 100644 --- a/src/platforms/rcore_web.c +++ b/src/platforms/rcore_web.c @@ -154,14 +154,15 @@ static const char *GetCanvasId(void); //---------------------------------------------------------------------------------- // Check if application should close +// This will always return false on a web-build as web builds have no control over this functionality +// Sleep is handled in EndDrawing for sync code bool WindowShouldClose(void) { // Emterpreter-Async required to run sync code // https://github.com/emscripten-core/emscripten/wiki/Emterpreter#emterpreter-async-run-synchronous-code - // By default, this function is never called on a web-ready raylib example because we encapsulate - // frame code in a UpdateDrawFrame() function, to allow browser manage execution asynchronously - // but now emscripten allows sync code to be executed in an interpreted way, using emterpreter! - emscripten_sleep(16); + // This function should not called on a web-ready raylib build because you instead want to encapsulate + // frame code in an UpdateDrawFrame() function, to allow the browser to manage execution asynchronously + // using emscripten_set_main_loop return false; }