1
0
mirror of https://github.com/wolfpld/tracy synced 2025-05-01 05:03:53 +00:00

Setup main emscripten loop.

This commit is contained in:
Bartosz Taudul 2022-09-30 00:57:07 +02:00
parent 863b36d04b
commit 78169326b3
No known key found for this signature in database
GPG Key ID: B7FE2008B7575DF3

View File

@ -2,6 +2,7 @@
#include "imgui/imgui_impl_opengl3.h" #include "imgui/imgui_impl_opengl3.h"
#ifdef __EMSCRIPTEN__ #ifdef __EMSCRIPTEN__
# include <GLES2/gl2.h> # include <GLES2/gl2.h>
# include <emscripten/html5.h>
#else #else
# include "imgui/imgui_impl_opengl3_loader.h" # include "imgui/imgui_impl_opengl3_loader.h"
#endif #endif
@ -120,6 +121,13 @@ void Backend::Show()
void Backend::Run() void Backend::Run()
{ {
#ifdef __EMSCRIPTEN__
emscripten_set_main_loop( []() {
glfwPollEvents();
s_redraw();
s_mainThreadTasks->Run();
}, 0, 1 );
#else
while( !glfwWindowShouldClose( s_window ) ) while( !glfwWindowShouldClose( s_window ) )
{ {
if( s_iconified ) if( s_iconified )
@ -137,6 +145,7 @@ void Backend::Run()
s_mainThreadTasks->Run(); s_mainThreadTasks->Run();
} }
} }
#endif
} }
void Backend::NewFrame( int& w, int& h ) void Backend::NewFrame( int& w, int& h )