-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathindex.html
215 lines (185 loc) · 6.54 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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>VERGE!</title>
<style>
html, body {
padding: 0;
margin: 0;
width: 100%;
height: 100%;
}
body {
font-family: sans-serif;
background-color: #0a0804;
color: #a8a0a0;
text-align: center;
}
.vergeContainer {
width: 100%;
height: 100%;
position: relative;
display: grid;
grid-template-columns: 225px auto 225px;
grid-template-rows: 75px auto 50px 25px;
grid-template-areas:
"header header header"
"leftside playarea controls"
"leftside loadingbar controls"
"footer footer footer"
;
}
#canvasContainer {
grid-area: playarea;
align-self: stretch;
justify-self: stretch;
display: flex;
align-items: center;
justify-items: center;
}
canvas {
image-rendering: pixelated;
z-index: 999;
margin: auto;
}
#loadingProgress {
width: 624px;
margin: auto;
border: 4px solid gray;
padding: 4px;
height: 1em;
position: relative;
transition: opacity 2s;
grid-area: loadingbar;
align-self: center;
justify-self: center;
}
#loadingProgress div {
background-color: green;
margin: 4px;
position: absolute;
left: 0;
right: 100%;
top: 0;
bottom: 0;
}
#controls {
text-align: left;
z-index: -1;
grid-area: controls;
padding: 0.5em;
}
#no-audio-worklet {
display: none;
}
header {
font-size: 32px;
grid-area: header;
align-self: center;
justify-self: center;
}
footer {
font-size: 9px;
grid-area: footer;
align-self: center;
justify-self: center;
}
</style>
</head>
<body>
<div class="vergeContainer">
<header>VERGE</header>
<div id="canvasContainer">
<canvas id="vergeCanvas" width="320" height="200"></canvas>
</div>
<div id='loadingProgress'><div></div></div>
<div id='controls'>
<h2>Controls</h2>
<dl>
<dt>Arrow keys</dt><dd>Move</dd>
<dt>Enter</dt><dd>Interact, select menu options</dd>
<dt>Tab</dt><dd>Cancel out of menus</dd>
<dt>Space</dt><dd>Main menu (items, equipment, etc)</dd>
<dt>ESC</dt><dd>System menu (save, load, etc)</dd>
</dl>
<h2>Gamepad Controls</h2>
<dl>
<dt>A</dt><dd>Interact</dd>
<dt>B</dt><dd>Cancel</dd>
<dt>Y</dt><dd>Main menu</dd>
<dt>Start</dt><dd>System Menu</dd>
</dl>
<div id='no-audio-worklet'>
Your browser does not support AudioWorklet. We cannot play any music. Sorry!<br />
The latest versions of Chrome and Firefox should work!
</div>
</div>
<footer id="build-date"></footer>
</div>
<script>
(function() {
const screen_size = [320, 200];
const canvas = document.getElementById('vergeCanvas');
const canvasContainer = canvas.parentNode;
canvas.setAttribute('width', screen_size[0]);
canvas.setAttribute('height', screen_size[1]);
const resizeCallback = (e) => {
canvas.style.display = "none";
const parentRect = canvasContainer.getClientRects()[0];
const scaleX = (parentRect.width / screen_size[0]) | 0;
const scaleY = (parentRect.height / screen_size[1]) | 0;
const scale = Math.max(Math.min(scaleX, scaleY), 1);
canvas.style.width = (screen_size[0] * scale) + "px";
canvas.style.height = (screen_size[1] * scale) + "px";
canvas.style.display = "";
};
window.addEventListener('resize', resizeCallback);
resizeCallback();
if (!('audioWorklet' in AudioContext.prototype)) {
document.getElementById('no-audio-worklet').style.display = 'block';
}
})();
(function() {
const ctx = document.getElementById('vergeCanvas').getContext('2d');
ctx.fillStyle = 'black';
ctx.fillRect(0, 0, 320, 200);
ctx.fillStyle = 'white';
ctx.textAlign = 'center';
ctx.fillText('Loading! :D', 160, 100);
})();
</script>
<!--
DIRECTIONS:
Have a 320x200 canvas with the id vergeCanvas.
Define a function window.verge.setLoadingProgress. It takes a number which describes
the loading progress. The application will always call setLoadingProgress with a value of
100 when loading is complete.
Set window.Module to {arguments: ["gameroot_dir/"]}
The game root dir is a relative path to a manifest.txt. This file describes all the stuff
needed to run the game.
Once you have done all of this, include verge.out.js with a script tag.
-->
<script>
window.verge = {};
const verge = window.verge;
verge.setBuildDate = function(date) {
document.getElementById('build-date').innerText = `Last Updated ${date}`;
};
verge.setLoadingProgress = function(percent) {
const div = document.querySelector('#loadingProgress div');
div.style.right = (100 - percent) + '%';
if (percent == 100) {
setTimeout(() => document.getElementById('loadingProgress').style.opacity = '0', 1000);
}
};
const u = new URLSearchParams(window.location.search);
let game = u.get('game') || 'sully';
window.Module = {arguments: [game + '/']};
if (u.get("statCheat") > 0) {
window.Module.arguments.push('statCheat');
}
</script>
<script async type="text/javascript" src="verge.out.js"></script>
</body>
</html>