3 * Summary: SDL-related functionality for the tiles port
4 * Written by: Enne Walker
17 class CRTRegionSingleSelect
;
22 class InventoryRegion
;
40 typedef std::map
<int, TabbedRegion
*>::iterator tab_iterator
;
59 enum mouse_event_button
69 // Padding for ui_event
73 mouse_event_type event
;
74 // if PRESS or RELEASE, the button pressed
75 mouse_event_button button
;
76 // bitwise-or of buttons currently pressed
78 // bitwise-or of key mods currently pressed
80 // location of events in pixels and in window coordinate space
86 class crawl_view_buffer
;
92 virtual ~TilesFramework();
96 void load_dungeon(const crawl_view_buffer
&vbuf
, const coord_def
&gc
);
97 void load_dungeon(const coord_def
&gc
);
100 void layout_statcol();
101 void calculate_default_options();
104 void cgotoxy(int x
, int y
, GotoRegion region
= GOTO_CRT
);
105 GotoRegion
get_cursor_region() const;
106 int get_number_of_lines();
107 int get_number_of_cols();
109 void update_minimap(const coord_def
&gc
);
110 void clear_minimap();
111 void update_minimap_bounds();
112 void toggle_inventory_display();
115 void set_need_redraw(unsigned int min_tick_delay
= 0);
116 bool need_redraw() const;
119 void place_cursor(cursor_type type
, const coord_def
&gc
);
120 void clear_text_tags(text_tag_type type
);
121 void add_text_tag(text_tag_type type
, const std::string
&tag
,
122 const coord_def
&gc
);
123 void add_text_tag(text_tag_type type
, const monster
* mon
);
125 bool initialise_items();
127 const coord_def
&get_cursor() const;
129 void add_overlay(const coord_def
&gc
, tileidx_t idx
);
130 void clear_overlays();
133 void update_title_msg(std::string load_msg
);
136 void draw_doll_edit();
138 MenuRegion
*get_menu() { return m_region_menu
; }
139 bool is_fullscreen() { return m_fullscreen
; }
141 FontWrapper
* get_crt_font() { return m_fonts
.at(m_crt_font
).font
; }
142 CRTRegion
* get_crt() { return m_region_crt
; }
143 const ImageManager
* get_image_manager() { return m_image
; }
144 int to_lines(int num_tiles
);
146 int load_font(const char *font_file
, int font_size
,
147 bool default_on_fail
, bool outline
);
148 int handle_mouse(MouseEvent
&event
);
150 void use_control_region(ControlRegion
*region
);
152 // screen pixel dimensions
153 coord_def m_windowsz
;
154 // screen pixels per view cell
182 // Layers don't own these regions
183 std::vector
<Region
*> m_regions
;
185 Layer m_layers
[LAYER_MAX
];
186 LayerID m_active_layer
;
189 TileRegionInit m_init
;
190 DungeonRegion
*m_region_tile
;
191 StatRegion
*m_region_stat
;
192 MessageRegion
*m_region_msg
;
193 MapRegion
*m_region_map
;
194 TabbedRegion
*m_region_tab
;
195 InventoryRegion
*m_region_inv
;
196 SpellRegion
*m_region_spl
;
197 MemoriseRegion
*m_region_mem
;
198 MonsterRegion
*m_region_mon
;
199 SkillRegion
*m_region_skl
;
200 CommandRegion
*m_region_cmd
;
202 std::map
<int, TabbedRegion
*> m_tabs
;
204 // Full-screen CRT layer
205 CRTRegion
*m_region_crt
;
206 MenuRegion
*m_region_menu
;
215 std::vector
<font_info
> m_fonts
;
223 int m_stat_x_divider
;
225 int m_statcol_bottom
;
229 int calc_tab_lines(const int num_elements
);
230 void place_tab(int idx
);
231 void autosize_minimap();
232 void place_minimap();
233 void resize_inventory();
234 void place_gold_turns();
236 ImageManager
*m_image
;
239 unsigned short m_buttons_held
;
240 unsigned char m_key_mod
;
242 unsigned int m_last_tick_moved
;
243 unsigned int m_last_tick_redraw
;
245 std::string m_tooltip
;
252 cursor_loc() { reset(); }
253 void reset() { reg
= NULL
; cx
= cy
= -1; mode
= MOUSE_MODE_MAX
; }
254 bool operator==(const cursor_loc
&rhs
) const
256 return (rhs
.reg
== reg
259 && rhs
.mode
== mode
);
261 bool operator!=(const cursor_loc
&rhs
) const
263 return !(*this == rhs
);
270 cursor_loc m_cur_loc
;
273 // Main interface for tiles functions
274 extern TilesFramework tiles
;
276 #ifdef TARGET_COMPILER_MINGW
278 // Srsly, MinGW, wtf?
279 void *alloca(size_t);