feat: items render as multi-cell pictures in graphics mode
- Item.shape() returns Vec<(dx, dy, color)> per type: Sword: 4-tall blade + crossguard + handle (6 cells) Dagger: blade + 2-cell handle (3 cells) Bow: curved arc + bowstring (4 cells) Leather/Plate Armor: 2x2 body shape (4 cells) Shield: 2x2 shield shape (4 cells) Health/Mana Potion: bottle with cork + body (4 cells) Food: 3-cell round shape Scroll: 3-cell horizontal scroll - Graphics renderer paints all shape cells per item - ASCII mode still uses 2-char glyph encoding in UI - Items in world have visual shape, not just single colored cell All 171 tests + 14 scenarios pass.
This commit is contained in:
@@ -800,9 +800,13 @@ impl GraphicsRenderer {
|
||||
for item in items.all() {
|
||||
let sx = item.x - cam_x;
|
||||
let sy = item.y - cam_y;
|
||||
if sx >= 0 && sx < self.grid_w as i32 && sy >= 0 && sy < self.grid_h as i32 {
|
||||
let idx = sy as usize * self.grid_w + sx as usize;
|
||||
item_color[idx] = [item.color()[0], item.color()[1], item.color()[2], 255];
|
||||
for (dx, dy, col) in item.shape() {
|
||||
let px = sx + dx;
|
||||
let py = sy + dy;
|
||||
if px >= 0 && px < self.grid_w as i32 && py >= 0 && py < self.grid_h as i32 {
|
||||
let idx = py as usize * self.grid_w + px as usize;
|
||||
item_color[idx] = [col[0], col[1], col[2], 255];
|
||||
}
|
||||
}
|
||||
}
|
||||
for e in entities.all() {
|
||||
|
||||
Reference in New Issue
Block a user