-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
98 lines (85 loc) · 3.21 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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8"/>
<link rel="icon" type="image/svg+xml" href="/docs/icon.svg"/>
<meta name="viewport" content="width=device-width, user-scalable=no"/>
<title>Level Renderer</title>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Nunito:wght@400;700&display=swap" rel="stylesheet">
<style>
html, body {
padding: 0;
margin: 0;
overflow: hidden;
overscroll-behavior: none;
font-family: 'Nunito', sans-serif;
}
h1, h2, h3, h4, h5, h6, p {
margin: 0;
}
canvas, #overlay {
width: 100vw;
height: 100vh;
}
#overlay {
position: fixed;
overflow: hidden;
}
.annotation {
border-radius: 0.25rem;
background: #181818;
border: solid 1px #555;
padding: 0.5rem;
color: whitesmoke;
pointer-events: none;
position: absolute;
white-space: normal;
word-wrap: break-word;
width: 100%;
max-width: 300px;
box-shadow: #222222f0 0 2px 10px 0;
}
</style>
</head>
<body>
<div id="container">
<div id="overlay"></div>
<canvas id="display"></canvas>
</div>
<script type="module">
"use strict";
import ATLAS_1 from './src/resources/GJ_GameSheet-uhd.png'
import ATLAS_2 from './src/resources/GJ_GameSheet02-uhd.png'
import ATLAS_3 from './src/resources/FireSheet_01-uhd.png'
import P_ATLAS_1 from './src/resources/GJ_GameSheet-uhd.plist?url'
import P_ATLAS_2 from './src/resources/GJ_GameSheet02-uhd.plist?url'
import P_ATLAS_3 from './src/resources/FireSheet_01-uhd.plist?url'
import BG_1 from './src/resources/game_bg_01_001-uhd.png'
import LEVEL from './src/levels/4284013.keyed?raw'
import {Renderer, Annotation, Level, Texture} from './index.ts'
(async () => {
const renderer = new Renderer({
canvas: document.getElementById('display'),
overlay: document.getElementById('overlay'),
container: document.getElementById('container'),
devTools: true
});
await Level.loadAtlas(renderer, ATLAS_1, P_ATLAS_1, 0);
await Level.loadAtlas(renderer, ATLAS_2, P_ATLAS_2, 1);
await Level.loadAtlas(renderer, ATLAS_3, P_ATLAS_3, 2);
renderer.bgs[1] = new Texture(renderer, BG_1);
await renderer.initialize();
renderer.loadLevel(LEVEL);
if (renderer.level) {
renderer.level.annotations = [
new Annotation(90, 150, `<h2>OwO, What's This?</h2><p>It's a level annotation! These can be made by creators, added by users (à la Genius annotations), or used by level reviews to highlight parts of levels with their thoughts!</p>`),
new Annotation(600, 600, `<p>*stanley parable voice* this, is where there is nothing</p>`),
]
}
requestAnimationFrame(renderer.draw.bind(renderer));
})()
</script>
</body>
</html>