Rename engine to cubi

This commit is contained in:
2026-11-03 17:17:37 -03:00
parent 68b78f053a
commit 98fa45ebd1
109 changed files with 643 additions and 788 deletions
+7 -7
View File
@@ -25,10 +25,10 @@ export interface TextureSize {
export const ATLAS_BORDER = 1;
// shelves, tallest first so each row wastes little, and by id when they're the same size so the same textures always
// give the same atlas. engine:missing is 16×16 and always there
// give the same atlas. cubi:missing is 16×16 and always there
export function atlas_layout(sizes: Map<string, TextureSize>): AtlasLayout {
const entries = [...sizes].filter(([id]) => id !== "engine:missing");
entries.push(["engine:missing", { width: TEXTURE_SIZE, height: TEXTURE_SIZE }]);
const entries = [...sizes].filter(([id]) => id !== "cubi:missing");
entries.push(["cubi:missing", { width: TEXTURE_SIZE, height: TEXTURE_SIZE }]);
entries.sort(([a, sa], [b, sb]) => sb.height - sa.height || sb.width - sa.width || a.localeCompare(b));
const area = entries.reduce(
@@ -76,8 +76,8 @@ export async function build_atlas(textures: Map<string, Uint8Array>, texture_jso
console.warn(`Texture ${id} isn't a png that can be shown, it will show as missing`);
}
}));
images.get("engine:missing")?.close();
images.delete("engine:missing");
images.get("cubi:missing")?.close();
images.delete("cubi:missing");
const animations = new Map<string, Animation>();
for (const [id, image] of images) {
@@ -95,7 +95,7 @@ export async function build_atlas(textures: Map<string, Uint8Array>, texture_jso
const ctx = canvas.getContext("2d")!;
// magenta and black checker
const missing = regions["engine:missing"];
const missing = regions["cubi:missing"];
const half = TEXTURE_SIZE / 2;
ctx.fillStyle = "magenta";
ctx.fillRect(missing.x, missing.y, half, half);
@@ -208,7 +208,7 @@ export async function engine_textures(): Promise<Map<string, Uint8Array>> {
const textures = new Map<string, Uint8Array>();
await Promise.all(names.map(async (name) => {
const response = await fetch(`/assets/textures/${name}.png`);
textures.set(`engine:${name}`, new Uint8Array(await response.arrayBuffer()));
textures.set(`cubi:${name}`, new Uint8Array(await response.arrayBuffer()));
}));
return textures;
}