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:
|
def draw_top_row(stdscr, game: FreeCellGame) -> None:
|
||||||
"""Draw freecells and foundations."""
|
"""Draw freecells and foundations."""
|
||||||
stdscr.addstr(TOP_Y - 1, 2, "Free Cells", 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 - 1, 40, "Foundations", 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
|
# Freecells at indexes 0..3
|
||||||
for i in range(4):
|
for i in range(4):
|
||||||
|
|
@ -878,11 +878,11 @@ def draw_top_row(stdscr, game: FreeCellGame) -> None:
|
||||||
)
|
)
|
||||||
|
|
||||||
card = game.freecells[i]
|
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:
|
if card:
|
||||||
stdscr.addnstr(
|
stdscr.addnstr(
|
||||||
TOP_Y,
|
TOP_Y + 1,
|
||||||
x + 1,
|
x + 1,
|
||||||
card.short_name(),
|
card.short_name(),
|
||||||
CARD_W - 2,
|
CARD_W - 2,
|
||||||
|
|
@ -905,11 +905,11 @@ def draw_top_row(stdscr, game: FreeCellGame) -> None:
|
||||||
foundation = game.foundations[i]
|
foundation = game.foundations[i]
|
||||||
top_card = foundation[-1] if foundation else None
|
top_card = foundation[-1] if foundation else None
|
||||||
label = draw_card_label(top_card) if top_card else SUITS[i].glyph
|
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:
|
if top_card:
|
||||||
stdscr.addnstr(
|
stdscr.addnstr(
|
||||||
TOP_Y,
|
TOP_Y + 1,
|
||||||
x + 1,
|
x + 1,
|
||||||
top_card.short_name(),
|
top_card.short_name(),
|
||||||
CARD_W - 2,
|
CARD_W - 2,
|
||||||
|
|
@ -919,7 +919,7 @@ def draw_top_row(stdscr, game: FreeCellGame) -> None:
|
||||||
# Show suit glyph placeholder in foundation slot color
|
# Show suit glyph placeholder in foundation slot color
|
||||||
dummy_color = 2 if SUITS[i].color_group == "red" else 3
|
dummy_color = 2 if SUITS[i].color_group == "red" else 3
|
||||||
stdscr.addnstr(
|
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:
|
def render(stdscr, game: FreeCellGame) -> None:
|
||||||
"""Redraw the full screen."""
|
"""Redraw the full screen."""
|
||||||
stdscr.erase()
|
stdscr.erase()
|
||||||
max_y, _ = stdscr.getmaxyx()
|
max_y, max_x = stdscr.getmaxyx()
|
||||||
|
|
||||||
title = "Linux FreeCell Prototype"
|
title = "mcfreecell 0.1"
|
||||||
stdscr.addstr(0, 2, title, curses.color_pair(1) | curses.A_BOLD)
|
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:
|
if game.visual_mode:
|
||||||
stdscr.addstr(0, 30, "-- VISUAL --", curses.color_pair(5) | curses.A_BOLD)
|
stdscr.addstr(0, 30, "-- VISUAL --", curses.color_pair(5) | curses.A_BOLD)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue