Skip to content

Commit 87fd628

Browse files
committed
Deploying to gh-pages from @ d60355b 🚀
1 parent c0a940f commit 87fd628

9 files changed

+105
-11
lines changed

index.apple-touch-icon.png

1.99 KB
Loading

index.audio.position.worklet.js

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
/**************************************************************************/
2+
/* godot.audio.position.worklet.js */
3+
/**************************************************************************/
4+
/* This file is part of: */
5+
/* GODOT ENGINE */
6+
/* https://godotengine.org */
7+
/**************************************************************************/
8+
/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
9+
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
10+
/* */
11+
/* Permission is hereby granted, free of charge, to any person obtaining */
12+
/* a copy of this software and associated documentation files (the */
13+
/* "Software"), to deal in the Software without restriction, including */
14+
/* without limitation the rights to use, copy, modify, merge, publish, */
15+
/* distribute, sublicense, and/or sell copies of the Software, and to */
16+
/* permit persons to whom the Software is furnished to do so, subject to */
17+
/* the following conditions: */
18+
/* */
19+
/* The above copyright notice and this permission notice shall be */
20+
/* included in all copies or substantial portions of the Software. */
21+
/* */
22+
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
23+
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
24+
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
25+
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
26+
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
27+
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
28+
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
29+
/**************************************************************************/
30+
31+
const POST_THRESHOLD_S = 0.1;
32+
33+
class GodotPositionReportingProcessor extends AudioWorkletProcessor {
34+
constructor(...args) {
35+
super(...args);
36+
this.lastPostTime = currentTime;
37+
this.position = 0;
38+
this.ended = false;
39+
40+
this.port.onmessage = (event) => {
41+
if (event?.data?.type === 'ended') {
42+
this.ended = true;
43+
}
44+
};
45+
}
46+
47+
process(inputs, _outputs, _parameters) {
48+
if (this.ended) {
49+
return false;
50+
}
51+
52+
if (inputs.length > 0) {
53+
const input = inputs[0];
54+
if (input.length > 0) {
55+
this.position += input[0].length;
56+
}
57+
}
58+
59+
// Posting messages is expensive. Let's limit the number of posts.
60+
if (currentTime - this.lastPostTime > POST_THRESHOLD_S) {
61+
this.lastPostTime = currentTime;
62+
this.port.postMessage({ type: 'position', data: this.position });
63+
}
64+
65+
return true;
66+
}
67+
}
68+
69+
registerProcessor('godot-position-reporting-processor', GodotPositionReportingProcessor);

index.html

Lines changed: 28 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,20 @@
5252
margin: auto;
5353
}
5454

55+
#status-splash.show-image--false {
56+
display: none;
57+
}
58+
59+
#status-splash.fullsize--true {
60+
height: 100%;
61+
width: 100%;
62+
object-fit: contain;
63+
}
64+
65+
#status-splash.use-filter--false {
66+
image-rendering: pixelated;
67+
}
68+
5569
#status-progress, #status-notice {
5670
display: none;
5771
}
@@ -90,14 +104,14 @@
90104
</noscript>
91105

92106
<div id="status">
93-
<img id="status-splash" src="index.png" alt="">
107+
<img id="status-splash" class="show-image--true fullsize--true use-filter--true" src="index.png" alt="">
94108
<progress id="status-progress"></progress>
95109
<div id="status-notice"></div>
96110
</div>
97111

98112
<script src="index.js"></script>
99113
<script>
100-
const GODOT_CONFIG = {"args":[],"canvasResizePolicy":2,"ensureCrossOriginIsolationHeaders":true,"executable":"index","experimentalVK":false,"fileSizes":{"index.pck":117264,"index.wasm":1620216},"focusCanvas":true,"gdextensionLibs":["libgdsqlite.web.template_release.wasm32.nothreads.wasm"]};
114+
const GODOT_CONFIG = {"args":[],"canvasResizePolicy":2,"ensureCrossOriginIsolationHeaders":true,"executable":"index","experimentalVK":false,"fileSizes":{"index.pck":117200,"index.wasm":1625538},"focusCanvas":true,"gdextensionLibs":["libgdsqlite.web.template_release.wasm32.nothreads.wasm"]};
101115
const GODOT_THREADS_ENABLED = false;
102116
const engine = new Engine(GODOT_CONFIG);
103117

@@ -142,7 +156,7 @@
142156
} else if (typeof err === 'string') {
143157
setStatusNotice(err);
144158
} else {
145-
setStatusNotice('An unknown error occured');
159+
setStatusNotice('An unknown error occurred.');
146160
}
147161
setStatusMode('notice');
148162
initializing = false;
@@ -154,9 +168,15 @@
154168

155169
if (missing.length !== 0) {
156170
if (GODOT_CONFIG['serviceWorker'] && GODOT_CONFIG['ensureCrossOriginIsolationHeaders'] && 'serviceWorker' in navigator) {
171+
let serviceWorkerRegistrationPromise;
172+
try {
173+
serviceWorkerRegistrationPromise = navigator.serviceWorker.getRegistration();
174+
} catch (err) {
175+
serviceWorkerRegistrationPromise = Promise.reject(new Error('Service worker registration failed.'));
176+
}
157177
// There's a chance that installing the service worker would fix the issue
158178
Promise.race([
159-
navigator.serviceWorker.getRegistration().then((registration) => {
179+
serviceWorkerRegistrationPromise.then((registration) => {
160180
if (registration != null) {
161181
return Promise.reject(new Error('Service worker already exists.'));
162182
}
@@ -166,10 +186,11 @@
166186
new Promise((resolve) => {
167187
setTimeout(() => resolve(), 2000);
168188
}),
169-
]).catch((err) => {
170-
console.error('Error while registering service worker:', err);
171-
}).then(() => {
189+
]).then(() => {
190+
// Reload if there was no error.
172191
window.location.reload();
192+
}).catch((err) => {
193+
console.error('Error while registering service worker:', err);
173194
});
174195
} else {
175196
// Display the message as usual

index.icon.png

1.85 KB
Loading

index.js

Lines changed: 8 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

index.pck

-64 Bytes
Binary file not shown.

index.side.wasm

8.22 MB
Binary file not shown.

index.wasm

5.2 KB
Binary file not shown.
41.1 KB
Binary file not shown.

0 commit comments

Comments
 (0)