-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathindex.html
56 lines (53 loc) · 1.61 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
54
55
56
<!DOCTYPE html>
<html lang="en">
<head>
<meta name="twitter:card" content="player" />
<meta name="twitter:site" content="@nill" />
<meta name="twitter:creator" content="@nill" />
<meta property="og:url" content="https://jakecoffman.com/cp-ebiten/" />
<meta property="og:title" content="Chipmunk2D Logosmash" />
<meta property="og:description" content="Chipmunk2D example ported to Go cross compiled to WASM hosted on GitHub embedded on Twitter." />
<meta property="og:image" content="https://jakecoffman.com/cp-ebiten/preview.png" />
<meta name="twitter:player" content="https://jakecoffman.com/cp-ebiten/" />
<meta name="twitter:player:width" content="600" />
<meta name="twitter:player:height" content="480" />
<title>Chipmunk2D Demo</title>
<style>
a {
color: lightskyblue;
}
a:visited {
color: violet;
}
footer {
position: fixed;
left: 1rem;
bottom: 1rem;
color: lightblue;
display: flex;
gap: 2rem;
}
</style>
</head>
<body>
<footer>
<span>Other demos:</span>
<a href="tumble/">Tumble</a>
<a href="chain/">Chain</a>
</footer>
<script src="wasm_exec.js"></script>
<script>
// Polyfill
if (!WebAssembly.instantiateStreaming) {
WebAssembly.instantiateStreaming = async (resp, importObject) => {
const source = await (await resp).arrayBuffer();
return await WebAssembly.instantiate(source, importObject);
};
}
const go = new Go();
WebAssembly.instantiateStreaming(fetch("cpebiten.wasm"), go.importObject).then(result => {
go.run(result.instance);
});
</script>
</body>
</html>