MCPcopy Create free account
hub / github.com/NetHack/NetHack / draw_status

Function draw_status

win/curses/cursstat.c:210–247  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

208}
209
210RESTORE_WARNING_FORMAT_NONLITERAL
211
212static void
213draw_status(void)
214{
215 WINDOW *win = curses_get_nhwin(STATUS_WIN);
216 orient statorient = (orient) curses_get_window_orientation(STATUS_WIN);
217 boolean horiz = (statorient != ALIGN_RIGHT && statorient != ALIGN_LEFT);
218 boolean border = curses_window_has_border(STATUS_WIN);
219
220 /* Figure out if we have proper window dimensions for horizontal
221 statusbar. */
222 if (horiz) {
223 int ax = 0, ay = 0;
224 int cy = (iflags.wc2_statuslines < 3) ? 2 : 3;
225
226 /* actual y (and x) */
227 getmaxyx(win, ay, ax);
228 if (border)
229 ay -= 2;
230
231 if (cy != ay) { /* something changed. Redo everything */
232 curs_reset_windows(TRUE, TRUE);
233 win = curses_get_nhwin(STATUS_WIN);
234 }
235 nhUse(ax); /* getmaxyx macro isn't sufficient */
236 }
237
238 werase(win);
239 if (horiz)
240 draw_horizontal(border);
241 else
242 draw_vertical(border);
243
244 if (border)
245 box(win, 0, 0);
246 wnoutrefresh(win);
247}
248
249/* horizontal layout on 2 or 3 lines */
250static void

Callers 1

curses_status_updateFunction · 0.70

Calls 6

curses_get_nhwinFunction · 0.85
curses_window_has_borderFunction · 0.85
curs_reset_windowsFunction · 0.85
draw_horizontalFunction · 0.85
draw_verticalFunction · 0.85

Tested by

no test coverage detected