rename to mcfreecell
This commit is contained in:
parent
08292b2aea
commit
d7f7b84905
1 changed files with 19 additions and 10 deletions
|
|
@ -861,8 +861,8 @@ def draw_card_label(card: Optional[Card]) -> str:
|
|||
|
||||
def draw_top_row(stdscr, game: FreeCellGame) -> None:
|
||||
"""Draw freecells and foundations."""
|
||||
stdscr.addstr(TOP_Y - 1, 2, "Free Cells", curses.color_pair(1) | curses.A_BOLD)
|
||||
stdscr.addstr(TOP_Y - 1, 40, "Foundations", curses.color_pair(1) | curses.A_BOLD)
|
||||
stdscr.addstr(TOP_Y, 2, "Free Cells", curses.color_pair(1) | curses.A_BOLD)
|
||||
stdscr.addstr(TOP_Y, 40, "Foundations", curses.color_pair(1) | curses.A_BOLD)
|
||||
|
||||
# Freecells at indexes 0..3
|
||||
for i in range(4):
|
||||
|
|
@ -878,11 +878,11 @@ def draw_top_row(stdscr, game: FreeCellGame) -> None:
|
|||
)
|
||||
|
||||
card = game.freecells[i]
|
||||
draw_box(stdscr, TOP_Y, x, CARD_W, draw_card_label(card), attr)
|
||||
draw_box(stdscr, TOP_Y + 1, x, CARD_W, draw_card_label(card), attr)
|
||||
|
||||
if card:
|
||||
stdscr.addnstr(
|
||||
TOP_Y,
|
||||
TOP_Y + 1,
|
||||
x + 1,
|
||||
card.short_name(),
|
||||
CARD_W - 2,
|
||||
|
|
@ -905,11 +905,11 @@ def draw_top_row(stdscr, game: FreeCellGame) -> None:
|
|||
foundation = game.foundations[i]
|
||||
top_card = foundation[-1] if foundation else None
|
||||
label = draw_card_label(top_card) if top_card else SUITS[i].glyph
|
||||
draw_box(stdscr, TOP_Y, x, CARD_W, label, attr)
|
||||
draw_box(stdscr, TOP_Y + 1, x, CARD_W, label, attr)
|
||||
|
||||
if top_card:
|
||||
stdscr.addnstr(
|
||||
TOP_Y,
|
||||
TOP_Y + 1,
|
||||
x + 1,
|
||||
top_card.short_name(),
|
||||
CARD_W - 2,
|
||||
|
|
@ -919,7 +919,7 @@ def draw_top_row(stdscr, game: FreeCellGame) -> None:
|
|||
# Show suit glyph placeholder in foundation slot color
|
||||
dummy_color = 2 if SUITS[i].color_group == "red" else 3
|
||||
stdscr.addnstr(
|
||||
TOP_Y, x + 2, SUITS[i].glyph, 1, curses.color_pair(dummy_color)
|
||||
TOP_Y + 1, x + 2, SUITS[i].glyph, 1, curses.color_pair(dummy_color)
|
||||
)
|
||||
|
||||
|
||||
|
|
@ -1041,10 +1041,19 @@ def draw_help(stdscr, max_y: int) -> None:
|
|||
def render(stdscr, game: FreeCellGame) -> None:
|
||||
"""Redraw the full screen."""
|
||||
stdscr.erase()
|
||||
max_y, _ = stdscr.getmaxyx()
|
||||
max_y, max_x = stdscr.getmaxyx()
|
||||
|
||||
title = "Linux FreeCell Prototype"
|
||||
stdscr.addstr(0, 2, title, curses.color_pair(1) | curses.A_BOLD)
|
||||
title = "mcfreecell 0.1"
|
||||
if len(title) > max_x - 4:
|
||||
title = "mcfreecell"
|
||||
title_x = max(2, (max_x - len(title)) // 2)
|
||||
stdscr.addnstr(
|
||||
0,
|
||||
title_x,
|
||||
title,
|
||||
max(0, max_x - title_x - 1),
|
||||
curses.color_pair(1) | curses.A_BOLD,
|
||||
)
|
||||
|
||||
if game.visual_mode:
|
||||
stdscr.addstr(0, 30, "-- VISUAL --", curses.color_pair(5) | curses.A_BOLD)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue