
815.8 Developer Tools
ird and nally, we will use emscripten_set_main_loop_arg and the address
of our populated argument struct:
Listing 5.6 Use emscripten_set_main_loop_arg.
void ESUTIL_API esMainLoop (ESContext *esContext)
{
#ifdef __EMSCRIPTEN__
struct loop_vars_t args = {0};
args.totaltime = 0.0f;
args.frames = 0;
args.esContext = esContext;
gettimeofday(&args.t1, &args.tz);
emscripten_set_main_loop_arg(render, &args, 0, 1);
#else
...
At this point, building should give us an error that emscripten_set_main_
loop_arg has not yet been dened. Make sure to #include "emscripten.h" at the
top of Common/esUtil.c. Emscripten will automatically know how to ...