|
| 1 | +import curses |
| 2 | +from constants import * |
| 3 | +from pause import pause |
| 4 | + |
| 5 | +def arena(screen, score = 0): |
| 6 | + height, width = screen.getmaxyx() |
| 7 | + |
| 8 | + if height < HEIGHT or width < WIDTH: |
| 9 | + pause(screen, height, width) |
| 10 | + screen.refresh() |
| 11 | + else: |
| 12 | + try: |
| 13 | + for r in range(HEIGHT): |
| 14 | + if r == 0: |
| 15 | + screen.addch(r, 0, curses.ACS_ULCORNER) |
| 16 | + for c in range(1, WIDTH - 1): |
| 17 | + screen.addch(r, c, curses.ACS_HLINE) |
| 18 | + screen.addch(r, WIDTH - 1, curses.ACS_URCORNER) |
| 19 | + elif r == 1: |
| 20 | + score_string = f"SCORE : {score}" |
| 21 | + screen.addstr(r, 1, score_string) |
| 22 | + for c in (0, WIDTH-1): |
| 23 | + screen.addch(r, c, curses.ACS_VLINE) |
| 24 | + elif r == HEIGHT - 1: |
| 25 | + screen.addch(r, 0, curses.ACS_LLCORNER) |
| 26 | + for c in range(1, WIDTH - 1): |
| 27 | + screen.addch(r, c, curses.ACS_HLINE) |
| 28 | + screen.addch(r, WIDTH - 1, curses.ACS_LRCORNER) |
| 29 | + elif r == 2: |
| 30 | + screen.addch(r, 0, curses.ACS_LTEE) |
| 31 | + for c in range(1, WIDTH - 1): |
| 32 | + screen.addch(r, c, curses.ACS_HLINE) |
| 33 | + screen.addch(r, WIDTH - 1, curses.ACS_RTEE) |
| 34 | + else: |
| 35 | + screen.addch(r, 0, curses.ACS_VLINE) |
| 36 | + for c in range(1, WIDTH - 1): |
| 37 | + screen.addch(r, c, " ") |
| 38 | + screen.addch(r, WIDTH - 1, curses.ACS_VLINE) |
| 39 | + except curses.error: |
| 40 | + pass |
0 commit comments