-
Notifications
You must be signed in to change notification settings - Fork 15
/
index.html
72 lines (66 loc) · 2.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>VDP-16</title>
<style type="text/css">
body {
background: #111;
display: flex;
justify-content: center;
align-items: center;
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
}
canvas {
border: 1px solid #ccc;
image-rendering: optimizeSpeed; /* Older versions of FF */
image-rendering: -moz-crisp-edges; /* FF 6.0+ */
image-rendering: -webkit-optimize-contrast; /* Safari */
image-rendering: -o-crisp-edges; /* OS X & Windows Opera (12.02+) */
image-rendering: pixelated; /* Awesome future-browsers */
-ms-interpolation-mode: nearest-neighbor; /* IE */
}
#error-box {
display: none;
position: absolute;
left: 0;
top: 0;
color: red;
background: rgba(0,0,0,0.7);
border-radius: 10px;
padding: 5px
}
.visible {
display: block !important;
}
</style>
</head>
<body>
<canvas id="glCanvas" width="256" height="256"></canvas>
<div id="error-box">An error occurred and your game has been interrupted.<br>
Please open the developer tools console in your browser to get more information.<br>
On Firefox, press Ctrl+Shift+I (Command+option+I on Mac), on Chrome Ctrl+Shift+J (Command+option+J on Mac).
<br><br>
<span id="error-detail"></span>
</div>
<script>
var canvas = document.querySelector('#glCanvas');
// Resize the canvas for the pixel ratio so that pixels are not stretched (for 100-200%)
var ratio = window.devicePixelRatio;
if (ratio < 2) {
canvas.style.width = `${256 / ratio * 2}px`;
canvas.style.height = `${256 / ratio * 2}px`;
} else {
ratio = Math.floor(ratio);
canvas.style.width = `${256 * ratio}px`;
canvas.style.height = `${256 * ratio}px`;
}
window['resourceDir'] = 'dist/';
</script>
<script src="dist/game.bundle.js"></script>
</body>
</html>