-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy pathshell.html
More file actions
348 lines (312 loc) · 9.14 KB
/
shell.html
File metadata and controls
348 lines (312 loc) · 9.14 KB
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
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<title>D I G G E R</title>
<style>
@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap');
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
background: #0a0a0a;
color: #c0c0c0;
font-family: 'Press Start 2P', monospace;
min-height: 100vh;
display: flex;
flex-direction: column;
align-items: center;
overflow-x: hidden;
}
.header {
padding: 24px 0 12px;
text-align: center;
}
.title {
font-size: 28px;
color: #33ff33;
text-shadow: 0 0 20px #33ff3366, 0 0 40px #33ff3333;
letter-spacing: 0.3em;
}
.subtitle {
font-size: 9px;
color: #888;
margin-top: 8px;
letter-spacing: 0.15em;
font-family: monospace;
}
.game-wrap {
position: relative;
width: min(640px, calc(100vw - 24px));
aspect-ratio: 640 / 400;
margin: 12px auto;
border: 2px solid #222;
border-radius: 4px;
box-shadow: 0 0 30px #000, 0 0 2px #33ff3322;
background: #000;
line-height: 0;
}
canvas {
display: block;
width: 100%;
height: 100%;
border: 0;
background: #000;
image-rendering: pixelated;
image-rendering: crisp-edges;
}
.controls-bar {
display: flex;
gap: 16px;
align-items: center;
justify-content: center;
margin: 12px 0;
flex-wrap: wrap;
}
.btn {
font-family: 'Press Start 2P', monospace;
font-size: 10px;
padding: 8px 20px;
border: 1px solid #33ff33;
background: transparent;
color: #33ff33;
cursor: pointer;
letter-spacing: 0.1em;
transition: all 0.15s;
}
.btn:hover {
background: #33ff3318;
box-shadow: 0 0 12px #33ff3333;
}
.btn:active {
background: #33ff3330;
}
.instructions {
max-width: 640px;
padding: 20px 24px;
text-align: center;
}
.instructions h2 {
font-size: 11px;
color: #33ff33;
margin-bottom: 14px;
}
.keys {
display: flex;
gap: 24px;
justify-content: center;
flex-wrap: wrap;
font-family: monospace;
font-size: 12px;
line-height: 1.8;
}
.keys .col {
text-align: left;
}
.key {
display: inline-block;
background: #1a1a1a;
border: 1px solid #333;
border-radius: 3px;
padding: 1px 7px;
font-size: 11px;
color: #e0e0e0;
min-width: 24px;
text-align: center;
}
.label {
color: #777;
font-size: 11px;
}
.loading-overlay {
position: absolute;
inset: 0;
background: #000;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
z-index: 10;
transition: opacity 0.4s;
}
.loading-overlay.hidden {
opacity: 0;
pointer-events: none;
}
.loading-text {
font-size: 12px;
color: #33ff33;
margin-bottom: 16px;
}
.progress-bar {
width: 200px;
height: 4px;
background: #1a1a1a;
border-radius: 2px;
overflow: hidden;
}
.progress-fill {
height: 100%;
background: #33ff33;
width: 0%;
transition: width 0.2s;
}
.footer {
padding: 16px 0 24px;
text-align: center;
font-family: monospace;
font-size: 10px;
color: #444;
}
.footer a {
color: #33ff3388;
text-decoration: none;
}
.footer a:hover {
color: #33ff33;
}
@media (max-width: 700px) {
.title { font-size: 20px; }
.header { padding: 16px 0 8px; }
}
</style>
</head>
<body>
<div class="header">
<div class="title">D I G G E R</div>
<div class="subtitle">REMASTERED — WINDMILL SOFTWARE 1983</div>
</div>
<div class="game-wrap" id="game-wrap">
<div class="loading-overlay" id="loading">
<div class="loading-text" id="status">Loading...</div>
<div class="progress-bar">
<div class="progress-fill" id="progress-fill"></div>
</div>
</div>
<canvas class="emscripten" id="canvas" oncontextmenu="event.preventDefault()" tabindex=-1></canvas>
</div>
<div class="controls-bar">
<button class="btn" id="btn-fullscreen">Alt-Enter FULLSCREEN</button>
<button class="btn" id="btn-settings">F11 SETTINGS</button>
</div>
<div class="instructions">
<h2>CONTROLS</h2>
<div class="keys">
<div class="col">
<span class="key">↑</span> <span class="key">↓</span> <span class="key">←</span> <span class="key">→</span> <span class="label">Move</span><br>
<span class="key">F1</span> <span class="label">Fire</span>
</div>
<div class="col">
<span class="key">F7</span> <span class="label">Music On/Off</span><br>
<span class="key">F9</span> <span class="label">Sound On/Off</span><br>
<span class="key">Space</span> <span class="label">Pause</span>
</div>
<div class="col">
<span class="key">N</span> <span class="label">Game Mode</span><br>
<span class="key">F10</span> <span class="label">Exit Game</span>
</div>
</div>
</div>
<div class="footer">
<a id="build-link" href="https://github.com/sobomax/digger">github</a>
</div>
<script src="digger-build-info.js"></script>
<script>
var buildLinkElement = document.getElementById('build-link');
var statusElement = document.getElementById('status');
var progressFill = document.getElementById('progress-fill');
var gameWrapElement = document.getElementById('game-wrap');
var loadingOverlay = document.getElementById('loading');
var canvasElement = document.getElementById('canvas');
var windowedCanvasWidth = 640;
var windowedCanvasHeight = 400;
var configureBuildLink = function() {
var buildInfo;
var linkText;
if (typeof window.getDiggerBuildInfo !== 'function') {
return;
}
buildInfo = window.getDiggerBuildInfo();
if (!buildInfo || !buildInfo.revision) {
return;
}
linkText = 'github @ ' + (buildInfo.shortRevision || buildInfo.revision);
if (buildInfo.dirty) {
linkText += ' dirty';
}
buildLinkElement.href = buildInfo.revisionUrl || buildLinkElement.href;
buildLinkElement.textContent = linkText;
};
configureBuildLink();
var restoreWindowedCanvasSize = function() {
canvasElement.style.removeProperty('width');
canvasElement.style.removeProperty('height');
gameWrapElement.style.removeProperty('width');
gameWrapElement.style.removeProperty('height');
if (Module.setCanvasSize) {
Module.setCanvasSize(windowedCanvasWidth, windowedCanvasHeight);
} else {
canvasElement.width = windowedCanvasWidth;
canvasElement.height = windowedCanvasHeight;
}
};
document.addEventListener('fullscreenchange', function() {
if (!document.fullscreenElement) {
restoreWindowedCanvasSize();
}
});
document.getElementById('btn-fullscreen').addEventListener('click', function() {
Module._digger_request_fullscreen();
canvasElement.focus();
});
document.getElementById('btn-settings').addEventListener('click', function() {
/* simulate F11 keypress */
canvasElement.dispatchEvent(new KeyboardEvent('keydown', {key: 'F11', code: 'F11', keyCode: 122, bubbles: true}));
canvasElement.focus();
});
var setStatus = function(text) {
if (!setStatus.last) setStatus.last = { time: Date.now(), text: '' };
if (text === setStatus.last.text) return;
var m = text.match(/([^(]+)\((\d+(\.\d+)?)\/(\d+)\)/);
var now = Date.now();
if (m && now - setStatus.last.time < 30) return;
setStatus.last.time = now;
setStatus.last.text = text;
if (m) {
var pct = (parseInt(m[2]) / parseInt(m[4])) * 100;
progressFill.style.width = pct + '%';
statusElement.textContent = m[1].trim() || 'Loading...';
} else {
if (!text) {
loadingOverlay.classList.add('hidden');
canvasElement.focus();
} else {
statusElement.textContent = text;
}
}
};
var Module = {
print: function() {
var text = Array.prototype.slice.call(arguments).join(' ');
console.log(text);
},
canvas: canvasElement,
setStatus: setStatus,
totalDependencies: 0,
monitorRunDependencies: function(left) {
this.totalDependencies = Math.max(this.totalDependencies, left);
setStatus(left
? 'Preparing... (' + (this.totalDependencies - left) + '/' + this.totalDependencies + ')'
: 'All downloads complete.');
}
};
setStatus('Downloading...');
window.onerror = function(event) {
statusElement.textContent = 'Error - see console';
setStatus = function(text) {
if (text) console.error('[post-exception] ' + text);
};
};
</script>
{{{ SCRIPT }}}
</body>
</html>