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
+13 -13
View File
@@ -1,4 +1,4 @@
import { SLOT_SIZE, TEXTURE_SIZE } from "$/common/constants.ts";
import { SLOT_SIZE } from "$/common/constants.ts";
import { get_sprite_region } from "$/client/sprites.ts";
import { BlockRegistry, EverythingRegistry, ItemRegistry } from "$/common/everything_registry.ts";
import { AssetManager } from "$/client/assets.ts";
@@ -132,10 +132,10 @@ function draw_item_block(block_info: BlockRegistry, x: number, y: number) {
draw_texture_region_skewed(
atlas,
top.x * TEXTURE_SIZE,
top.y * TEXTURE_SIZE,
TEXTURE_SIZE,
TEXTURE_SIZE,
top.x,
top.y,
top.width,
top.height,
[
{ x: cx, y: cy - half_h },
{ x: cx + half_w, y: cy },
@@ -146,10 +146,10 @@ function draw_item_block(block_info: BlockRegistry, x: number, y: number) {
);
draw_texture_region_skewed(
atlas,
left.x * TEXTURE_SIZE,
left.y * TEXTURE_SIZE,
TEXTURE_SIZE,
TEXTURE_SIZE,
left.x,
left.y,
left.width,
left.height,
[
{ x: cx - half_w, y: cy },
{ x: cx, y: cy + half_h },
@@ -160,10 +160,10 @@ function draw_item_block(block_info: BlockRegistry, x: number, y: number) {
);
draw_texture_region_skewed(
atlas,
front.x * TEXTURE_SIZE,
front.y * TEXTURE_SIZE,
TEXTURE_SIZE,
TEXTURE_SIZE,
front.x,
front.y,
front.width,
front.height,
[
{ x: cx + half_w, y: cy },
{ x: cx, y: cy + half_h },