Removed a useless Enum and started the moving to piles
This commit is contained in:
@@ -209,7 +209,6 @@ impl App {
|
||||
let selected = self.selected_card.is_some() && *c == self.selected_card.unwrap();
|
||||
let a_card = match c.visible {
|
||||
true => card_widget(c, is_top_card, highlight, selected),
|
||||
//false => turned_over_card(is_top_card),
|
||||
false => card_widget(c, is_top_card, highlight, selected),
|
||||
};
|
||||
frame.render_widget(
|
||||
@@ -223,20 +222,7 @@ impl App {
|
||||
}
|
||||
|
||||
if self.show_help {
|
||||
let block = Block::bordered().title("Help");
|
||||
let text =
|
||||
"You are playing \"Legends of Soltar\" - a Klondike thingy
|
||||
Press 'q' to Quit
|
||||
Press '1' or '3' to change the number of cards you draw from the deck
|
||||
Press 'd' to draw from your deck
|
||||
Press 'w' to put the waste pile back into the deck (you can only do this when the waste is empty)";
|
||||
let p = Paragraph::new(text).wrap(Wrap { trim: true });
|
||||
let vertical = Layout::vertical([Constraint::Max(10)]).flex(Flex::Center);
|
||||
let horizontal = Layout::horizontal([Constraint::Percentage(70)]).flex(Flex::Center);
|
||||
let [area] = vertical.areas(area);
|
||||
let [area] = horizontal.areas(area);
|
||||
frame.render_widget(Clear, area);
|
||||
frame.render_widget(p.block(block), area);
|
||||
show_help(frame, &area);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -276,6 +262,23 @@ fn main() -> io::Result<()> {
|
||||
app_result
|
||||
}
|
||||
|
||||
fn show_help(frame: &mut Frame, area: &Rect) {
|
||||
let block = Block::bordered().title("Help");
|
||||
let text =
|
||||
"You are playing \"Legends of Soltar\" - a Klondike thingy
|
||||
Press 'q' to Quit
|
||||
Press '1' or '3' to change the number of cards you draw from the deck
|
||||
Press 'd' to draw from your deck
|
||||
Press 'w' to put the waste pile back into the deck (you can only do this when the waste is empty)";
|
||||
let p = Paragraph::new(text).wrap(Wrap { trim: true });
|
||||
let vertical = Layout::vertical([Constraint::Max(10)]).flex(Flex::Center);
|
||||
let horizontal = Layout::horizontal([Constraint::Percentage(70)]).flex(Flex::Center);
|
||||
let [area] = vertical.areas(*area);
|
||||
let [area] = horizontal.areas(area);
|
||||
frame.render_widget(Clear, area);
|
||||
frame.render_widget(p.block(block), area);
|
||||
}
|
||||
|
||||
|
||||
fn deck_widget(cards_in_deck: &Vec<card_stuffs::Card>) -> Paragraph<'static> {
|
||||
let card_image = format!(
|
||||
|
||||
Reference in New Issue
Block a user