summaryrefslogtreecommitdiffstats
path: root/examples/game_of_life
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2020-05-03 02:15:11 +0200
committerLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2020-05-03 02:15:11 +0200
commit4417a34edb7d002276f0419a5f62c6eee4a3af87 (patch)
tree455c4777a4b1e0a114baeef703b81e0b5386e716 /examples/game_of_life
parent5aaaea7c8824fb65bac35307cdf760c57f2bf5df (diff)
downloadiced-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.rs9
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
),