September 2018
Intermediate to advanced
328 pages
9h 10m
English
The updated start() function, which acts as the entry point to the module, is shown as follows:
EMSCRIPTEN_KEEPALIVEvoid start(int boundsWidth, int boundsHeight, int rectWidth, int rectHeight) { rect.x = 0; rect.y = 0; rect.horizDir = 'R'; rect.vertDir = 'D'; rect.width = rectWidth; rect.height = rectHeight; bounds.width = boundsWidth; bounds.height = boundsHeight; setIsRunning(true);}
Any functions that are called from JavaScript are prepended with the EMSCRIPTEN_KEEPALIVE statement. We're now passing the width and height of both the Bounds and Rect elements as arguments to the start() function, which we assign to the local bounds and rect variables. This allows us to easily change the dimensions of either one without ...
Read now
Unlock full access