00001
00002
00003
00004
00005
00006 #ifdef USE_TILE
00007 #ifndef TILEREG_DGN_H
00008 #define TILEREG_DGN_H
00009
00010 #include "tilereg.h"
00011 #include "tiledgnbuf.h"
00012 #include "viewgeom.h"
00013 #include <vector>
00014
00015 class mcache_entry;
00016
00017 struct TextTag
00018 {
00019 std::string tag;
00020 coord_def gc;
00021 };
00022
00023 bool tile_dungeon_tip(const coord_def &gc, std::string &tip);
00024 int tile_click_cell(const coord_def &gc, unsigned char mod);
00025
00026 class DungeonRegion : public TileRegion
00027 {
00028 public:
00029 DungeonRegion(const TileRegionInit &init);
00030 virtual ~DungeonRegion();
00031
00032 virtual void render();
00033 virtual void clear();
00034 virtual int handle_mouse(MouseEvent &event);
00035 virtual bool update_tip_text(std::string &tip);
00036 virtual bool update_alt_text(std::string &alt);
00037 virtual void on_resize();
00038
00039 void load_dungeon(const crawl_view_buffer &vbuf, const coord_def &gc);
00040 void place_cursor(cursor_type type, const coord_def &gc);
00041 bool on_screen(const coord_def &gc) const;
00042
00043 void clear_text_tags(text_tag_type type);
00044 void add_text_tag(text_tag_type type, const std::string &tag,
00045 const coord_def &gc);
00046
00047 const coord_def &get_cursor() const { return m_cursor[CURSOR_MOUSE]; }
00048
00049 void add_overlay(const coord_def &gc, int idx);
00050 void clear_overlays();
00051
00052 protected:
00053 void pack_buffers();
00054 void pack_cursor(cursor_type type, unsigned int tile);
00055
00056 void draw_minibars();
00057
00058 int get_buffer_index(const coord_def &gc);
00059 void to_screen_coords(const coord_def &gc, coord_def *pc) const;
00060
00061 crawl_view_buffer m_vbuf;
00062 int m_cx_to_gx;
00063 int m_cy_to_gy;
00064 coord_def m_cursor[CURSOR_MAX];
00065 coord_def m_last_clicked_grid;
00066 std::vector<TextTag> m_tags[TAG_MAX];
00067
00068 DungeonCellBuffer m_buf_dngn;
00069 ShapeBuffer m_buf_flash;
00070
00071 struct tile_overlay
00072 {
00073 coord_def gc;
00074 tileidx_t idx;
00075 };
00076 std::vector<tile_overlay> m_overlays;
00077 };
00078
00079 #endif
00080 #endif