Deck to waste and waste to deck working-ish

This commit is contained in:
2025-03-07 23:49:51 +00:00
parent 5106f6c53c
commit f3ecdb69a4
2 changed files with 21 additions and 14 deletions

View File

@@ -25,18 +25,16 @@ const CARD_HEIGHT: u16 = 11;
const CARD_WIDTH: u16 = 15;
fn draw_waste(cards_in_waste: &Vec<card_stuffs::Card>, area: Rect, frame: &mut Frame) {
let horizontal = Layout::horizontal([
Constraint::Length(3),
Constraint::Length(3),
Constraint::Length(CARD_WIDTH),
]);
let [w1, w2, top_waste] = horizontal.areas(area);
// There must be a better way to do this
// There must be a better way to do this
if cards_in_waste.len() == 0 {
frame.render_widget(
// TODO too tall for some reason
empty_pile(),
top_waste
);
@@ -332,7 +330,8 @@ impl App {
fn handle_key_event(&mut self, key_event: KeyEvent) {
match key_event.code {
KeyCode::Char('q') => self.exit(),
KeyCode::Char('d') => self.cards.draw(),
KeyCode::Char('d') => self.cards.deck_to_waste(),
KeyCode::Char('w') => self.cards.waste_to_deck(),
_ => {}
}
}