cakefoot/src/pre_js.js

35 lines
1.1 KiB
JavaScript

/* _ _
* c/a`k-e'f`o^o~t-, | a single-button action game | by @ooofoam
* / _< | wow a living cake the sweet | play online: https://foam.ooo/cakefoot
* > `~_/ | taste of victory | open source: https://open.shampoo.ooo/shampoo/cakefoot
*
* Custom modifications to Emscripten's Module object and other JavaScript to be included in WASM builds.
*/
function collectData() {}
/* Set Emscripten to use a canvas for display. */
Module.canvas = document.getElementById("canvas");
/* Turn off automatic call to main function */
Module.noInitialRun = true;
/* Mount storage for the save file and run game */
Module.onRuntimeInitialized = function()
{
FS.mkdir("/storage");
FS.mount(IDBFS, {}, "/storage");
FS.syncfs(true, function(error) {
if (error !== null)
{
console.log("Error mounting storage with Filesystem API", error);
}
else
{
document.getElementById("loading").remove();
document.getElementById("canvas").style.display = "block";
_main();
}
});
}