From ed3454301e663a7cb7d73cd56b57b188f4d14a2f Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Wed, 30 Aug 2023 04:31:21 +0200 Subject: Implement explicit text caching in the widget state tree --- examples/integration/src/main.rs | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'examples/integration') diff --git a/examples/integration/src/main.rs b/examples/integration/src/main.rs index 342d4c69..e011a411 100644 --- a/examples/integration/src/main.rs +++ b/examples/integration/src/main.rs @@ -8,7 +8,7 @@ use iced_wgpu::graphics::Viewport; use iced_wgpu::{wgpu, Backend, Renderer, Settings}; use iced_winit::core::mouse; use iced_winit::core::renderer; -use iced_winit::core::{Color, Size}; +use iced_winit::core::{Color, Font, Pixels, Size}; use iced_winit::runtime::program; use iced_winit::runtime::Debug; use iced_winit::style::Theme; @@ -143,12 +143,11 @@ pub fn main() -> Result<(), Box> { // Initialize iced let mut debug = Debug::new(); - let mut renderer = Renderer::new(Backend::new( - &device, - &queue, - Settings::default(), - format, - )); + let mut renderer = Renderer::new( + Backend::new(&device, &queue, Settings::default(), format), + Font::default(), + Pixels(16.0), + ); let mut state = program::State::new( controls, -- cgit From 6cc354fdc4eec6576e0591cd3a2ce37155cbfa09 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Sun, 3 Sep 2023 00:21:04 +0200 Subject: Update `wgpu` to `0.17` --- examples/integration/src/main.rs | 1 - 1 file changed, 1 deletion(-) (limited to 'examples/integration') diff --git a/examples/integration/src/main.rs b/examples/integration/src/main.rs index 342d4c69..98b58f16 100644 --- a/examples/integration/src/main.rs +++ b/examples/integration/src/main.rs @@ -82,7 +82,6 @@ pub fn main() -> Result<(), Box> { futures::futures::executor::block_on(async { let adapter = wgpu::util::initialize_adapter_from_env_or_default( &instance, - backend, Some(&surface), ) .await -- cgit From f468e25d0c67a01ee79d892f6e8ba9be019f06c7 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Mon, 4 Sep 2023 12:58:41 +0200 Subject: Use workspace dependencies and package inheritance We are also taking this as a chance to synchronize the versions of all the crates! Because of this, we will skip the `0.11` version. --- examples/integration/Cargo.toml | 13 +++++++------ examples/integration/src/main.rs | 2 +- 2 files changed, 8 insertions(+), 7 deletions(-) (limited to 'examples/integration') diff --git a/examples/integration/Cargo.toml b/examples/integration/Cargo.toml index 22914742..4c55daa7 100644 --- a/examples/integration/Cargo.toml +++ b/examples/integration/Cargo.toml @@ -6,18 +6,19 @@ 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 + +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" +log.workspace = true 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 diff --git a/examples/integration/src/main.rs b/examples/integration/src/main.rs index 98b58f16..af48af5f 100644 --- a/examples/integration/src/main.rs +++ b/examples/integration/src/main.rs @@ -41,7 +41,7 @@ pub fn main() -> Result<(), Box> { }; #[cfg(not(target_arch = "wasm32"))] - env_logger::init(); + tracing_subscriber::fmt::init(); // Initialize winit let event_loop = EventLoop::new(); -- cgit From d315e27451d46a815d18ed6037547d178413ede7 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Thu, 7 Sep 2023 03:15:02 +0200 Subject: Update example dependencies --- examples/integration/Cargo.toml | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to 'examples/integration') diff --git a/examples/integration/Cargo.toml b/examples/integration/Cargo.toml index 4c55daa7..032cc75e 100644 --- a/examples/integration/Cargo.toml +++ b/examples/integration/Cargo.toml @@ -13,13 +13,8 @@ iced_widget.workspace = true tracing-subscriber = "0.3" [target.'cfg(target_arch = "wasm32")'.dependencies] -console_error_panic_hook = "0.1.7" -console_log = "0.2.0" +console_error_panic_hook = "0.1" +console_log = "1.0" log.workspace = true 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"] } -- cgit From 6fd2c1552735639d96d177550e98b314bd6f79a8 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Thu, 7 Sep 2023 05:05:43 +0200 Subject: Host GIFs and video examples in `iced.rs` RIP Gfycat --- examples/integration/README.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'examples/integration') 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.
- - - +
You can run it with `cargo run`: -- cgit From 9c2ad457d80e8254955396ad034df0dd5f2b59b3 Mon Sep 17 00:00:00 2001 From: Thomas Date: Sat, 9 Sep 2023 13:59:18 +0200 Subject: Add webgl feature for web examples --- examples/integration/Cargo.toml | 3 +++ 1 file changed, 3 insertions(+) (limited to 'examples/integration') diff --git a/examples/integration/Cargo.toml b/examples/integration/Cargo.toml index 032cc75e..bf70a619 100644 --- a/examples/integration/Cargo.toml +++ b/examples/integration/Cargo.toml @@ -13,6 +13,9 @@ iced_widget.workspace = true tracing-subscriber = "0.3" [target.'cfg(target_arch = "wasm32")'.dependencies] +iced_wgpu.workspace = true +iced_wgpu.features = ["webgl"] + console_error_panic_hook = "0.1" console_log = "1.0" log.workspace = true -- cgit From 052fe0edaeb0d6ce096375751eec02b953faf2a1 Mon Sep 17 00:00:00 2001 From: Thomas Date: Sat, 9 Sep 2023 14:15:11 +0200 Subject: Dont use tracing-subscriber dependency on web --- examples/integration/Cargo.toml | 1 + 1 file changed, 1 insertion(+) (limited to 'examples/integration') diff --git a/examples/integration/Cargo.toml b/examples/integration/Cargo.toml index bf70a619..6b9fcc57 100644 --- a/examples/integration/Cargo.toml +++ b/examples/integration/Cargo.toml @@ -10,6 +10,7 @@ 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] -- cgit From fbc9ef74c406b2a58bb2a093262323e346faf485 Mon Sep 17 00:00:00 2001 From: Thomas Date: Sat, 9 Sep 2023 22:42:41 +0200 Subject: Change init_with_level to init in examples --- examples/integration/Cargo.toml | 1 - examples/integration/src/main.rs | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) (limited to 'examples/integration') diff --git a/examples/integration/Cargo.toml b/examples/integration/Cargo.toml index 6b9fcc57..a4a961f8 100644 --- a/examples/integration/Cargo.toml +++ b/examples/integration/Cargo.toml @@ -19,6 +19,5 @@ iced_wgpu.features = ["webgl"] console_error_panic_hook = "0.1" console_log = "1.0" -log.workspace = true wasm-bindgen = "0.2" web-sys = { version = "0.3", features = ["Element", "HtmlCanvasElement", "Window", "Document"] } diff --git a/examples/integration/src/main.rs b/examples/integration/src/main.rs index af48af5f..d0b2d891 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> { #[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)); -- cgit From c997aad85d7ee6e77085e50e5e599002549d228f Mon Sep 17 00:00:00 2001 From: Yuri Astrakhan Date: Tue, 19 Sep 2023 01:46:46 -0400 Subject: Chore: Apply clippy map transformations Convert `.map().unwrap_or()` to `.map_or()` and similar transformations. --- examples/integration/src/main.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'examples/integration') diff --git a/examples/integration/src/main.rs b/examples/integration/src/main.rs index 7945bd20..243297b2 100644 --- a/examples/integration/src/main.rs +++ b/examples/integration/src/main.rs @@ -200,8 +200,10 @@ pub fn main() -> Result<(), Box> { viewport.scale_factor(), ) }) - .map(mouse::Cursor::Available) - .unwrap_or(mouse::Cursor::Unavailable), + .map_or( + mouse::Cursor::Unavailable, + mouse::Cursor::Available, + ), &mut renderer, &Theme::Dark, &renderer::Style { -- cgit From 42ed90bc6f92b2085d193e7f143430b8d3847c21 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Wed, 20 Sep 2023 04:51:08 +0200 Subject: Fix `clippy::default_trait_access` --- examples/integration/src/controls.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'examples/integration') diff --git a/examples/integration/src/controls.rs b/examples/integration/src/controls.rs index 14e53ede..4714c397 100644 --- a/examples/integration/src/controls.rs +++ b/examples/integration/src/controls.rs @@ -19,7 +19,7 @@ impl Controls { pub fn new() -> Controls { Controls { background_color: Color::BLACK, - text: Default::default(), + text: String::default(), } } -- cgit From f8f1a8634402a5eb4275ff0814d03a3104fea65a Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Wed, 20 Sep 2023 05:30:08 +0200 Subject: Fix `clippy::manual_let_else` --- examples/integration/src/main.rs | 2 +- examples/integration/src/scene.rs | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) (limited to 'examples/integration') diff --git a/examples/integration/src/main.rs b/examples/integration/src/main.rs index 243297b2..4415fefa 100644 --- a/examples/integration/src/main.rs +++ b/examples/integration/src/main.rs @@ -256,7 +256,7 @@ pub fn main() -> Result<(), Box> { { // We clear the frame - let mut render_pass = scene.clear( + let mut render_pass = Scene::clear( &view, &mut encoder, program.background_color(), diff --git a/examples/integration/src/scene.rs b/examples/integration/src/scene.rs index 90c7efbf..01808f40 100644 --- a/examples/integration/src/scene.rs +++ b/examples/integration/src/scene.rs @@ -16,7 +16,6 @@ impl Scene { } pub fn clear<'a>( - &self, target: &'a wgpu::TextureView, encoder: &'a mut wgpu::CommandEncoder, background_color: Color, -- cgit From b27762554627b8e89f2b840b1a8a512e22d4cd87 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Wed, 20 Sep 2023 16:26:43 +0200 Subject: Revert "Chore: Apply clippy map transformations" This reverts commit c997aad85d7ee6e77085e50e5e599002549d228f. --- examples/integration/src/main.rs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'examples/integration') diff --git a/examples/integration/src/main.rs b/examples/integration/src/main.rs index 4415fefa..c26d52fe 100644 --- a/examples/integration/src/main.rs +++ b/examples/integration/src/main.rs @@ -200,10 +200,8 @@ pub fn main() -> Result<(), Box> { viewport.scale_factor(), ) }) - .map_or( - mouse::Cursor::Unavailable, - mouse::Cursor::Available, - ), + .map(mouse::Cursor::Available) + .unwrap_or(mouse::Cursor::Unavailable), &mut renderer, &Theme::Dark, &renderer::Style { -- cgit From 86b877517feb15b2155c6cfef29246a3f281c8ae Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Fri, 27 Oct 2023 03:21:40 +0200 Subject: Update `wgpu` to `0.18` and `cosmic-text` to `0.10` --- examples/integration/src/scene.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'examples/integration') diff --git a/examples/integration/src/scene.rs b/examples/integration/src/scene.rs index 01808f40..e29558bf 100644 --- a/examples/integration/src/scene.rs +++ b/examples/integration/src/scene.rs @@ -36,10 +36,12 @@ impl Scene { a: a as f64, } }), - store: true, + store: wgpu::StoreOp::Store, }, })], depth_stencil_attachment: None, + timestamp_writes: None, + occlusion_query_set: None, }) } -- cgit From 781ef1f94c4859aeeb852f801b72be095b8ff82b Mon Sep 17 00:00:00 2001 From: Bingus Date: Thu, 14 Sep 2023 13:58:36 -0700 Subject: Added support for custom shader widget for iced_wgpu backend. --- examples/integration/src/main.rs | 1 + 1 file changed, 1 insertion(+) (limited to 'examples/integration') diff --git a/examples/integration/src/main.rs b/examples/integration/src/main.rs index c26d52fe..0f32fca0 100644 --- a/examples/integration/src/main.rs +++ b/examples/integration/src/main.rs @@ -271,6 +271,7 @@ pub fn main() -> Result<(), Box> { &queue, &mut encoder, None, + frame.texture.format(), &view, primitive, &viewport, -- cgit