Skip to content

Commit

Permalink
Optimize font loading and add loading screen for web
Browse files Browse the repository at this point in the history
  • Loading branch information
TheGreatRambler committed Dec 25, 2021
1 parent 7e4dd34 commit 8c7d568
Show file tree
Hide file tree
Showing 3 changed files with 660 additions and 10 deletions.
24 changes: 23 additions & 1 deletion shell_minimal.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,22 @@
image-rendering: pixelated;
-ms-interpolation-mode: nearest-neighbor;
}

#loading {
display: flex;
justify-content: center;
align-items: center;
text-align: center;
min-height: 100vh;
background-color: #805438;
}
</style>
</head>

<body>
<div id="loading">
<p>Loading...</p>
</div>
<canvas class="emscripten" id="canvas" oncontextmenu="event.preventDefault()"></canvas>
<script type='text/javascript'>
var Module = {
Expand All @@ -59,7 +71,8 @@
},
monitorRunDependencies: function(left) {
// no run dependencies to log
}
},
showLoading: true
};
window.onerror = function() {
console.log("onerror: " + event);
Expand All @@ -73,6 +86,15 @@

return originalCanvasGetContext.call(this, contextType, contextAttributes);
};

var loadingElement = document.getElementById("loading");
setInterval(function() {
if (Module.showLoading) {
loadingElement.style.display = "flex";
} else {
loadingElement.style.display = "none";
}
}, 50);
</script>
<script src="FileSaver.min.js"></script>
{{{ SCRIPT }}}
Expand Down
Loading

0 comments on commit 8c7d568

Please sign in to comment.