diff options
Diffstat (limited to 'source')
-rw-r--r-- | source/windowing/StarItemSlotWidget.cpp | 36 |
1 files changed, 29 insertions, 7 deletions
diff --git a/source/windowing/StarItemSlotWidget.cpp b/source/windowing/StarItemSlotWidget.cpp index 4ba3425..232f5e1 100644 --- a/source/windowing/StarItemSlotWidget.cpp +++ b/source/windowing/StarItemSlotWidget.cpp @@ -185,16 +185,38 @@ 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 + std::string formattedCount; + + if (m_item->count() >= 1000000000000000000000) { // Sextillion (S) + formattedCount = toString(m_item->count() / 1000000000000000000000) + "S"; + } else if (m_item->count() >= 1000000000000000000) { // Quintillion (Q) + formattedCount = toString(m_item->count() / 1000000000000000000) + "Q"; + } else 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() >= 1000) { // Thousand (k) + formattedCount = toString(m_item->count() / 1000) + "k"; + } else { + formattedCount = toString(m_item->count()); + } - 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(); + // Ensure formatted count is at most 4 characters long + if (formattedCount.length() > 4) { + formattedCount = formattedCount.substr(0, 4); } + 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 |