Fixed waste display issue and added cards per draw
This commit is contained in:
@@ -41,7 +41,7 @@ fn draw_waste(cards_in_waste: &Vec<card_stuffs::Card>, area: Rect, frame: &mut F
|
||||
}
|
||||
if cards_in_waste.len() >= 3 {
|
||||
frame.render_widget(
|
||||
partially_covered_card(&cards_in_waste[cards_in_waste.len() - 1]),
|
||||
partially_covered_card(&cards_in_waste[cards_in_waste.len() - 3]),
|
||||
w1
|
||||
);
|
||||
frame.render_widget(
|
||||
@@ -49,16 +49,16 @@ fn draw_waste(cards_in_waste: &Vec<card_stuffs::Card>, area: Rect, frame: &mut F
|
||||
w2
|
||||
);
|
||||
frame.render_widget(
|
||||
card_widget(&cards_in_waste[cards_in_waste.len() - 3], true, false, false),
|
||||
card_widget(&cards_in_waste[cards_in_waste.len() - 1], true, false, false),
|
||||
top_waste
|
||||
);
|
||||
} else if cards_in_waste.len() == 2 {
|
||||
frame.render_widget(
|
||||
partially_covered_card(&cards_in_waste[cards_in_waste.len() - 1]),
|
||||
partially_covered_card(&cards_in_waste[cards_in_waste.len() - 2]),
|
||||
w2
|
||||
);
|
||||
frame.render_widget(
|
||||
card_widget(&cards_in_waste[cards_in_waste.len() - 2], true, false, false),
|
||||
card_widget(&cards_in_waste[cards_in_waste.len() - 1], true, false, false),
|
||||
top_waste
|
||||
);
|
||||
} else if cards_in_waste.len() == 1 {
|
||||
@@ -218,7 +218,7 @@ impl App {
|
||||
Constraint::Min(0),
|
||||
Constraint::Length(1),
|
||||
]);
|
||||
let [title_bar, main_area, _status_bar] = vertical.areas(frame.area());
|
||||
let [title_bar, main_area, status_bar] = vertical.areas(frame.area());
|
||||
|
||||
frame.render_widget(
|
||||
Block::new()
|
||||
@@ -228,9 +228,15 @@ impl App {
|
||||
title_bar
|
||||
);
|
||||
|
||||
let status_bar_info = format!("Cards Per-Draw: {} ---- Times Through Deck: {} ", self.cards.num_cards_turned, self.cards.current_num_passes_through_deck);
|
||||
frame.render_widget(
|
||||
Block::new().borders(Borders::TOP).title(status_bar_info),
|
||||
status_bar
|
||||
);
|
||||
|
||||
let vertical = Layout::vertical([
|
||||
Constraint::Length(CARD_HEIGHT),
|
||||
Constraint::Min(0)
|
||||
Constraint::Min(0),
|
||||
]);
|
||||
let [dwf_area, piles_area] = vertical.areas(main_area);
|
||||
|
||||
@@ -332,6 +338,8 @@ impl App {
|
||||
KeyCode::Char('q') => self.exit(),
|
||||
KeyCode::Char('d') => self.cards.deck_to_waste(),
|
||||
KeyCode::Char('w') => self.cards.waste_to_deck(),
|
||||
KeyCode::Char('1') => self.cards.num_cards_turned = 1,
|
||||
KeyCode::Char('3') => self.cards.num_cards_turned = 3,
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user