display controls

master
panki27 7 years ago
parent 803d2ad25e
commit 41bc6c2821

@ -300,8 +300,15 @@ def handle_input(k):
def print_score(screen): def print_score(screen):
scorestr = 'Mines: {} Flags: {} Difficulty: {}'.format(MINECOUNT, FLAGCOUNT, difficulty) scorestr = 'Mines: {} Flags: {} Difficulty: {}'.format(MINECOUNT, FLAGCOUNT, difficulty)
xpos = int((score_x) - (len(scorestr)/2)) + int(OFFSET/2) xpos = int((score_x) - (len(scorestr)/2)) + int(OFFSET/2)
if xpos < 0: xpos = 0
screen.addstr(score_y, xpos, scorestr) 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(): def setup_colors():
curses.start_color() curses.start_color()
curses.init_pair(1, curses.COLOR_WHITE, curses.COLOR_BLACK) curses.init_pair(1, curses.COLOR_WHITE, curses.COLOR_BLACK)
@ -330,6 +337,7 @@ def main(stdscr):
STARTTIME = time.time() STARTTIME = time.time()
check_score() check_score()
print_score(stdscr) print_score(stdscr)
print_controls(stdscr)
stdscr.refresh() stdscr.refresh()
#stdscr.getkey() #stdscr.getkey()
if __name__ == "__main__": if __name__ == "__main__":

Loading…
Cancel
Save