-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
32 lines (26 loc) · 974 Bytes
/
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
<!DOCTYPE html>
<html>
<!-- Most of index.html copied from https://github.com/timhutton/sdl-canvas-wasm -->
<head>
<meta charset="utf-8">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<!-- Create the canvas that the C code will draw into -->
<canvas id="canvas" oncontextmenu="event.preventDefault()" style="width:100%; height:100%"></canvas>
<!-- Allow the C code to access the canvas element -->
<script type='text/javascript'>
var Module = {};
fetch('index.wasm').then(response => response.arrayBuffer()).then(buffer => {
Module.canvas = document.getElementById("canvas");
Module.wasmBinary = buffer;
var script = document.createElement('script');
script.src = "index.js";
script.onload = function() {
console.log("Emscripten boilerplate loaded.")
}
document.body.appendChild(script);
});
</script>
</body>
</html>