summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/tilereg-grid.h
diff options
context:
space:
mode:
authorEnne Walker <ennewalker@users.sourceforge.net>2010-04-19 20:00:06 -0400
committerEnne Walker <ennewalker@users.sourceforge.net>2010-04-25 19:33:13 -0400
commit8305dc11a61b732984b4bf2a2f8c8f48af84630e (patch)
tree9f605e327b60ab79111ae7c25bec938ed2261a0b /crawl-ref/source/tilereg-grid.h
parentedacdc0db313c0f5385631dfcf560f1fdf8e7c8a (diff)
downloadcrawl-ref-8305dc11a61b732984b4bf2a2f8c8f48af84630e.tar.gz
crawl-ref-8305dc11a61b732984b4bf2a2f8c8f48af84630e.zip
Split tilereg.h/cc into multiple files.
No functional changes, just rearranging and exposing functions where needed.
Diffstat (limited to 'crawl-ref/source/tilereg-grid.h')
-rw-r--r--crawl-ref/source/tilereg-grid.h74
1 files changed, 74 insertions, 0 deletions
diff --git a/crawl-ref/source/tilereg-grid.h b/crawl-ref/source/tilereg-grid.h
new file mode 100644
index 0000000000..fc8a551a6a
--- /dev/null
+++ b/crawl-ref/source/tilereg-grid.h
@@ -0,0 +1,74 @@
+/*
+ * File: tilereg_grid.h
+ * Created by: ennewalker on Sat Jan 5 01:33:53 2008 UTC
+ */
+
+#ifdef USE_TILE
+#ifndef TILEREG_GRID_H
+#define TILEREG_GRID_H
+
+#include "tilereg.h"
+
+class InventoryTile
+{
+public:
+ InventoryTile();
+
+ // tile index
+ int 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 std::string name() const = 0;
+ virtual bool update_tab_tip_text(std::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;
+ void add_quad_char(char c, int x, int y, int ox, int oy);
+ void draw_number(int x, int y, int number);
+ void draw_desc(const char *desc);
+
+ unsigned char *m_flavour;
+ coord_def m_cursor;
+
+ std::vector<InventoryTile> m_items;
+
+ TileBuffer m_buf_dngn;
+ TileBuffer m_buf_spells;
+ TileBuffer m_buf_main;
+ TileBuffer m_buf_doll;
+};
+
+#endif
+#endif