Empty piles now use empty piles

And I fixed the bug where it had no bottom border. It's because I didn't tell
it to have a border on the bottom. Funny that!
This commit is contained in:
2025-03-07 23:38:27 +00:00
parent 064139d698
commit 5106f6c53c

View File

@@ -37,7 +37,7 @@ fn draw_waste(cards_in_waste: &Vec<card_stuffs::Card>, area: Rect, frame: &mut F
if cards_in_waste.len() == 0 {
frame.render_widget(
// TODO too tall for some reason
empty_pile(false),
empty_pile(),
top_waste
);
}
@@ -185,7 +185,7 @@ fn facedown_card(top: bool) -> Paragraph<'static> {
.border_type(BorderType::Rounded))
}
fn empty_pile(top: bool) -> Paragraph<'static> {
fn empty_pile() -> Paragraph<'static> {
// made using https://www.asciiart.eu/
let hidden_card = format!(
"
@@ -198,14 +198,9 @@ fn empty_pile(top: bool) -> Paragraph<'static> {
XXXXXXX"
);
let mut borders = Borders::TOP | Borders::LEFT | Borders::RIGHT;
if top {
borders |= Borders::BOTTOM;
}
Paragraph::new(hidden_card)
.block(Block::new()
.borders(borders)
.borders(Borders::ALL)
.border_type(BorderType::Rounded))
}
@@ -262,7 +257,7 @@ impl App {
for fa in foundation_areas {
frame.render_widget(
facedown_card(true),
empty_pile(),
fa
);
}
@@ -295,6 +290,7 @@ impl App {
}
}
}
let vertical = Layout::vertical(constraints);
let card_display: [Rect; card_stuffs::NUM_PILES_KLONDIKE + 13] = vertical.areas(pileses[pile]);