haku2: add stats + fix crash w uninit vm

This commit is contained in:
りき萌 2025-06-16 16:39:54 +02:00
parent e667c6336a
commit 00a48527ca
12 changed files with 88 additions and 71 deletions

View file

@ -43,31 +43,22 @@ export class BrushCostGauges extends HTMLElement {
label: "Fuel",
}),
);
this.objectsGauge = this.appendChild(
createGauge({
className: "objects",
iconName: "object",
label: "Objects",
}),
);
this.memoryGauge = this.appendChild(
createGauge({
className: "memory",
iconName: "memory",
label: "Bulk memory",
label: "Memory",
}),
);
this.codeSizeGauge.setValue(0);
this.fuelGauge.setValue(0);
this.objectsGauge.setValue(0);
this.memoryGauge.setValue(0);
}
update(stats) {
this.codeSizeGauge.setValue(stats.astSize, stats.astSizeMax);
this.fuelGauge.setValue(stats.fuel, stats.fuelMax);
this.objectsGauge.setValue(stats.numRefs, stats.numRefsMax);
this.memoryGauge.setValue(stats.memory, stats.memoryMax);
}
}