add ItemStack::fields

This commit is contained in:
MihailRis
2025-02-15 20:30:22 +03:00
parent fd8c26d585
commit d86c5508d2
5 changed files with 85 additions and 29 deletions
+17 -8
View File
@@ -186,17 +186,26 @@ void SlotView::draw(const DrawContext& pctx, const Assets& assets) {
}
}
if (stack.getCount() > 1) {
if (stack.getCount() > 1 || stack.getFields() != nullptr) {
auto font = assets.get<Font>("normal");
std::wstring text = std::to_wstring(stack.getCount());
if (stack.getCount() > 1) {
std::wstring text = std::to_wstring(stack.getCount());
int x = pos.x+slotSize-text.length()*8;
int y = pos.y+slotSize-16;
int x = pos.x+slotSize-text.length()*8;
int y = pos.y+slotSize-16;
batch->setColor({0, 0, 0, 1.0f});
font->draw(*batch, text, x+1, y+1, nullptr, 0);
batch->setColor(glm::vec4(1.0f));
font->draw(*batch, text, x, y, nullptr, 0);
batch->setColor({0, 0, 0, 1.0f});
font->draw(*batch, text, x+1, y+1, nullptr, 0);
batch->setColor(glm::vec4(1.0f));
font->draw(*batch, text, x, y, nullptr, 0);
}
if (stack.getFields() != nullptr) {
batch->setColor({0, 0, 0, 1.0f});
font->draw(*batch, L"#", pos.x+1, pos.y+1, nullptr, 0);
batch->setColor(glm::vec4(1.0f));
font->draw(*batch, L"#", pos.x, pos.y, nullptr, 0);
}
}
}