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

summaryrefslogtreecommitdiff
path: root/source/windowing/StarItemSlotWidget.hpp
diff options
context:
space:
mode:
authorKae <80987908+Novaenia@users.noreply.github.com>2023-06-20 14:33:09 +1000
committerKae <80987908+Novaenia@users.noreply.github.com>2023-06-20 14:33:09 +1000
commit6352e8e3196f78388b6c771073f9e03eaa612673 (patch)
treee23772f79a7fbc41bc9108951e9e136857484bf4 /source/windowing/StarItemSlotWidget.hpp
parent6741a057e5639280d85d0f88ba26f000baa58f61 (diff)
everything everywhere
all at once
Diffstat (limited to 'source/windowing/StarItemSlotWidget.hpp')
-rw-r--r--source/windowing/StarItemSlotWidget.hpp76
1 files changed, 76 insertions, 0 deletions
diff --git a/source/windowing/StarItemSlotWidget.hpp b/source/windowing/StarItemSlotWidget.hpp
new file mode 100644
index 0000000..c98afa0
--- /dev/null
+++ b/source/windowing/StarItemSlotWidget.hpp
@@ -0,0 +1,76 @@
+#ifndef STAR_ITEMSLOT_WIDGET_HPP
+#define STAR_ITEMSLOT_WIDGET_HPP
+
+#include "StarWidget.hpp"
+#include "StarProgressWidget.hpp"
+#include "StarAnimation.hpp"
+
+namespace Star {
+
+STAR_CLASS(Item);
+STAR_CLASS(ItemSlotWidget);
+
+static float const ItemIndicateNewTime = 1.5f;
+
+class ItemSlotWidget : public Widget {
+public:
+ ItemSlotWidget(ItemPtr const& item, String const& backingImage);
+
+ virtual void update() override;
+ bool sendEvent(InputEvent const& event) override;
+ void setCallback(WidgetCallbackFunc callback);
+ void setRightClickCallback(WidgetCallbackFunc callback);
+ void setItem(ItemPtr const& item);
+ ItemPtr item() const;
+ void setProgress(float progress);
+ void setBackingImageAffinity(bool full, bool empty);
+ void setCountPosition(TextPositioning textPositioning);
+ void setCountFontMode(FontMode fontMode);
+
+ void showDurability(bool show);
+ void showCount(bool show);
+ void showRarity(bool showRarity);
+ void showLinkIndicator(bool showLinkIndicator);
+
+ void indicateNew();
+
+ void setHighlightEnabled(bool highlight);
+
+protected:
+ virtual void renderImpl() override;
+
+private:
+ ItemPtr m_item;
+
+ String m_backingImage;
+ bool m_drawBackingImageWhenFull;
+ bool m_drawBackingImageWhenEmpty;
+ bool m_showDurability;
+ bool m_showCount;
+ bool m_showRarity;
+ bool m_showLinkIndicator;
+
+ TextPositioning m_countPosition;
+ FontMode m_countFontMode;
+
+ Vec2I m_durabilityOffset;
+ RectI m_itemDraggableArea;
+
+ int m_fontSize;
+ Color m_fontColor;
+
+ WidgetCallbackFunc m_callback;
+ WidgetCallbackFunc m_rightClickCallback;
+ float m_progress;
+
+ ProgressWidgetPtr m_durabilityBar;
+
+ Animation m_newItemIndicator;
+
+ bool m_highlightEnabled;
+ Animation m_highlightAnimation;
+};
+
+}
+
+#endif