Back to shtanton's homepage
summaryrefslogtreecommitdiff
path: root/src/index.html.in
diff options
context:
space:
mode:
Diffstat (limited to 'src/index.html.in')
-rw-r--r--src/index.html.in17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/index.html.in b/src/index.html.in
index aca8b6d..c239f6e 100644
--- a/src/index.html.in
+++ b/src/index.html.in
@@ -39,6 +39,11 @@ const WASM =
const MUSIC =
#include "../build/music.mp3.b64"
+const IMAGES = [
+#include "../build/continue.png.b64"
+,
+];
+
async function main() {
let bytes = Uint8Array.from(atob(WASM), function(c) {
return c.charCodeAt(0);
@@ -57,6 +62,13 @@ async function main() {
audio.loop = true;
let musicPlaying = false;
+ let images = [null];
+ for (let i = 0; i < IMAGES.length; i++) {
+ const image = new Image();
+ image.src = IMAGES[i];
+ images.push(image);
+ }
+
const start = Date.now();
function now() {
return Date.now() - start;
@@ -79,7 +91,7 @@ async function main() {
let ops = dl.subarray(1);
for (let i = 0; i < len; i++) {
- let op = ops.subarray(6*i, 6*i+6);
+ let op = ops.subarray(7*i, 7*i+7);
const color = new Uint8Array(new Uint32Array(op.subarray(4, 6)).buffer);
ctx.fillStyle = `#${color[0].toString(16).padStart(2, "0")}${color[1].toString(16).padStart(2, "0")}${color[2].toString(16).padStart(2, "0")}`;
ctx.globalAlpha = color[3] / 255;
@@ -87,6 +99,9 @@ async function main() {
ctx.strokeStyle = `#${color[4].toString(16).padStart(2, "0")}${color[5].toString(16).padStart(2, "0")}${color[6].toString(16).padStart(2, "0")}`;
ctx.globalAlpha = color[7] / 255;
ctx.strokeRect(op[0], op[1], op[2], op[3]);
+ if (op[6] !== 0) {
+ ctx.drawImage(images[op[6]], op[0], op[1], op[2], op[3]);
+ }
}
}