Веб-сайт самохостера Lotigara

summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKae <80987908+Novaenia@users.noreply.github.com>2025-06-06 07:47:03 +1000
committerGitHub <noreply@github.com>2025-06-06 07:47:03 +1000
commitaa81f500ad664f9e339b01e3a9b341583197bad4 (patch)
tree4ec558ce53fd2832825e16a3b759e1be4054e17f
parent70c49e9ddbc719b2a84f832dae02c80b443fda02 (diff)
parentfbb8fa5c1a23aa6a90adb5d0c002bd8ffcfba3a7 (diff)
Merge pull request #260 from grbr404/item-count-chainges
Item count display chainges
-rw-r--r--source/windowing/StarItemSlotWidget.cpp29
1 files changed, 21 insertions, 8 deletions
diff --git a/source/windowing/StarItemSlotWidget.cpp b/source/windowing/StarItemSlotWidget.cpp
index 4ba3425..2d47d8a 100644
--- a/source/windowing/StarItemSlotWidget.cpp
+++ b/source/windowing/StarItemSlotWidget.cpp
@@ -185,16 +185,29 @@ void ItemSlotWidget::renderImpl() {
}
}
- int frame = (int)roundf(m_progress * 18); // TODO: Hardcoded lol
- context()->drawInterfaceQuad(String(strf("/interface/cooldown.png:{}", frame)), Vec2F(screenPosition()));
-
- if (m_item->count() > 1 && m_showCount) { // we don't need to tell people that there's only 1 of something
- context()->setTextStyle(m_textStyle);
- context()->setFontMode(m_countFontMode);
- context()->renderInterfaceText(toString(m_item->count()), m_countPosition.translated(Vec2F(screenPosition())));
- context()->clearTextStyle();
+if (m_item->count() > 1 && m_showCount) { // we don't need to tell people that there's only 1 of something
+ std::string formattedCount;
+
+ if (m_item->count() >= 1000000000000000) { // Quadrillion (q)
+ formattedCount = toString(m_item->count() / 1000000000000000) + "q";
+ } else if (m_item->count() >= 1000000000000) { // Trillion (t)
+ formattedCount = toString(m_item->count() / 1000000000000) + "t";
+ } else if (m_item->count() >= 1000000000) { // Billion (b)
+ formattedCount = toString(m_item->count() / 1000000000) + "b";
+ } else if (m_item->count() >= 1000000) { // Million (m)
+ formattedCount = toString(m_item->count() / 1000000) + "m";
+ } else if (m_item->count() >= 10000) { // Thousand (k)
+ formattedCount = toString(m_item->count() / 1000) + "k";
+ } else {
+ formattedCount = toString(m_item->count());
}
+ context()->setTextStyle(m_textStyle);
+ context()->setFontMode(m_countFontMode);
+ context()->renderInterfaceText(formattedCount, m_countPosition.translated(Vec2F(screenPosition())));
+ context()->clearTextStyle();
+}
+
} else if (m_drawBackingImageWhenEmpty && m_backingImage != "") {
context()->drawInterfaceQuad(m_backingImage, Vec2F(screenPosition()));
int frame = (int)roundf(m_progress * 18); // TODO: Hardcoded lol