From 5106f6c53cabea4b4dba79540b0655299b024256 Mon Sep 17 00:00:00 2001 From: Arthur Roberts Date: Fri, 7 Mar 2025 23:38:27 +0000 Subject: [PATCH] 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! --- card_stuffs/src/main.rs | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/card_stuffs/src/main.rs b/card_stuffs/src/main.rs index 6711458..abe5ff1 100644 --- a/card_stuffs/src/main.rs +++ b/card_stuffs/src/main.rs @@ -37,7 +37,7 @@ fn draw_waste(cards_in_waste: &Vec, 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]);