瀏覽代碼

Update rcore_web.c

Ray 7 月之前
父節點
當前提交
d48b8afbb5
共有 1 個文件被更改,包括 12 次插入6 次删除
  1. 12 6
      src/platforms/rcore_web.c

+ 12 - 6
src/platforms/rcore_web.c

@@ -155,14 +155,20 @@ 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
+// Sleep is handled in EndDrawing() for synchronous code
 bool WindowShouldClose(void)
 {
-    // Emterpreter-Async required to run sync code
-    // https://github.com/emscripten-core/emscripten/wiki/Emterpreter#emterpreter-async-run-synchronous-code
-    // 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
+    // Emscripten Asyncify is required to run synchronous code in asynchronous JS
+    // REF: https://emscripten.org/docs/porting/asyncify.html
+
+    // WindowShouldClose() is not called on a web-ready raylib application if using emscripten_set_main_loop()
+    // and encapsulating one frame execution on a UpdateDrawFrame() function, 
+    // allowing the browser to manage execution asynchronously
+
+    // Optionally we can manage the time we give-control-back-to-browser if required,
+    // but it seems below line could generate stuttering on some browsers
+    //emscripten_sleep(16);
+    
     return false;
 }