-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
53 lines (51 loc) · 1.17 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<html>
<head>
<meta charset="UTF-8" />
<style>
body {
background-color: black;
margin: 0;
}
.text_container {
display: flex;
align-items: center;
justify-content: center;
width: 100%;
height: 100%;
}
</style>
</head>
<body>
<div id="loading" class="text_container">
<h1 style="color: white">Loading...</h1>
</div>
<canvas id="game"></canvas>
</body>
<script
type="text/javascript"
src="https://cdn.staticfile.org/pako/1.0.10/pako_inflate.min.js"
></script>
<script type="module">
import init from "./release/game.js";
let wasm_file = new URL("/release/game_bg.wasm.gz", import.meta.url);
fetch(wasm_file, {
headers: {
"Content-Encoding": "gzip",
"Content-Type": "application/wasm",
},
})
.then((rsp) => {
return rsp.blob();
})
.then((blob) => {
return blob.arrayBuffer();
})
.then((buffer) => {
let buf = pako.inflate(buffer);
return init(buf);
})
.finally(() => {
document.querySelector("#loading").remove();
});
</script>
</html>