diff options
author | 2023-09-10 00:34:21 +0200 | |
---|---|---|
committer | 2023-09-10 00:34:21 +0200 | |
commit | b8e5693a3089d728b4f8d4b3b0b7197202ebd732 (patch) | |
tree | 79a9f84f9920525657fbe03d53ce33bab09053d7 /examples/game_of_life | |
parent | 956512338905bac0b156fdaf16fe3c3e07e97a84 (diff) | |
parent | a3489e4af960388e9f73988b88df361022a654a4 (diff) | |
download | iced-b8e5693a3089d728b4f8d4b3b0b7197202ebd732.tar.gz iced-b8e5693a3089d728b4f8d4b3b0b7197202ebd732.tar.bz2 iced-b8e5693a3089d728b4f8d4b3b0b7197202ebd732.zip |
Merge branch 'master' into explicit-text-caching
Diffstat (limited to 'examples/game_of_life')
-rw-r--r-- | examples/game_of_life/Cargo.toml | 12 | ||||
-rw-r--r-- | examples/game_of_life/README.md | 4 | ||||
-rw-r--r-- | examples/game_of_life/src/main.rs | 10 |
3 files changed, 13 insertions, 13 deletions
diff --git a/examples/game_of_life/Cargo.toml b/examples/game_of_life/Cargo.toml index 6de45db6..9b291de8 100644 --- a/examples/game_of_life/Cargo.toml +++ b/examples/game_of_life/Cargo.toml @@ -6,8 +6,10 @@ edition = "2021" publish = false [dependencies] -iced = { path = "../..", features = ["canvas", "tokio", "debug"] } -tokio = { version = "1.0", features = ["sync"] } -itertools = "0.9" -rustc-hash = "1.1" -env_logger = "0.10" +iced.workspace = true +iced.features = ["debug", "canvas", "tokio"] + +itertools = "0.11" +rustc-hash.workspace = true +tokio = { workspace = true, features = ["sync"] } +tracing-subscriber = "0.3" diff --git a/examples/game_of_life/README.md b/examples/game_of_life/README.md index aa39201c..60033c1a 100644 --- a/examples/game_of_life/README.md +++ b/examples/game_of_life/README.md @@ -7,9 +7,7 @@ It runs a simulation in a background thread while allowing interaction with a `C The __[`main`]__ file contains the relevant code of the example. <div align="center"> - <a href="https://gfycat.com/WhichPaltryChick"> - <img src="https://thumbs.gfycat.com/WhichPaltryChick-size_restricted.gif"> - </a> + <img src="https://iced.rs/examples/game_of_life.gif"> </div> You can run it with `cargo run`: diff --git a/examples/game_of_life/src/main.rs b/examples/game_of_life/src/main.rs index fa711744..e451cb06 100644 --- a/examples/game_of_life/src/main.rs +++ b/examples/game_of_life/src/main.rs @@ -18,7 +18,7 @@ use iced::{ use std::time::{Duration, Instant}; pub fn main() -> iced::Result { - env_logger::builder().format_timestamp(None).init(); + tracing_subscriber::fmt::init(); GameOfLife::run(Settings { antialiasing: true, @@ -550,7 +550,7 @@ mod grid { frame.translate(center); frame.scale(self.scaling); frame.translate(self.translation); - frame.scale(Cell::SIZE as f32); + frame.scale(Cell::SIZE); let region = self.visible_region(frame.size()); @@ -576,7 +576,7 @@ mod grid { frame.translate(center); frame.scale(self.scaling); frame.translate(self.translation); - frame.scale(Cell::SIZE as f32); + frame.scale(Cell::SIZE); frame.fill_rectangle( Point::new(cell.j as f32, cell.i as f32), @@ -630,7 +630,7 @@ mod grid { frame.translate(center); frame.scale(self.scaling); frame.translate(self.translation); - frame.scale(Cell::SIZE as f32); + frame.scale(Cell::SIZE); let region = self.visible_region(frame.size()); let rows = region.rows(); @@ -834,7 +834,7 @@ mod grid { } impl Cell { - const SIZE: usize = 20; + const SIZE: u16 = 20; fn at(position: Point) -> Cell { let i = (position.y / Cell::SIZE as f32).ceil() as isize; |