Angband
ui-term.h
Go to the documentation of this file.
1 
11 #ifndef INCLUDED_Z_TERM_H
12 #define INCLUDED_Z_TERM_H
13 
14 #include "h-basic.h"
15 #include "ui-event.h"
16 
17 
37 typedef struct term_win term_win;
38 
39 struct term_win
40 {
41  bool cu, cv;
42  int cx, cy;
43 
44  int **a;
45  wchar_t **c;
46 
47  int *va;
48  wchar_t *vc;
49 
50  int **ta;
51  wchar_t **tc;
52 
53  int *vta;
54  wchar_t *vtc;
55 
57 };
58 
59 
160 typedef struct term term;
161 
162 struct term
163 {
164  void *user;
165 
166  void *data;
167 
168  bool user_flag;
169 
170  bool data_flag;
171 
184 
186  wchar_t char_blank;
187 
189 
191 
196 
197  int wid;
198  int hgt;
199 
200  int y1;
201  int y2;
202 
203  int *x1;
204  int *x2;
205 
206  /* Offsets used by the map subwindows */
207  int offset_x;
208  int offset_y;
209 
212 
215 
216  /* Number of times saved */
218 
221 
222  errr (*xtra_hook)(int n, int v);
223 
224  errr (*curs_hook)(int x, int y);
225 
226  errr (*bigcurs_hook)(int x, int y);
227 
228  errr (*wipe_hook)(int x, int y, int n);
229 
230  errr (*text_hook)(int x, int y, int n, int a, const wchar_t *s);
231 
232  errr (*pict_hook)(int x, int y, int n, const int *ap, const wchar_t *cp, const int *tap, const wchar_t *tcp);
233 
235 
236 };
237 
238 
239 
240 
241 
251 #define ANGBAND_TERM_MAX 8
252 
256 #define SCREEN_ROWS (Term->hgt - ROW_MAP - 1)
257 
261 #define SCREEN_HGT ((int) (SCREEN_ROWS / tile_height))
262 
266 #define SCREEN_WID ((int)((Term->wid - COL_MAP - 1) / tile_width))
267 
268 #define ROW_MAP 1
269 #define COL_MAP 13
270 
271 
288 #define TERM_XTRA_EVENT 1 /* Process some pending events */
289 #define TERM_XTRA_FLUSH 2 /* Flush all pending events */
290 #define TERM_XTRA_CLEAR 3 /* Clear the entire window */
291 #define TERM_XTRA_SHAPE 4 /* Set cursor shape (optional) */
292 #define TERM_XTRA_FROSH 5 /* Flush one row (optional) */
293 #define TERM_XTRA_FRESH 6 /* Flush all rows (optional) */
294 #define TERM_XTRA_NOISE 7 /* Make a noise (optional) */
295 #define TERM_XTRA_BORED 9 /* Handle stuff when bored (optional) */
296 #define TERM_XTRA_REACT 10 /* React to global changes (optional) */
297 #define TERM_XTRA_ALIVE 11 /* Change the "hard" level (optional) */
298 #define TERM_XTRA_LEVEL 12 /* Change the "soft" level (optional) */
299 #define TERM_XTRA_DELAY 13 /* Delay some milliseconds (optional) */
300 
304 #define PW_INVEN 0x00000001L /* Display inven/equip */
305 #define PW_EQUIP 0x00000002L /* Display equip/inven */
306 #define PW_PLAYER_0 0x00000004L /* Display player (basic) */
307 #define PW_PLAYER_1 0x00000008L /* Display player (extra) */
308 #define PW_PLAYER_2 0x00000010L /* Display player (compact) */
309 #define PW_MAP 0x00000020L /* Display dungeon map */
310 #define PW_MESSAGE 0x00000040L /* Display messages */
311 #define PW_OVERHEAD 0x00000080L /* Display overhead view */
312 #define PW_MONSTER 0x00000100L /* Display monster recall */
313 #define PW_OBJECT 0x00000200L /* Display object recall */
314 #define PW_MONLIST 0x00000400L /* Display monster list */
315 #define PW_STATUS 0x00000800L /* Display status */
316 #define PW_ITEMLIST 0x00001000L /* Display item list */
317 
318 #define PW_MAX_FLAGS 16
319 
320 
324 #define KEYLOG_SIZE 8
325 extern int log_i;
326 extern int log_size;
327 extern struct keypress keylog[KEYLOG_SIZE];
328 
329 
335 extern term *Term;
336 extern byte tile_width;
337 extern byte tile_height;
338 extern bool bigcurs;
339 extern bool smlcurs;
341 extern char angband_term_name[ANGBAND_TERM_MAX][16];
343 
347 #define term_screen (angband_term[0])
348 
349 
350 
356 extern errr Term_xtra(int n, int v);
357 
358 extern void Term_queue_char(term *t, int x, int y, int a, wchar_t c, int ta, wchar_t tc);
359 extern void Term_big_queue_char(term *t, int x, int y, int a, wchar_t c, int a1, wchar_t c1);
360 extern void Term_queue_chars(int x, int y, int n, int a, const wchar_t *s);
361 
362 extern errr Term_fresh(void);
363 extern errr Term_set_cursor(bool v);
364 extern errr Term_gotoxy(int x, int y);
365 extern errr Term_draw(int x, int y, int a, wchar_t c);
366 extern errr Term_addch(int a, wchar_t c);
367 extern errr Term_addstr(int n, int a, const char *s);
368 extern errr Term_putch(int x, int y, int a, wchar_t c);
369 extern void Term_big_putch(int x, int y, int a, wchar_t c);
370 extern errr Term_putstr(int x, int y, int n, int a, const char *s);
371 extern errr Term_erase(int x, int y, int n);
372 extern errr Term_clear(void);
373 extern errr Term_redraw(void);
374 extern errr Term_redraw_section(int x1, int y1, int x2, int y2);
375 extern errr Term_mark(int x, int y);
376 
377 extern errr Term_get_cursor(bool *v);
378 extern errr Term_get_size(int *w, int *h);
379 extern errr Term_locate(int *x, int *y);
380 extern errr Term_what(int x, int y, int *a, wchar_t *c);
381 
382 extern errr Term_flush(void);
383 extern errr Term_mousepress(int x, int y, char button);
385 extern errr Term_key_push(int k);
386 extern errr Term_event_push(const ui_event *ke);
387 extern errr Term_inkey(ui_event *ch, bool wait, bool take);
388 
389 extern errr Term_save(void);
390 extern errr Term_load(void);
391 
392 extern errr Term_resize(int w, int h);
393 
394 extern errr Term_activate(term *t);
395 
396 extern errr term_nuke(term *t);
397 extern errr term_init(term *t, int w, int h, int k);
398 
399 extern int big_pad(int col, int row, byte a, wchar_t c);
400 
401 #endif /* INCLUDED_Z_TERM_H */