Spaces:
Running
Running
fix typo
Browse files- index.html +16 -16
- utility.js +1 -0
index.html
CHANGED
@@ -15,6 +15,22 @@
|
|
15 |
const glyphWidth = 32;
|
16 |
const glyphHeight = 40;
|
17 |
const glyphsAcrossTexture = 16;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
async function main() {
|
19 |
const adapter = await navigator.gpu?.requestAdapter();
|
20 |
const device = await adapter?.requestDevice();
|
@@ -225,22 +241,6 @@
|
|
225 |
|
226 |
requestAnimationFrame(render);
|
227 |
}
|
228 |
-
function generateGlyphTextureAtlas() {
|
229 |
-
const canvas = document.createElement('canvas');
|
230 |
-
canvas.width = 512;
|
231 |
-
canvas.height = 256;
|
232 |
-
const ctx = canvas.getContext('2d');
|
233 |
-
ctx.font = '32px monospace';
|
234 |
-
ctx.textBaseline = 'middle';
|
235 |
-
ctx.textAlign = 'center';
|
236 |
-
ctx.fillStyle = 'white';
|
237 |
-
for (let c = 33, x = 0, y = 0; c < 128; ++c) {
|
238 |
-
ctx.fillText(String.fromCodePoint(c), x + glyphWidth / 2, y + glyphHeight / 2);
|
239 |
-
x = (x + glyphWidth) % canvas.width;
|
240 |
-
if (x === 0) y += glyphHeight;
|
241 |
-
}
|
242 |
-
return canvas;
|
243 |
-
}
|
244 |
function fail(msg) {
|
245 |
alert(msg);
|
246 |
}
|
|
|
15 |
const glyphWidth = 32;
|
16 |
const glyphHeight = 40;
|
17 |
const glyphsAcrossTexture = 16;
|
18 |
+
function generateGlyphTextureAtlas() {
|
19 |
+
const canvas = document.createElement('canvas');
|
20 |
+
canvas.width = 512;
|
21 |
+
canvas.height = 256;
|
22 |
+
const ctx = canvas.getContext('2d');
|
23 |
+
ctx.font = '32px monospace';
|
24 |
+
ctx.textBaseline = 'middle';
|
25 |
+
ctx.textAlign = 'center';
|
26 |
+
ctx.fillStyle = 'white';
|
27 |
+
for (let c = 33, x = 0, y = 0; c < 128; ++c) {
|
28 |
+
ctx.fillText(String.fromCodePoint(c), x + glyphWidth / 2, y + glyphHeight / 2);
|
29 |
+
x = (x + glyphWidth) % canvas.width;
|
30 |
+
if (x === 0) y += glyphHeight;
|
31 |
+
}
|
32 |
+
return canvas;
|
33 |
+
}
|
34 |
async function main() {
|
35 |
const adapter = await navigator.gpu?.requestAdapter();
|
36 |
const device = await adapter?.requestDevice();
|
|
|
241 |
|
242 |
requestAnimationFrame(render);
|
243 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
244 |
function fail(msg) {
|
245 |
alert(msg);
|
246 |
}
|
utility.js
CHANGED
@@ -1 +1,2 @@
|
|
1 |
// utility.js
|
|
|
|
1 |
// utility.js
|
2 |
+
// Empty for now, will populate with functions later
|