Skip to content

Commit

Permalink
Trailing message about adding games.
Browse files Browse the repository at this point in the history
  • Loading branch information
bkirwi committed Jan 29, 2022
1 parent c0e79c3 commit d075db8
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1036,16 +1036,13 @@ impl Game {
let game_vec =
Game::list_games(root_dir).expect(&format!("Unable to list games in {:?}", root_dir));

let welcome_message: String = if game_vec.is_empty() {
format!(
"It looks like you haven't added any games yet... add a Zcode file to {} and restart the app.",
root_dir.to_string_lossy(),
)
let welcome_message = if game_vec.is_empty() {
"No games found!"
} else {
"Choose a game from the list to get started.".to_string()
"Choose a game from the list to get started."
};

for widget in Text::wrap(LINE_HEIGHT, &*ROMAN, &welcome_message, LINE_LENGTH, true) {
for widget in Text::wrap(LINE_HEIGHT, &*ROMAN, welcome_message, LINE_LENGTH, true) {
games.push_element(Element::Line(false, widget));
}
games.push_advance_space();
Expand All @@ -1071,6 +1068,15 @@ impl Game {
Some(Msg::LoadGame(path)),
));
}

let suggest = format!(
"To load more games, copy a .z3, .z5, or .z8 file to {} and restart the app.",
root_dir.to_string_lossy(),
);
for widget in Text::wrap(LINE_HEIGHT, &*ROMAN, &suggest, LINE_LENGTH, true) {
games.push_element(Element::Line(false, widget));
}

games
}

Expand Down

0 comments on commit d075db8

Please # to comment.