def draw_footer(stdscr, game):
"""Displays the controls in the last line."""
if game.is_lost() or game.is_solved():
controls = [("Press any key to continue", "")]
else:
controls = [
("Navigate:", "\u2190 \u2192 \u2191 \u2193"),
("Reveal:", "Space \u2423"),
("Toggle Mark:", "Enter \u23CE"),
("Menu:", "Escape"),
]
offset = 0
for name, control in controls:
stdscr.addstr(curses.LINES-1, offset, name, curses.A_REVERSE)
offset += len(name)
stdscr.addstr(curses.LINES-1, offset, " " + control + " ")
offset += len(control) + 2
return Rect(0, curses.LINES-1, curses.COLS-1, 1)
评论列表
文章目录