the game where you go into mines and start crafting! but for consoles (forked directly from smartcmd's github)
1#pragma once
2#include "Screen.h"
3#include "ScrolledSelectionList.h"
4class ItemStat;
5
6class StatsScreen : public Screen
7{
8private:
9 static ItemRenderer *itemRenderer;
10
11protected:
12 static const int BUTTON_CANCEL_ID = 0;
13 static const int BUTTON_STATS_ID = 1;
14 static const int BUTTON_BLOCKITEMSTATS_ID = 2;
15 static const int BUTTON_ITEMSTATS_ID = 3;
16
17 Screen *lastScreen;
18 wstring title;
19public:
20 class GeneralStatisticsList;
21 class ItemStatisticsList;
22 class BlockStatisticsList;
23private:
24 GeneralStatisticsList *statsList;
25 ItemStatisticsList *itemStatsList;
26 BlockStatisticsList *blockStatsList;
27 StatsCounter *stats;
28
29 ScrolledSelectionList *activeList;
30
31public:
32 StatsScreen(Screen *lastScreen, StatsCounter *stats);
33 virtual void init();
34 virtual void postInit();
35protected:
36 virtual void buttonClicked(Button *button);
37public:
38 virtual void render(int xm, int ym, float a);
39
40 class GeneralStatisticsList : public ScrolledSelectionList
41 {
42 protected:
43 StatsScreen *parent;
44 public:
45 GeneralStatisticsList(StatsScreen *ss); // 4J - added parameter so we can access parent
46 virtual int getNumberOfItems();
47 virtual void selectItem(int item, bool doubleClick);
48 virtual bool isSelectedItem(int item);
49 virtual int getMaxPosition();
50 virtual void renderBackground();
51 virtual void renderItem(int i, int x, int y, int h, Tesselator *t);
52 };
53private:
54
55 static const float SLOT_TEX_SIZE;
56 static const int SLOT_BG_SIZE = 18;
57 static const int SLOT_STAT_HEIGHT = SLOT_BG_SIZE + 2;
58 static const int SLOT_BG_X = 1;
59 static const int SLOT_BG_Y = 1;
60 static const int SLOT_FG_X = 2;
61 static const int SLOT_FG_Y = 2;
62 static const int SLOT_LEFT_INSERT = 40;
63 static const int ROW_COL_1 = 2 + 113;
64 static const int ROW_COL_2 = 2 + 163;
65 static const int ROW_COL_3 = 2 + 213;
66 static const int SLOT_TEXT_OFFSET = 5;
67 static const int SORT_NONE = 0;
68 static const int SORT_DOWN = -1;
69 static const int SORT_UP = 1;
70
71 void blitSlot(int x, int y, int item);
72 void blitSlotBg(int x, int y);
73 void blitSlotIcon(int x, int y, int sx, int sy);
74
75 class StatisticsList : public ScrolledSelectionList
76 {
77 public:
78 StatsScreen *parent;
79 protected:
80 int headerPressed;
81 vector<ItemStat *> statItemList;
82// Comparator<ItemStat> itemStatSorter;
83
84 int sortColumn;
85 int sortOrder;
86 public:
87 StatisticsList(StatsScreen *ss); // 4J - added parameter so we can access parent
88 virtual void selectItem(int item, bool doubleClick);
89 virtual bool isSelectedItem(int item);
90 virtual void renderBackground();
91 virtual void renderHeader(int x, int y, Tesselator *t);
92 virtual void clickedHeader(int headerMouseX, int headerMouseY);
93 virtual int getNumberOfItems();
94 ItemStat *getSlotStat(int slot);
95 virtual wstring getHeaderDescriptionId(int column) = 0;
96 virtual void renderStat(ItemStat *stat, int x, int y, bool shaded);
97 virtual void renderDecorations(int mouseX, int mouseY);
98 virtual void renderMousehoverTooltip(ItemStat *stat, int x, int y);
99 virtual void sortByColumn(int column);
100 };
101
102public:
103 class ItemStatisticsList : public StatisticsList
104 {
105
106 private:
107 static const int COLUMN_DEPLETED = 0;
108 static const int COLUMN_CRAFTED = 1;
109 static const int COLUMN_USED = 2;
110
111 public:
112 ItemStatisticsList(StatsScreen *ss); // 4J - added parameter so we can access parent
113 virtual void renderHeader(int x, int y, Tesselator *t);
114 virtual void renderItem(int i, int x, int y, int h, Tesselator *t);
115 virtual wstring getHeaderDescriptionId(int column);
116 };
117
118 class BlockStatisticsList : public StatisticsList
119 {
120
121 private:
122 static const int COLUMN_CRAFTED = 0;
123 static const int COLUMN_USED = 1;
124 static const int COLUMN_MINED = 2;
125
126 public:
127 BlockStatisticsList(StatsScreen *ss); // 4J - added parameter so we can access parent
128 virtual void renderHeader(int x, int y, Tesselator *t);
129 virtual void renderItem(int i, int x, int y, int h, Tesselator *t);
130 virtual wstring getHeaderDescriptionId(int column);
131 };
132
133};