#include #include #include "../blupi.h" #include "../event.h" #include "../platform.h" std::function Platform::handleEvent; Platform::Type Platform::getType () { return JS; } void Platform::run (std::function handleEvent) { Platform::handleEvent = handleEvent; Platform::timer (nullptr); emscripten_set_main_loop ( []() { SDL_Event event; while (SDL_PollEvent (&event)) { Platform::handleEvent (event); if (event.type == SDL_QUIT) break; } }, 0, 1); } void Platform::timer (void *) { CEvent::PushUserEvent (EV_UPDATE); emscripten_async_call (Platform::timer, nullptr, g_timerInterval); }