diff options
Diffstat (limited to 'examples/tour')
-rw-r--r-- | examples/tour/Cargo.toml | 14 | ||||
-rw-r--r-- | examples/tour/README.md | 4 | ||||
-rw-r--r-- | examples/tour/src/main.rs | 9 |
3 files changed, 22 insertions, 5 deletions
diff --git a/examples/tour/Cargo.toml b/examples/tour/Cargo.toml index 48471f2d..9e984ad1 100644 --- a/examples/tour/Cargo.toml +++ b/examples/tour/Cargo.toml @@ -6,5 +6,15 @@ edition = "2021" publish = false [dependencies] -iced = { path = "../..", features = ["image", "debug"] } -env_logger = "0.10.0" +iced.workspace = true +iced.features = ["image", "debug"] + +[target.'cfg(not(target_arch = "wasm32"))'.dependencies] +tracing-subscriber = "0.3" + +[target.'cfg(target_arch = "wasm32")'.dependencies] +iced.workspace = true +iced.features = ["image", "debug", "webgl"] + +console_error_panic_hook = "0.1" +console_log = "1.0" diff --git a/examples/tour/README.md b/examples/tour/README.md index 731e7e66..1c01236b 100644 --- a/examples/tour/README.md +++ b/examples/tour/README.md @@ -5,8 +5,8 @@ A simple UI tour that can run both on native platforms and the web! It showcases The __[`main`]__ file contains all the code of the example! All the cross-platform GUI is defined in terms of __state__, __messages__, __update logic__ and __view logic__. <div align="center"> - <a href="https://gfycat.com/politeadorableiberianmole"> - <img src="https://thumbs.gfycat.com/PoliteAdorableIberianmole-small.gif"> + <a href="https://iced.rs/examples/tour.mp4"> + <img src="https://iced.rs/examples/tour.gif"> </a> </div> diff --git a/examples/tour/src/main.rs b/examples/tour/src/main.rs index 10de2ae1..3e3a8ad7 100644 --- a/examples/tour/src/main.rs +++ b/examples/tour/src/main.rs @@ -8,7 +8,14 @@ use iced::widget::{Button, Column, Container, Slider}; use iced::{Color, Element, Font, Length, Pixels, Renderer, Sandbox, Settings}; pub fn main() -> iced::Result { - env_logger::init(); + #[cfg(target_arch = "wasm32")] + { + console_log::init().expect("Initialize logger"); + std::panic::set_hook(Box::new(console_error_panic_hook::hook)); + } + + #[cfg(not(target_arch = "wasm32"))] + tracing_subscriber::fmt::init(); Tour::run(Settings::default()) } |