11 int display_rows
, display_cols
;
13 void display_beep(void)
18 static void get_screen_size (void) {
19 getmaxyx(stdscr
, display_rows
, display_cols
);
22 void display_setup(void)
37 void display_cleanup(void)
42 void display_moveto(int y
, int x
)
47 void display_refresh(void)
52 void display_write_str(char *str
)
57 void display_write_chars(char *str
, int len
)
59 waddnstr(stdscr
, str
, len
);
63 int attrs
[MAXCOLOURS
];
65 void display_define_colour(int colour
, int fg
, int bg
, int reverse
)
67 static int colours
[8] = {
78 if (fg
< 0 && bg
< 0) {
81 assert(colour
>= 0 && colour
< MAXCOLOURS
);
82 assert(!(bg
& ~7)); /* bold backgrounds are nonportable */
83 if (colour
< COLOR_PAIRS
-2) {
84 init_pair(colour
+1, colours
[fg
& 7], colours
[bg
]);
85 attrs
[colour
] = (fg
& 8 ? A_BOLD
: 0) | COLOR_PAIR(colour
+1);
87 /* can't allocate a colour pair, so we just use b&w attrs */
88 attrs
[colour
] = (fg
& 8 ? A_BOLD
: 0) | (reverse ? A_REVERSE
: 0);
93 void display_set_colour(int colour
)
95 wattrset(stdscr
, attrs
[colour
]);
98 void display_clear_to_eol(void)
103 int last_getch
= ERR
;
105 int display_getkey(void)
108 extern void schedule_update(void);
110 if (last_getch
!= ERR
) {
111 int ret
= last_getch
;
117 if (ret
== KEY_RESIZE
) {
125 int display_input_to_flush(void)
128 if (last_getch
!= ERR
)
141 void display_post_error(void)
143 /* I don't _think_ we need do anything here */
146 void display_recheck_size(void)