diff options
author | 2020-05-03 02:15:11 +0200 | |
---|---|---|
committer | 2020-05-03 02:15:11 +0200 | |
commit | 4417a34edb7d002276f0419a5f62c6eee4a3af87 (patch) | |
tree | 455c4777a4b1e0a114baeef703b81e0b5386e716 /examples/game_of_life | |
parent | 5aaaea7c8824fb65bac35307cdf760c57f2bf5df (diff) | |
download | iced-4417a34edb7d002276f0419a5f62c6eee4a3af87.tar.gz iced-4417a34edb7d002276f0419a5f62c6eee4a3af87.tar.bz2 iced-4417a34edb7d002276f0419a5f62c6eee4a3af87.zip |
Fix "1 cells" overlay in `game_of_life`
Diffstat (limited to 'examples/game_of_life')
-rw-r--r-- | examples/game_of_life/src/main.rs | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/examples/game_of_life/src/main.rs b/examples/game_of_life/src/main.rs index 018ebc50..c2f80dfc 100644 --- a/examples/game_of_life/src/main.rs +++ b/examples/game_of_life/src/main.rs @@ -435,16 +435,19 @@ mod grid { if let Some(cell) = hovered_cell { frame.fill_text(Text { - content: format!("({}, {})", cell.i, cell.j), + content: format!("({}, {})", cell.j, cell.i), position: text.position - Vector::new(0.0, 16.0), ..text }); } + let cell_count = self.state.cell_count(); + frame.fill_text(Text { content: format!( - "{} cells @ {:?} ({})", - self.state.cell_count(), + "{} cell{} @ {:?} ({})", + cell_count, + if cell_count == 1 { "" } else { "s" }, self.last_tick_duration, self.last_queued_ticks ), |