Allow for textures that aren't 16x16
This commit is contained in:
+3
-2
@@ -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 };
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user