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

summaryrefslogtreecommitdiff
path: root/source/windowing/StarItemSlotWidget.cpp
diff options
context:
space:
mode:
authorKae <80987908+Novaenia@users.noreply.github.com>2024-04-22 06:07:59 +1000
committerKae <80987908+Novaenia@users.noreply.github.com>2024-04-22 06:07:59 +1000
commitca1426eabc873f781eb0dd389d45634b7d183250 (patch)
tree15ea83658ca3824232f14fe4b32ec714e0aa05c6 /source/windowing/StarItemSlotWidget.cpp
parentd5f5fb5ddf0d4a9f0b0e6ac012121926d2fcd949 (diff)
Lua chat callbacks + better font styling
golly gee whiz!! i hope i didn't fuck something up
Diffstat (limited to 'source/windowing/StarItemSlotWidget.cpp')
-rw-r--r--source/windowing/StarItemSlotWidget.cpp12
1 files changed, 3 insertions, 9 deletions
diff --git a/source/windowing/StarItemSlotWidget.cpp b/source/windowing/StarItemSlotWidget.cpp
index 93d95d3..4ba3425 100644
--- a/source/windowing/StarItemSlotWidget.cpp
+++ b/source/windowing/StarItemSlotWidget.cpp
@@ -14,16 +14,13 @@ ItemSlotWidget::ItemSlotWidget(ItemPtr const& item, String const& backingImage)
: m_item(item), m_backingImage(backingImage) {
m_drawBackingImageWhenFull = false;
m_drawBackingImageWhenEmpty = true;
- m_fontSize = 0;
m_progress = 1;
auto assets = Root::singleton().assets();
auto interfaceConfig = assets->json("/interface.config");
m_countPosition = TextPositioning(jsonToVec2F(interfaceConfig.get("itemCountRightAnchor")), HorizontalAnchor::RightAnchor);
m_countFontMode = FontMode::Normal;
- m_fontSize = interfaceConfig.query("font.itemSize").toInt();
- m_font = interfaceConfig.query("font.defaultFont").toString();
- m_fontColor = Color::rgb(jsonToVec3B(interfaceConfig.query("font.defaultColor")));
+ m_textStyle = interfaceConfig.get("itemSlotTextStyle");
m_itemDraggableArea = jsonToRectI(interfaceConfig.get("itemDraggableArea"));
m_durabilityOffset = jsonToVec2I(interfaceConfig.get("itemIconDurabilityOffset"));
@@ -192,13 +189,10 @@ void ItemSlotWidget::renderImpl() {
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()->setFont(m_font);
- context()->setFontSize(m_fontSize);
- context()->setFontColor(m_fontColor.toRgba());
+ context()->setTextStyle(m_textStyle);
context()->setFontMode(m_countFontMode);
context()->renderInterfaceText(toString(m_item->count()), m_countPosition.translated(Vec2F(screenPosition())));
- context()->setFontMode(FontMode::Normal);
- context()->setDefaultFont();
+ context()->clearTextStyle();
}
} else if (m_drawBackingImageWhenEmpty && m_backingImage != "") {