From 41bc6c282153e7b7af7f40467972c81ce863df54 Mon Sep 17 00:00:00 2001 From: panki27 Date: Fri, 20 Apr 2018 09:11:27 +0200 Subject: [PATCH] display controls --- minebash | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/minebash b/minebash index 86875e6..6e2b0c6 100755 --- a/minebash +++ b/minebash @@ -300,8 +300,15 @@ def handle_input(k): def print_score(screen): scorestr = 'Mines: {} Flags: {} Difficulty: {}'.format(MINECOUNT, FLAGCOUNT, difficulty) xpos = int((score_x) - (len(scorestr)/2)) + int(OFFSET/2) + if xpos < 0: xpos = 0 screen.addstr(score_y, xpos, scorestr) +def print_controls(screen): + controlstr = 'Arrow Keys: Move F: Place flag Space: Open field' + xpos = int((score_x) - len(controlstr)/2) + int(OFFSET/2) + if xpos < 0: xpos = 0 + screen.addstr(score_y +1, xpos, controlstr) + def setup_colors(): curses.start_color() curses.init_pair(1, curses.COLOR_WHITE, curses.COLOR_BLACK) @@ -330,6 +337,7 @@ def main(stdscr): STARTTIME = time.time() check_score() print_score(stdscr) + print_controls(stdscr) stdscr.refresh() #stdscr.getkey() if __name__ == "__main__":