// Each main loop is numbered with a ID in sequence order. Only one main loop can run at a time. This variable stores the ordinal number of the main loop that is currently
// allowed to run. All previous main loops will quit themselves. This is incremented whenever a new main loop is created.
currentlyRunningMainloop: 0,
func: null,// The main loop tick function that will be called at each iteration.
arg: 0,// The argument that will be passed to the main loop. (of type void*)
timingMode: 0,
timingValue: 0,
currentFrameNumber: 0,
queue: [],
pause: function(){
Browser.mainLoop.scheduler=null;
Browser.mainLoop.currentlyRunningMainloop++;// Incrementing this signals the previous main loop that it's now become old, and it must return.
},
resume: function(){
Browser.mainLoop.currentlyRunningMainloop++;
vartimingMode=Browser.mainLoop.timingMode;
vartimingValue=Browser.mainLoop.timingValue;
varfunc=Browser.mainLoop.func;
Browser.mainLoop.func=null;
_emscripten_set_main_loop(func,0,false,Browser.mainLoop.arg,true/* do not set timing and call scheduler, we will do it on the next lines */);
// create a new parent to ensure the canvas has no siblings. this allows browsers to optimize full screen performance when its parent is the full screen root