Allow for textures that aren't 16x16

This commit is contained in:
2026-09-28 16:20:37 -03:00
parent 52ef4e5ca6
commit fe149bb9ad
18 changed files with 268 additions and 136 deletions
+3 -2
View File
@@ -1,9 +1,10 @@
import { SpriteRegion } from "$/common/constants.ts";
import { type SpriteRegion, TEXTURE_SIZE } from "$/common/constants.ts";
import { AssetManager } from "./assets.ts";
type TexturesInfo = Record<string, SpriteRegion>;
export function get_sprite_region(id: string): SpriteRegion {
const textures_info = AssetManager.instance.get<TexturesInfo>("bworld:textures_info");
return textures_info?.[id] ?? { x: 0, y: 0 };
return textures_info?.[id] ?? textures_info?.["engine:missing"] ??
{ x: 0, y: 0, width: TEXTURE_SIZE, height: TEXTURE_SIZE };
}