blob: 3827048033d57be7e659fffd881c37646f2e05b2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
|
#pragma once
#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(float dt) override;
bool sendEvent(InputEvent const& event) override;
void setCallback(WidgetCallbackFunc callback);
void setRightClickCallback(WidgetCallbackFunc callback);
void setMiddleClickCallback(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;
TextStyle m_textStyle;
WidgetCallbackFunc m_callback;
WidgetCallbackFunc m_rightClickCallback;
WidgetCallbackFunc m_middleClickCallback;
float m_progress;
ProgressWidgetPtr m_durabilityBar;
Animation m_newItemIndicator;
bool m_highlightEnabled;
Animation m_highlightAnimation;
};
}
|