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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
|
#pragma once
#include "Screen.h"
#include "ScrolledSelectionList.h"
class ItemStat;
class StatsScreen : public Screen
{
private:
static ItemRenderer *itemRenderer;
protected:
static const int BUTTON_CANCEL_ID = 0;
static const int BUTTON_STATS_ID = 1;
static const int BUTTON_BLOCKITEMSTATS_ID = 2;
static const int BUTTON_ITEMSTATS_ID = 3;
Screen *lastScreen;
wstring title;
public:
class GeneralStatisticsList;
class ItemStatisticsList;
class BlockStatisticsList;
private:
GeneralStatisticsList *statsList;
ItemStatisticsList *itemStatsList;
BlockStatisticsList *blockStatsList;
StatsCounter *stats;
ScrolledSelectionList *activeList;
public:
StatsScreen(Screen *lastScreen, StatsCounter *stats);
virtual void init();
virtual void postInit();
protected:
virtual void buttonClicked(Button *button);
public:
virtual void render(int xm, int ym, float a);
class GeneralStatisticsList : public ScrolledSelectionList
{
protected:
StatsScreen *parent;
public:
GeneralStatisticsList(StatsScreen *ss); // 4J - added parameter so we can access parent
virtual int getNumberOfItems();
virtual void selectItem(int item, bool doubleClick);
virtual bool isSelectedItem(int item);
virtual int getMaxPosition();
virtual void renderBackground();
virtual void renderItem(int i, int x, int y, int h, Tesselator *t);
};
private:
static const float SLOT_TEX_SIZE;
static const int SLOT_BG_SIZE = 18;
static const int SLOT_STAT_HEIGHT = SLOT_BG_SIZE + 2;
static const int SLOT_BG_X = 1;
static const int SLOT_BG_Y = 1;
static const int SLOT_FG_X = 2;
static const int SLOT_FG_Y = 2;
static const int SLOT_LEFT_INSERT = 40;
static const int ROW_COL_1 = 2 + 113;
static const int ROW_COL_2 = 2 + 163;
static const int ROW_COL_3 = 2 + 213;
static const int SLOT_TEXT_OFFSET = 5;
static const int SORT_NONE = 0;
static const int SORT_DOWN = -1;
static const int SORT_UP = 1;
void blitSlot(int x, int y, int item);
void blitSlotBg(int x, int y);
void blitSlotIcon(int x, int y, int sx, int sy);
class StatisticsList : public ScrolledSelectionList
{
public:
StatsScreen *parent;
protected:
int headerPressed;
vector<ItemStat *> statItemList;
// Comparator<ItemStat> itemStatSorter;
int sortColumn;
int sortOrder;
public:
StatisticsList(StatsScreen *ss); // 4J - added parameter so we can access parent
virtual void selectItem(int item, bool doubleClick);
virtual bool isSelectedItem(int item);
virtual void renderBackground();
virtual void renderHeader(int x, int y, Tesselator *t);
virtual void clickedHeader(int headerMouseX, int headerMouseY);
virtual int getNumberOfItems();
ItemStat *getSlotStat(int slot);
virtual wstring getHeaderDescriptionId(int column) = 0;
virtual void renderStat(ItemStat *stat, int x, int y, bool shaded);
virtual void renderDecorations(int mouseX, int mouseY);
virtual void renderMousehoverTooltip(ItemStat *stat, int x, int y);
virtual void sortByColumn(int column);
};
public:
class ItemStatisticsList : public StatisticsList
{
private:
static const int COLUMN_DEPLETED = 0;
static const int COLUMN_CRAFTED = 1;
static const int COLUMN_USED = 2;
public:
ItemStatisticsList(StatsScreen *ss); // 4J - added parameter so we can access parent
virtual void renderHeader(int x, int y, Tesselator *t);
virtual void renderItem(int i, int x, int y, int h, Tesselator *t);
virtual wstring getHeaderDescriptionId(int column);
};
class BlockStatisticsList : public StatisticsList
{
private:
static const int COLUMN_CRAFTED = 0;
static const int COLUMN_USED = 1;
static const int COLUMN_MINED = 2;
public:
BlockStatisticsList(StatsScreen *ss); // 4J - added parameter so we can access parent
virtual void renderHeader(int x, int y, Tesselator *t);
virtual void renderItem(int i, int x, int y, int h, Tesselator *t);
virtual wstring getHeaderDescriptionId(int column);
};
};
|