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
|
#ifdef USE_TILE_LOCAL
#ifndef TILEREG_GRID_H
#define TILEREG_GRID_H
#include "tiledgnbuf.h"
#include "tilereg.h"
class InventoryTile
{
public:
InventoryTile();
// tile index
tileidx_t tile;
// mitm/you.inv idx (depends on flag & TILEI_FLAG_FLOOR)
int idx;
// quantity of this item (0-999 valid, >999 shows as 999, <0 shows nothing)
short quantity;
// bitwise-or of TILEI_FLAG enumeration
unsigned short flag;
// for inventory items, the slot
char key;
// a special property, such as for brands
int special;
bool empty() const;
};
class GridRegion : public TileRegion
{
public:
GridRegion(const TileRegionInit &init);
virtual ~GridRegion();
virtual void clear();
virtual void render();
virtual void on_resize();
virtual void update() = 0;
void place_cursor(const coord_def &cursor);
virtual const string name() const = 0;
virtual bool update_tab_tip_text(string &tip, bool active) = 0;
virtual void activate() = 0;
protected:
virtual void pack_buffers() = 0;
virtual void draw_tag() = 0;
// Place the cursor and set idx with the index into m_items of the click.
// If click was invalid, return false.
bool place_cursor(MouseEvent &event, unsigned int &idx);
unsigned int cursor_index() const;
int add_quad_char(char c, int x, int y, int ox, int oy,
bool outline = false);
void draw_number(int x, int y, int number, bool outline = false);
void draw_desc(const char *desc);
unsigned char *m_flavour;
coord_def m_cursor;
int m_last_clicked_item;
int m_grid_page;
vector<InventoryTile> m_items;
DungeonCellBuffer m_buf;
};
#endif
#endif
|