This commit is contained in:
2025-12-08 11:28:44 +01:00
parent b750f320fc
commit 3336b59e7d
7 changed files with 155 additions and 8 deletions

123
src/utils/InventoryIcons.js Normal file
View File

@@ -0,0 +1,123 @@
// Simple 2D Flat Inventory Icons
class InventoryIcons {
static create(scene) {
const s = 48;
// Remove old textures
const items = ['item_axe', 'item_pickaxe', 'item_hoe', 'item_watering_can',
'item_wood', 'item_stone', 'item_seeds', 'item_wheat'];
items.forEach(key => {
if (scene.textures.exists(key)) scene.textures.remove(key);
});
// AXE - Simple flat brown handle + silver blade
const c1 = scene.textures.createCanvas('item_axe', s, s);
const ctx1 = c1.getContext();
ctx1.fillStyle = '#654321'; // handle
ctx1.fillRect(20, 6, 8, 36);
ctx1.fillStyle = '#C0C0C0'; // blade
ctx1.fillRect(8, 16, 32, 10);
ctx1.fillStyle = '#FFFFFF'; // shine
ctx1.fillRect(10, 18, 12, 3);
c1.refresh();
// PICKAXE - Brown handle + gray horizontal pick
const c2 = scene.textures.createCanvas('item_pickaxe', s, s);
const ctx2 = c2.getContext();
ctx2.fillStyle = '#654321';
ctx2.fillRect(20, 16, 8, 26);
ctx2.fillStyle = '#808080';
ctx2.fillRect(4, 20, 40, 8);
ctx2.fillRect(2, 22, 3, 4); // left point
ctx2.fillRect(43, 22, 3, 4); // right point
c2.refresh();
// HOE - L-shape (vertical handle + horizontal blade)
const c3 = scene.textures.createCanvas('item_hoe', s, s);
const ctx3 = c3.getContext();
ctx3.fillStyle = '#654321';
ctx3.fillRect(20, 12, 8, 30);
ctx3.fillStyle = '#808080';
ctx3.fillRect(20, 10, 22, 6);
c3.refresh();
// WATERING CAN - Blue can
const c4 = scene.textures.createCanvas('item_watering_can', s, s);
const ctx4 = c4.getContext();
ctx4.fillStyle = '#4682B4';
ctx4.fillRect(12, 20, 24, 18);
ctx4.strokeStyle = '#36648B';
ctx4.lineWidth = 4;
ctx4.beginPath();
ctx4.arc(24, 16, 10, 0, Math.PI, true);
ctx4.stroke();
ctx4.fillStyle = '#4682B4';
ctx4.fillRect(36, 26, 8, 4);
ctx4.fillStyle = '#00BFFF';
ctx4.fillRect(44, 30, 2, 2);
ctx4.fillRect(44, 34, 2, 2);
c4.refresh();
// WOOD - Brown log stack
const c5 = scene.textures.createCanvas('item_wood', s, s);
const ctx5 = c5.getContext();
for (let i = 0; i < 3; i++) {
ctx5.fillStyle = '#8B4513';
ctx5.fillRect(8 + i * 12, 14 + i * 7, 22, 12);
ctx5.fillStyle = '#D2691E';
ctx5.beginPath();
ctx5.arc(10 + i * 12, 20 + i * 7, 5, 0, Math.PI * 2);
ctx5.fill();
}
c5.refresh();
// STONE - Gray rock pile
const c6 = scene.textures.createCanvas('item_stone', s, s);
const ctx6 = c6.getContext();
ctx6.fillStyle = '#808080';
ctx6.beginPath();
ctx6.arc(18, 22, 11, 0, Math.PI * 2);
ctx6.fill();
ctx6.beginPath();
ctx6.arc(30, 20, 8, 0, Math.PI * 2);
ctx6.fill();
ctx6.beginPath();
ctx6.arc(24, 34, 9, 0, Math.PI * 2);
ctx6.fill();
c6.refresh();
// SEEDS - Beige seed packet
const c7 = scene.textures.createCanvas('item_seeds', s, s);
const ctx7 = c7.getContext();
ctx7.fillStyle = '#F5DEB3';
ctx7.fillRect(10, 8, 28, 34);
ctx7.fillStyle = '#228B22';
ctx7.fillRect(10, 30, 28, 10);
ctx7.fillStyle = '#8B7355';
for (let i = 0; i < 6; i++) {
ctx7.beginPath();
ctx7.arc(15 + (i % 3) * 9, 14 + Math.floor(i / 3) * 8, 2, 0, Math.PI * 2);
ctx7.fill();
}
c7.refresh();
// WHEAT - Golden wheat bundle
const c8 = scene.textures.createCanvas('item_wheat', s, s);
const ctx8 = c8.getContext();
ctx8.strokeStyle = '#DAA520';
ctx8.lineWidth = 3;
for (let i = 0; i < 5; i++) {
ctx8.beginPath();
ctx8.moveTo(16 + i * 4, 38);
ctx8.lineTo(16 + i * 4, 14);
ctx8.stroke();
}
ctx8.fillStyle = '#FFD700';
for (let i = 0; i < 5; i++) {
ctx8.fillRect(14 + i * 4, 10, 5, 10);
}
c8.refresh();
console.log('✅ 2D Flat inventory icons created!');
}
}