diff options
author | 2023-09-10 00:34:21 +0200 | |
---|---|---|
committer | 2023-09-10 00:34:21 +0200 | |
commit | b8e5693a3089d728b4f8d4b3b0b7197202ebd732 (patch) | |
tree | 79a9f84f9920525657fbe03d53ce33bab09053d7 /examples/integration | |
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/integration')
-rw-r--r-- | examples/integration/Cargo.toml | 23 | ||||
-rw-r--r-- | examples/integration/README.md | 4 | ||||
-rw-r--r-- | examples/integration/src/main.rs | 5 |
3 files changed, 14 insertions, 18 deletions
diff --git a/examples/integration/Cargo.toml b/examples/integration/Cargo.toml index 22914742..a4a961f8 100644 --- a/examples/integration/Cargo.toml +++ b/examples/integration/Cargo.toml @@ -6,19 +6,18 @@ edition = "2021" publish = false [dependencies] -iced_winit = { path = "../../winit" } -iced_wgpu = { path = "../../wgpu" } -iced_widget = { path = "../../widget" } -iced_renderer = { path = "../../renderer", features = ["wgpu"] } -env_logger = "0.10" +iced_winit.workspace = true +iced_wgpu.workspace = true +iced_widget.workspace = true + +[target.'cfg(not(target_arch = "wasm32"))'.dependencies] +tracing-subscriber = "0.3" [target.'cfg(target_arch = "wasm32")'.dependencies] -console_error_panic_hook = "0.1.7" -console_log = "0.2.0" -log = "0.4" +iced_wgpu.workspace = true +iced_wgpu.features = ["webgl"] + +console_error_panic_hook = "0.1" +console_log = "1.0" wasm-bindgen = "0.2" web-sys = { version = "0.3", features = ["Element", "HtmlCanvasElement", "Window", "Document"] } -# This dependency a little bit quirky, it is deep in the tree and without `js` feature it -# refuses to work with `wasm32-unknown-unknown target`. Unfortunately, we need this patch -# to make it work -getrandom = { version = "0.2", features = ["js"] } diff --git a/examples/integration/README.md b/examples/integration/README.md index ece9ba1e..996cdc17 100644 --- a/examples/integration/README.md +++ b/examples/integration/README.md @@ -5,9 +5,7 @@ A demonstration of how to integrate Iced in an existing [`wgpu`] application. The __[`main`]__ file contains all the code of the example. <div align="center"> - <a href="https://gfycat.com/nicemediocrekodiakbear"> - <img src="https://thumbs.gfycat.com/NiceMediocreKodiakbear-small.gif"> - </a> + <img src="https://iced.rs/examples/integration.gif"> </div> You can run it with `cargo run`: diff --git a/examples/integration/src/main.rs b/examples/integration/src/main.rs index e011a411..7945bd20 100644 --- a/examples/integration/src/main.rs +++ b/examples/integration/src/main.rs @@ -29,7 +29,7 @@ use winit::platform::web::WindowBuilderExtWebSys; pub fn main() -> Result<(), Box<dyn std::error::Error>> { #[cfg(target_arch = "wasm32")] let canvas_element = { - console_log::init_with_level(log::Level::Debug)?; + console_log::init().expect("Initialize logger"); std::panic::set_hook(Box::new(console_error_panic_hook::hook)); @@ -41,7 +41,7 @@ pub fn main() -> Result<(), Box<dyn std::error::Error>> { }; #[cfg(not(target_arch = "wasm32"))] - env_logger::init(); + tracing_subscriber::fmt::init(); // Initialize winit let event_loop = EventLoop::new(); @@ -82,7 +82,6 @@ pub fn main() -> Result<(), Box<dyn std::error::Error>> { futures::futures::executor::block_on(async { let adapter = wgpu::util::initialize_adapter_from_env_or_default( &instance, - backend, Some(&surface), ) .await |