10 int display_rows
, display_cols
;
12 void display_beep(void)
17 static void get_screen_size (void) {
18 getmaxyx(stdscr
, display_rows
, display_cols
);
21 void display_setup(void)
36 void display_cleanup(void)
41 void display_moveto(int y
, int x
)
46 void display_refresh(void)
51 void display_write_str(char *str
)
56 void display_write_chars(char *str
, int len
)
58 waddnstr(stdscr
, str
, len
);
62 int attrs
[MAXCOLOURS
];
64 void display_define_colour(int colour
, int fg
, int bg
, int reverse
)
66 static int colours
[8] = {
77 if (fg
< 0 && bg
< 0) {
80 assert(colour
>= 0 && colour
< MAXCOLOURS
);
81 assert(!(bg
& ~7)); /* bold backgrounds are nonportable */
82 if (colour
< COLOR_PAIRS
-2) {
83 init_pair(colour
+1, colours
[fg
& 7], colours
[bg
]);
84 attrs
[colour
] = (fg
& 8 ? A_BOLD
: 0) | COLOR_PAIR(colour
+1);
86 /* can't allocate a colour pair, so we just use b&w attrs */
87 attrs
[colour
] = (fg
& 8 ? A_BOLD
: 0) | (reverse ? A_REVERSE
: 0);
92 void display_set_colour(int colour
)
94 wattrset(stdscr
, attrs
[colour
]);
97 void display_clear_to_eol(void)
102 int last_getch
= ERR
;
104 int display_getkey(void)
107 extern void schedule_update(void);
109 if (last_getch
!= ERR
) {
110 int ret
= last_getch
;
116 if (ret
== KEY_RESIZE
) {
124 int display_input_to_flush(void)
127 if (last_getch
!= ERR
)
140 void display_post_error(void)
142 /* I don't _think_ we need do anything here */
145 void display_recheck_size(void)