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

summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
Diffstat (limited to 'source')
-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