From 5134cd94c61a2cb0b1f50e9f8ff328c64bdea9d1 Mon Sep 17 00:00:00 2001 From: StarArawn <toasterthegamer@gmail.com> Date: Tue, 7 Dec 2021 19:20:56 -0500 Subject: [PATCH] Upgraded to latest bevy main and fixed warnings. --- Cargo.lock | 72 ++++++++--------- Cargo.toml | 2 +- bevy_kayak_ui/Cargo.toml | 4 +- .../src/render/unified/font/extract.rs | 4 +- .../render/unified/font/font_texture_cache.rs | 6 +- bevy_kayak_ui/src/render/unified/font/mod.rs | 22 +++--- .../src/render/unified/font/sdf/mod.rs | 19 +---- bevy_kayak_ui/src/render/unified/pipeline.rs | 6 +- kayak_core/src/lib.rs | 1 + kayak_font/src/font.rs | 4 +- kayak_font/src/lib.rs | 1 + kayak_render_macros/src/children.rs | 78 +++++++++---------- 12 files changed, 102 insertions(+), 117 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index ff48216..46a67c6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -202,7 +202,7 @@ checksum = "904dfeac50f3cdaba28fc6f57fdcddb75f49ed61346676a78c4ffe55877802fd" [[package]] name = "bevy" version = "0.5.0" -source = "git+https://github.com/StarArawn/bevy?rev=146ddbe5f839d5d635fe350a535155231d4050c2#146ddbe5f839d5d635fe350a535155231d4050c2" +source = "git+https://github.com/StarArawn/bevy?rev=f3c82f2b0091aefa832ab45eaf15c2be2faa0785#f3c82f2b0091aefa832ab45eaf15c2be2faa0785" dependencies = [ "bevy_internal", ] @@ -216,7 +216,7 @@ checksum = "0d5f2f58f0aec3c50a20799792c3705e80dd7df327e79791cacec197e84e5e61" [[package]] name = "bevy_app" version = "0.5.0" -source = "git+https://github.com/StarArawn/bevy?rev=146ddbe5f839d5d635fe350a535155231d4050c2#146ddbe5f839d5d635fe350a535155231d4050c2" +source = "git+https://github.com/StarArawn/bevy?rev=f3c82f2b0091aefa832ab45eaf15c2be2faa0785#f3c82f2b0091aefa832ab45eaf15c2be2faa0785" dependencies = [ "bevy_derive", "bevy_ecs", @@ -229,7 +229,7 @@ dependencies = [ [[package]] name = "bevy_asset" version = "0.5.0" -source = "git+https://github.com/StarArawn/bevy?rev=146ddbe5f839d5d635fe350a535155231d4050c2#146ddbe5f839d5d635fe350a535155231d4050c2" +source = "git+https://github.com/StarArawn/bevy?rev=f3c82f2b0091aefa832ab45eaf15c2be2faa0785#f3c82f2b0091aefa832ab45eaf15c2be2faa0785" dependencies = [ "anyhow", "bevy_app", @@ -256,7 +256,7 @@ dependencies = [ [[package]] name = "bevy_audio" version = "0.5.0" -source = "git+https://github.com/StarArawn/bevy?rev=146ddbe5f839d5d635fe350a535155231d4050c2#146ddbe5f839d5d635fe350a535155231d4050c2" +source = "git+https://github.com/StarArawn/bevy?rev=f3c82f2b0091aefa832ab45eaf15c2be2faa0785#f3c82f2b0091aefa832ab45eaf15c2be2faa0785" dependencies = [ "anyhow", "bevy_app", @@ -271,7 +271,7 @@ dependencies = [ [[package]] name = "bevy_core" version = "0.5.0" -source = "git+https://github.com/StarArawn/bevy?rev=146ddbe5f839d5d635fe350a535155231d4050c2#146ddbe5f839d5d635fe350a535155231d4050c2" +source = "git+https://github.com/StarArawn/bevy?rev=f3c82f2b0091aefa832ab45eaf15c2be2faa0785#f3c82f2b0091aefa832ab45eaf15c2be2faa0785" dependencies = [ "bevy_app", "bevy_derive", @@ -286,7 +286,7 @@ dependencies = [ [[package]] name = "bevy_core_pipeline" version = "0.5.0" -source = "git+https://github.com/StarArawn/bevy?rev=146ddbe5f839d5d635fe350a535155231d4050c2#146ddbe5f839d5d635fe350a535155231d4050c2" +source = "git+https://github.com/StarArawn/bevy?rev=f3c82f2b0091aefa832ab45eaf15c2be2faa0785#f3c82f2b0091aefa832ab45eaf15c2be2faa0785" dependencies = [ "bevy_app", "bevy_asset", @@ -298,7 +298,7 @@ dependencies = [ [[package]] name = "bevy_derive" version = "0.5.0" -source = "git+https://github.com/StarArawn/bevy?rev=146ddbe5f839d5d635fe350a535155231d4050c2#146ddbe5f839d5d635fe350a535155231d4050c2" +source = "git+https://github.com/StarArawn/bevy?rev=f3c82f2b0091aefa832ab45eaf15c2be2faa0785#f3c82f2b0091aefa832ab45eaf15c2be2faa0785" dependencies = [ "Inflector", "bevy_macro_utils", @@ -309,7 +309,7 @@ dependencies = [ [[package]] name = "bevy_diagnostic" version = "0.5.0" -source = "git+https://github.com/StarArawn/bevy?rev=146ddbe5f839d5d635fe350a535155231d4050c2#146ddbe5f839d5d635fe350a535155231d4050c2" +source = "git+https://github.com/StarArawn/bevy?rev=f3c82f2b0091aefa832ab45eaf15c2be2faa0785#f3c82f2b0091aefa832ab45eaf15c2be2faa0785" dependencies = [ "bevy_app", "bevy_core", @@ -321,7 +321,7 @@ dependencies = [ [[package]] name = "bevy_ecs" version = "0.5.0" -source = "git+https://github.com/StarArawn/bevy?rev=146ddbe5f839d5d635fe350a535155231d4050c2#146ddbe5f839d5d635fe350a535155231d4050c2" +source = "git+https://github.com/StarArawn/bevy?rev=f3c82f2b0091aefa832ab45eaf15c2be2faa0785#f3c82f2b0091aefa832ab45eaf15c2be2faa0785" dependencies = [ "async-channel", "bevy_ecs_macros", @@ -338,7 +338,7 @@ dependencies = [ [[package]] name = "bevy_ecs_macros" version = "0.5.0" -source = "git+https://github.com/StarArawn/bevy?rev=146ddbe5f839d5d635fe350a535155231d4050c2#146ddbe5f839d5d635fe350a535155231d4050c2" +source = "git+https://github.com/StarArawn/bevy?rev=f3c82f2b0091aefa832ab45eaf15c2be2faa0785#f3c82f2b0091aefa832ab45eaf15c2be2faa0785" dependencies = [ "bevy_macro_utils", "proc-macro2 1.0.32", @@ -349,7 +349,7 @@ dependencies = [ [[package]] name = "bevy_gilrs" version = "0.5.0" -source = "git+https://github.com/StarArawn/bevy?rev=146ddbe5f839d5d635fe350a535155231d4050c2#146ddbe5f839d5d635fe350a535155231d4050c2" +source = "git+https://github.com/StarArawn/bevy?rev=f3c82f2b0091aefa832ab45eaf15c2be2faa0785#f3c82f2b0091aefa832ab45eaf15c2be2faa0785" dependencies = [ "bevy_app", "bevy_ecs", @@ -361,7 +361,7 @@ dependencies = [ [[package]] name = "bevy_gltf2" version = "0.5.0" -source = "git+https://github.com/StarArawn/bevy?rev=146ddbe5f839d5d635fe350a535155231d4050c2#146ddbe5f839d5d635fe350a535155231d4050c2" +source = "git+https://github.com/StarArawn/bevy?rev=f3c82f2b0091aefa832ab45eaf15c2be2faa0785#f3c82f2b0091aefa832ab45eaf15c2be2faa0785" dependencies = [ "anyhow", "base64", @@ -386,7 +386,7 @@ dependencies = [ [[package]] name = "bevy_input" version = "0.5.0" -source = "git+https://github.com/StarArawn/bevy?rev=146ddbe5f839d5d635fe350a535155231d4050c2#146ddbe5f839d5d635fe350a535155231d4050c2" +source = "git+https://github.com/StarArawn/bevy?rev=f3c82f2b0091aefa832ab45eaf15c2be2faa0785#f3c82f2b0091aefa832ab45eaf15c2be2faa0785" dependencies = [ "bevy_app", "bevy_ecs", @@ -397,7 +397,7 @@ dependencies = [ [[package]] name = "bevy_internal" version = "0.5.0" -source = "git+https://github.com/StarArawn/bevy?rev=146ddbe5f839d5d635fe350a535155231d4050c2#146ddbe5f839d5d635fe350a535155231d4050c2" +source = "git+https://github.com/StarArawn/bevy?rev=f3c82f2b0091aefa832ab45eaf15c2be2faa0785#f3c82f2b0091aefa832ab45eaf15c2be2faa0785" dependencies = [ "bevy_app", "bevy_asset", @@ -450,7 +450,7 @@ dependencies = [ [[package]] name = "bevy_log" version = "0.5.0" -source = "git+https://github.com/StarArawn/bevy?rev=146ddbe5f839d5d635fe350a535155231d4050c2#146ddbe5f839d5d635fe350a535155231d4050c2" +source = "git+https://github.com/StarArawn/bevy?rev=f3c82f2b0091aefa832ab45eaf15c2be2faa0785#f3c82f2b0091aefa832ab45eaf15c2be2faa0785" dependencies = [ "android_log-sys", "bevy_app", @@ -464,7 +464,7 @@ dependencies = [ [[package]] name = "bevy_macro_utils" version = "0.5.0" -source = "git+https://github.com/StarArawn/bevy?rev=146ddbe5f839d5d635fe350a535155231d4050c2#146ddbe5f839d5d635fe350a535155231d4050c2" +source = "git+https://github.com/StarArawn/bevy?rev=f3c82f2b0091aefa832ab45eaf15c2be2faa0785#f3c82f2b0091aefa832ab45eaf15c2be2faa0785" dependencies = [ "cargo-manifest", "quote 1.0.10", @@ -474,7 +474,7 @@ dependencies = [ [[package]] name = "bevy_math" version = "0.5.0" -source = "git+https://github.com/StarArawn/bevy?rev=146ddbe5f839d5d635fe350a535155231d4050c2#146ddbe5f839d5d635fe350a535155231d4050c2" +source = "git+https://github.com/StarArawn/bevy?rev=f3c82f2b0091aefa832ab45eaf15c2be2faa0785#f3c82f2b0091aefa832ab45eaf15c2be2faa0785" dependencies = [ "bevy_reflect", "glam", @@ -483,7 +483,7 @@ dependencies = [ [[package]] name = "bevy_pbr" version = "0.5.0" -source = "git+https://github.com/StarArawn/bevy?rev=146ddbe5f839d5d635fe350a535155231d4050c2#146ddbe5f839d5d635fe350a535155231d4050c2" +source = "git+https://github.com/StarArawn/bevy?rev=f3c82f2b0091aefa832ab45eaf15c2be2faa0785#f3c82f2b0091aefa832ab45eaf15c2be2faa0785" dependencies = [ "bevy_app", "bevy_asset", @@ -499,7 +499,7 @@ dependencies = [ [[package]] name = "bevy_pbr2" version = "0.5.0" -source = "git+https://github.com/StarArawn/bevy?rev=146ddbe5f839d5d635fe350a535155231d4050c2#146ddbe5f839d5d635fe350a535155231d4050c2" +source = "git+https://github.com/StarArawn/bevy?rev=f3c82f2b0091aefa832ab45eaf15c2be2faa0785#f3c82f2b0091aefa832ab45eaf15c2be2faa0785" dependencies = [ "bevy_app", "bevy_asset", @@ -520,7 +520,7 @@ dependencies = [ [[package]] name = "bevy_reflect" version = "0.5.0" -source = "git+https://github.com/StarArawn/bevy?rev=146ddbe5f839d5d635fe350a535155231d4050c2#146ddbe5f839d5d635fe350a535155231d4050c2" +source = "git+https://github.com/StarArawn/bevy?rev=f3c82f2b0091aefa832ab45eaf15c2be2faa0785#f3c82f2b0091aefa832ab45eaf15c2be2faa0785" dependencies = [ "bevy_reflect_derive", "bevy_utils", @@ -536,7 +536,7 @@ dependencies = [ [[package]] name = "bevy_reflect_derive" version = "0.5.0" -source = "git+https://github.com/StarArawn/bevy?rev=146ddbe5f839d5d635fe350a535155231d4050c2#146ddbe5f839d5d635fe350a535155231d4050c2" +source = "git+https://github.com/StarArawn/bevy?rev=f3c82f2b0091aefa832ab45eaf15c2be2faa0785#f3c82f2b0091aefa832ab45eaf15c2be2faa0785" dependencies = [ "bevy_macro_utils", "proc-macro2 1.0.32", @@ -548,7 +548,7 @@ dependencies = [ [[package]] name = "bevy_render" version = "0.5.0" -source = "git+https://github.com/StarArawn/bevy?rev=146ddbe5f839d5d635fe350a535155231d4050c2#146ddbe5f839d5d635fe350a535155231d4050c2" +source = "git+https://github.com/StarArawn/bevy?rev=f3c82f2b0091aefa832ab45eaf15c2be2faa0785#f3c82f2b0091aefa832ab45eaf15c2be2faa0785" dependencies = [ "anyhow", "bevy-glsl-to-spirv", @@ -578,7 +578,7 @@ dependencies = [ [[package]] name = "bevy_render2" version = "0.5.0" -source = "git+https://github.com/StarArawn/bevy?rev=146ddbe5f839d5d635fe350a535155231d4050c2#146ddbe5f839d5d635fe350a535155231d4050c2" +source = "git+https://github.com/StarArawn/bevy?rev=f3c82f2b0091aefa832ab45eaf15c2be2faa0785#f3c82f2b0091aefa832ab45eaf15c2be2faa0785" dependencies = [ "anyhow", "bevy_app", @@ -611,7 +611,7 @@ dependencies = [ [[package]] name = "bevy_scene" version = "0.5.0" -source = "git+https://github.com/StarArawn/bevy?rev=146ddbe5f839d5d635fe350a535155231d4050c2#146ddbe5f839d5d635fe350a535155231d4050c2" +source = "git+https://github.com/StarArawn/bevy?rev=f3c82f2b0091aefa832ab45eaf15c2be2faa0785#f3c82f2b0091aefa832ab45eaf15c2be2faa0785" dependencies = [ "anyhow", "bevy_app", @@ -629,7 +629,7 @@ dependencies = [ [[package]] name = "bevy_sprite" version = "0.5.0" -source = "git+https://github.com/StarArawn/bevy?rev=146ddbe5f839d5d635fe350a535155231d4050c2#146ddbe5f839d5d635fe350a535155231d4050c2" +source = "git+https://github.com/StarArawn/bevy?rev=f3c82f2b0091aefa832ab45eaf15c2be2faa0785#f3c82f2b0091aefa832ab45eaf15c2be2faa0785" dependencies = [ "bevy_app", "bevy_asset", @@ -652,7 +652,7 @@ dependencies = [ [[package]] name = "bevy_sprite2" version = "0.5.0" -source = "git+https://github.com/StarArawn/bevy?rev=146ddbe5f839d5d635fe350a535155231d4050c2#146ddbe5f839d5d635fe350a535155231d4050c2" +source = "git+https://github.com/StarArawn/bevy?rev=f3c82f2b0091aefa832ab45eaf15c2be2faa0785#f3c82f2b0091aefa832ab45eaf15c2be2faa0785" dependencies = [ "bevy_app", "bevy_asset", @@ -676,7 +676,7 @@ dependencies = [ [[package]] name = "bevy_tasks" version = "0.5.0" -source = "git+https://github.com/StarArawn/bevy?rev=146ddbe5f839d5d635fe350a535155231d4050c2#146ddbe5f839d5d635fe350a535155231d4050c2" +source = "git+https://github.com/StarArawn/bevy?rev=f3c82f2b0091aefa832ab45eaf15c2be2faa0785#f3c82f2b0091aefa832ab45eaf15c2be2faa0785" dependencies = [ "async-channel", "async-executor", @@ -689,7 +689,7 @@ dependencies = [ [[package]] name = "bevy_text" version = "0.5.0" -source = "git+https://github.com/StarArawn/bevy?rev=146ddbe5f839d5d635fe350a535155231d4050c2#146ddbe5f839d5d635fe350a535155231d4050c2" +source = "git+https://github.com/StarArawn/bevy?rev=f3c82f2b0091aefa832ab45eaf15c2be2faa0785#f3c82f2b0091aefa832ab45eaf15c2be2faa0785" dependencies = [ "ab_glyph", "anyhow", @@ -711,7 +711,7 @@ dependencies = [ [[package]] name = "bevy_transform" version = "0.5.0" -source = "git+https://github.com/StarArawn/bevy?rev=146ddbe5f839d5d635fe350a535155231d4050c2#146ddbe5f839d5d635fe350a535155231d4050c2" +source = "git+https://github.com/StarArawn/bevy?rev=f3c82f2b0091aefa832ab45eaf15c2be2faa0785#f3c82f2b0091aefa832ab45eaf15c2be2faa0785" dependencies = [ "bevy_app", "bevy_ecs", @@ -724,7 +724,7 @@ dependencies = [ [[package]] name = "bevy_ui" version = "0.5.0" -source = "git+https://github.com/StarArawn/bevy?rev=146ddbe5f839d5d635fe350a535155231d4050c2#146ddbe5f839d5d635fe350a535155231d4050c2" +source = "git+https://github.com/StarArawn/bevy?rev=f3c82f2b0091aefa832ab45eaf15c2be2faa0785#f3c82f2b0091aefa832ab45eaf15c2be2faa0785" dependencies = [ "bevy_app", "bevy_asset", @@ -748,7 +748,7 @@ dependencies = [ [[package]] name = "bevy_utils" version = "0.5.0" -source = "git+https://github.com/StarArawn/bevy?rev=146ddbe5f839d5d635fe350a535155231d4050c2#146ddbe5f839d5d635fe350a535155231d4050c2" +source = "git+https://github.com/StarArawn/bevy?rev=f3c82f2b0091aefa832ab45eaf15c2be2faa0785#f3c82f2b0091aefa832ab45eaf15c2be2faa0785" dependencies = [ "ahash", "bevy_derive", @@ -761,7 +761,7 @@ dependencies = [ [[package]] name = "bevy_wgpu" version = "0.5.0" -source = "git+https://github.com/StarArawn/bevy?rev=146ddbe5f839d5d635fe350a535155231d4050c2#146ddbe5f839d5d635fe350a535155231d4050c2" +source = "git+https://github.com/StarArawn/bevy?rev=f3c82f2b0091aefa832ab45eaf15c2be2faa0785#f3c82f2b0091aefa832ab45eaf15c2be2faa0785" dependencies = [ "bevy_app", "bevy_asset", @@ -782,7 +782,7 @@ dependencies = [ [[package]] name = "bevy_window" version = "0.5.0" -source = "git+https://github.com/StarArawn/bevy?rev=146ddbe5f839d5d635fe350a535155231d4050c2#146ddbe5f839d5d635fe350a535155231d4050c2" +source = "git+https://github.com/StarArawn/bevy?rev=f3c82f2b0091aefa832ab45eaf15c2be2faa0785#f3c82f2b0091aefa832ab45eaf15c2be2faa0785" dependencies = [ "bevy_app", "bevy_math", @@ -794,7 +794,7 @@ dependencies = [ [[package]] name = "bevy_winit" version = "0.5.0" -source = "git+https://github.com/StarArawn/bevy?rev=146ddbe5f839d5d635fe350a535155231d4050c2#146ddbe5f839d5d635fe350a535155231d4050c2" +source = "git+https://github.com/StarArawn/bevy?rev=f3c82f2b0091aefa832ab45eaf15c2be2faa0785#f3c82f2b0091aefa832ab45eaf15c2be2faa0785" dependencies = [ "approx", "bevy_app", @@ -1209,7 +1209,7 @@ dependencies = [ [[package]] name = "crevice" version = "0.8.0" -source = "git+https://github.com/StarArawn/bevy?rev=146ddbe5f839d5d635fe350a535155231d4050c2#146ddbe5f839d5d635fe350a535155231d4050c2" +source = "git+https://github.com/StarArawn/bevy?rev=f3c82f2b0091aefa832ab45eaf15c2be2faa0785#f3c82f2b0091aefa832ab45eaf15c2be2faa0785" dependencies = [ "bytemuck", "crevice-derive", @@ -1220,7 +1220,7 @@ dependencies = [ [[package]] name = "crevice-derive" version = "0.8.0" -source = "git+https://github.com/StarArawn/bevy?rev=146ddbe5f839d5d635fe350a535155231d4050c2#146ddbe5f839d5d635fe350a535155231d4050c2" +source = "git+https://github.com/StarArawn/bevy?rev=f3c82f2b0091aefa832ab45eaf15c2be2faa0785#f3c82f2b0091aefa832ab45eaf15c2be2faa0785" dependencies = [ "proc-macro2 1.0.32", "quote 1.0.10", diff --git a/Cargo.toml b/Cargo.toml index 1e3c3c6..d738344 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -17,5 +17,5 @@ kayak_components = { path = "kayak_components" } kayak_core = { path = "kayak_core" } [dev-dependencies] -bevy = { git = "https://github.com/StarArawn/bevy", rev = "146ddbe5f839d5d635fe350a535155231d4050c2" } +bevy = { git = "https://github.com/StarArawn/bevy", rev = "f3c82f2b0091aefa832ab45eaf15c2be2faa0785" } bevy_kayak_ui = { path = "bevy_kayak_ui" } diff --git a/bevy_kayak_ui/Cargo.toml b/bevy_kayak_ui/Cargo.toml index 6a9445a..b9c9c2d 100644 --- a/bevy_kayak_ui/Cargo.toml +++ b/bevy_kayak_ui/Cargo.toml @@ -5,12 +5,12 @@ edition = "2021" [dependencies] bytemuck = "1.7.2" -bevy = { git = "https://github.com/StarArawn/bevy", rev = "146ddbe5f839d5d635fe350a535155231d4050c2" } +bevy = { git = "https://github.com/StarArawn/bevy", rev = "f3c82f2b0091aefa832ab45eaf15c2be2faa0785" } kayak_core = { path = "../kayak_core" } kayak_components = { path = "../kayak_components" } kayak_render_macros = { path = "../kayak_render_macros" } kayak_font = { path = "../kayak_font" } -crevice = { git = "https://github.com/StarArawn/bevy", rev = "146ddbe5f839d5d635fe350a535155231d4050c2" } +crevice = { git = "https://github.com/StarArawn/bevy", rev = "f3c82f2b0091aefa832ab45eaf15c2be2faa0785" } serde = "1.0" serde_json = "1.0" serde_path_to_error = "0.1" diff --git a/bevy_kayak_ui/src/render/unified/font/extract.rs b/bevy_kayak_ui/src/render/unified/font/extract.rs index 43bce7d..a4593ca 100644 --- a/bevy_kayak_ui/src/render/unified/font/extract.rs +++ b/bevy_kayak_ui/src/render/unified/font/extract.rs @@ -102,7 +102,7 @@ pub fn extract_texts( .find(|glyph| glyph.unicode == c) { let plane_bounds = glyph.plane_bounds.as_ref(); - let (left, top, width, height) = match plane_bounds { + let (left, top, _width, _height) = match plane_bounds { Some(val) => ( val.left, val.top, @@ -116,8 +116,6 @@ pub fn extract_texts( let resized_max_glyph_size = (max_glyph_size.x * font_ratio, max_glyph_size.y * font_ratio); - let shift_y = resized_max_glyph_size.1 - height; - let position_x = layout.posx + x + left * font_size; let position_y = (layout.posy + (-top * font_size)) + font_size; extracted_texts.push(ExtractQuadBundle { diff --git a/bevy_kayak_ui/src/render/unified/font/font_texture_cache.rs b/bevy_kayak_ui/src/render/unified/font/font_texture_cache.rs index f9d526c..f62e5e0 100644 --- a/bevy_kayak_ui/src/render/unified/font/font_texture_cache.rs +++ b/bevy_kayak_ui/src/render/unified/font/font_texture_cache.rs @@ -1,6 +1,6 @@ use bevy::{ math::Vec2, - prelude::{Assets, Handle, Res}, + prelude::{Handle, Res}, render2::{ render_asset::RenderAssets, render_resource::{ @@ -179,7 +179,7 @@ impl FontTextureCache { let texture_view = texture.create_view(&TextureViewDescriptor { label: Some("font_texture_array_view"), - format: None, + format: Some(format), dimension: Some(TextureViewDimension::D2Array), aspect: bevy::render2::render_resource::TextureAspect::All, base_mip_level: 0, @@ -339,7 +339,7 @@ impl FontTextureCache { // Now fill the texture data. - let atlas_width = sdf.atlas.width; + let _atlas_width = sdf.atlas.width; let atlas_height = sdf.atlas.height; for (i, glyph) in sdf.glyphs.iter().enumerate() { diff --git a/bevy_kayak_ui/src/render/unified/font/mod.rs b/bevy_kayak_ui/src/render/unified/font/mod.rs index 8b2a9ff..c00c84a 100644 --- a/bevy_kayak_ui/src/render/unified/font/mod.rs +++ b/bevy_kayak_ui/src/render/unified/font/mod.rs @@ -92,15 +92,17 @@ pub fn set_font_texture( for event in texture_events.iter() { match event { AssetEvent::Created { handle } => { - let handle_path = asset_server.get_handle_path(handle).unwrap(); - if handle_path.path().to_str().unwrap().contains("roboto") { - if let Some(mut texture) = textures.get_mut(handle) { - texture.texture_descriptor.format = TextureFormat::Rgba8Unorm; - texture.sampler_descriptor.min_filter = FilterMode::Linear; - texture.sampler_descriptor.mipmap_filter = FilterMode::Linear; - texture.sampler_descriptor.mag_filter = FilterMode::Linear; - texture.texture_descriptor.usage = - TextureUsages::COPY_DST | TextureUsages::COPY_SRC; + if let Some(handle_path) = asset_server.get_handle_path(handle) { + if handle_path.path().to_str().unwrap().contains("roboto") { + if let Some(mut texture) = textures.get_mut(handle) { + texture.texture_descriptor.format = TextureFormat::Rgba8Unorm; + texture.sampler_descriptor.min_filter = FilterMode::Linear; + texture.sampler_descriptor.mipmap_filter = FilterMode::Linear; + texture.sampler_descriptor.mag_filter = FilterMode::Linear; + texture.texture_descriptor.usage = TextureUsages::TEXTURE_BINDING + | TextureUsages::COPY_DST + | TextureUsages::COPY_SRC; + } } } } @@ -114,7 +116,7 @@ fn extract_fonts( mut commands: Commands, font_assets: Res<Assets<KayakFont>>, mut events: EventReader<AssetEvent<KayakFont>>, - mut textures: ResMut<Assets<Image>>, + textures: Res<Assets<Image>>, ) { let mut extracted_fonts = ExtractedFonts { fonts: Vec::new() }; let mut changed_assets = HashSet::default(); diff --git a/bevy_kayak_ui/src/render/unified/font/sdf/mod.rs b/bevy_kayak_ui/src/render/unified/font/sdf/mod.rs index 2a9ccf3..07f9b9a 100644 --- a/bevy_kayak_ui/src/render/unified/font/sdf/mod.rs +++ b/bevy_kayak_ui/src/render/unified/font/sdf/mod.rs @@ -1,22 +1,7 @@ -use crate::render::unified::pipeline::UnifiedPipeline; - -use self::{ - atlas::Atlas, - glyph::{Glyph, Rect}, - metrics::Metrics, -}; -use bevy::{ - math::Vec2, - prelude::Handle, - render2::{ - renderer::{RenderDevice, RenderQueue}, - texture::GpuImage, - }, -}; +use self::{atlas::Atlas, glyph::Glyph, metrics::Metrics}; +use bevy::math::Vec2; use serde::Deserialize; -use super::{FontTextureCache, KayakFont}; - mod atlas; mod glyph; mod metrics; diff --git a/bevy_kayak_ui/src/render/unified/pipeline.rs b/bevy_kayak_ui/src/render/unified/pipeline.rs index a787e71..61c1bc1 100644 --- a/bevy_kayak_ui/src/render/unified/pipeline.rs +++ b/bevy_kayak_ui/src/render/unified/pipeline.rs @@ -102,7 +102,7 @@ impl FromWorld for UnifiedPipeline { visibility: ShaderStages::FRAGMENT, ty: BindingType::Texture { multisampled: false, - sample_type: TextureSampleType::Float { filterable: false }, + sample_type: TextureSampleType::Float { filterable: true }, view_dimension: TextureViewDimension::D2Array, }, count: None, @@ -127,7 +127,7 @@ impl FromWorld for UnifiedPipeline { visibility: ShaderStages::FRAGMENT, ty: BindingType::Texture { multisampled: false, - sample_type: TextureSampleType::Float { filterable: false }, + sample_type: TextureSampleType::Float { filterable: true }, view_dimension: TextureViewDimension::D2, }, count: None, @@ -247,7 +247,7 @@ impl FromWorld for UnifiedPipeline { let texture_view = texture.create_view(&TextureViewDescriptor { label: Some("font_texture_array_view"), - format: None, + format: Some(TextureFormat::Rgba8UnormSrgb), dimension: Some(TextureViewDimension::D2), aspect: bevy::render2::render_resource::TextureAspect::All, base_mip_level: 0, diff --git a/kayak_core/src/lib.rs b/kayak_core/src/lib.rs index fe2cc7f..43a1b59 100644 --- a/kayak_core/src/lib.rs +++ b/kayak_core/src/lib.rs @@ -15,6 +15,7 @@ pub mod widget_manager; use std::sync::{Arc, RwLock}; +pub use context::*; pub use event::*; pub use fragment::Fragment; pub use generational_arena::{Arena, Index}; diff --git a/kayak_font/src/font.rs b/kayak_font/src/font.rs index cd0e705..81f4977 100644 --- a/kayak_font/src/font.rs +++ b/kayak_font/src/font.rs @@ -251,8 +251,8 @@ fn get_new_size(org_width: f32, new_width: f32, org_height: f32, new_height: f32 } pub fn calculate_ratio(org_width: f32, new_width: f32, org_height: f32, new_height: f32) -> f32 { - let mut area_size = 0.0; - let mut image_size = 0.0; + let area_size; + let image_size; if new_height * org_width > new_width * org_height { area_size = new_height; diff --git a/kayak_font/src/lib.rs b/kayak_font/src/lib.rs index 07499ca..6a97d01 100644 --- a/kayak_font/src/lib.rs +++ b/kayak_font/src/lib.rs @@ -1,3 +1,4 @@ +#![allow(dead_code)] mod color_flags; mod contour; mod font; diff --git a/kayak_render_macros/src/children.rs b/kayak_render_macros/src/children.rs index 88dd8dc..7849982 100644 --- a/kayak_render_macros/src/children.rs +++ b/kayak_render_macros/src/children.rs @@ -95,8 +95,6 @@ impl Children { } } _ => { - let mut iter = children_quotes.iter(); - // First get shared and non-shared attributes.. let mut child_attributes_list = Vec::new(); for i in 0..children_quotes.len() { @@ -218,41 +216,41 @@ impl ToTokens for Children { // Takes two incoming attribute streams like: "styles foo bar" and "styles" and resolves // them into three separate lists like: "foo bar", "", and "styles" -fn handle_tuple_attributes( - a: &Vec<proc_macro2::TokenStream>, - b: &Vec<proc_macro2::TokenStream>, -) -> ( - Vec<proc_macro2::TokenStream>, - Vec<proc_macro2::TokenStream>, - Vec<proc_macro2::TokenStream>, -) { - let mut stream1: Vec<String> = a.iter().map(|a| a.to_string()).collect(); - let mut stream2: Vec<String> = b.iter().map(|b| b.to_string()).collect(); - let matching1: Vec<&String> = stream1 - .iter() - .filter(|a| stream2.iter().any(|b| *a == b)) - .collect(); - let matching2: Vec<&String> = stream2 - .iter() - .filter(|a| stream1.iter().any(|b| *a == b)) - .collect(); - let mut matching: Vec<String> = Vec::new(); - matching.extend(matching1.iter().map(|x| (*x).clone()).collect::<Vec<_>>()); - matching.extend(matching2.iter().map(|x| (*x).clone()).collect::<Vec<_>>()); - matching.sort_unstable(); - matching.dedup_by(|a, b| a.eq(&b)); - - stream1 = stream1 - .into_iter() - .filter(|a| !matching.iter().any(|b| a == b)) - .collect(); - stream2 = stream2 - .into_iter() - .filter(|a| !matching.iter().any(|b| a == b)) - .collect(); - - let matching = matching.iter().map(|m| m.parse().unwrap()).collect(); - let stream1 = stream1.iter().map(|m| m.parse().unwrap()).collect(); - let stream2 = stream2.iter().map(|m| m.parse().unwrap()).collect(); - (stream1, stream2, matching) -} +// fn handle_tuple_attributes( +// a: &Vec<proc_macro2::TokenStream>, +// b: &Vec<proc_macro2::TokenStream>, +// ) -> ( +// Vec<proc_macro2::TokenStream>, +// Vec<proc_macro2::TokenStream>, +// Vec<proc_macro2::TokenStream>, +// ) { +// let mut stream1: Vec<String> = a.iter().map(|a| a.to_string()).collect(); +// let mut stream2: Vec<String> = b.iter().map(|b| b.to_string()).collect(); +// let matching1: Vec<&String> = stream1 +// .iter() +// .filter(|a| stream2.iter().any(|b| *a == b)) +// .collect(); +// let matching2: Vec<&String> = stream2 +// .iter() +// .filter(|a| stream1.iter().any(|b| *a == b)) +// .collect(); +// let mut matching: Vec<String> = Vec::new(); +// matching.extend(matching1.iter().map(|x| (*x).clone()).collect::<Vec<_>>()); +// matching.extend(matching2.iter().map(|x| (*x).clone()).collect::<Vec<_>>()); +// matching.sort_unstable(); +// matching.dedup_by(|a, b| a.eq(&b)); + +// stream1 = stream1 +// .into_iter() +// .filter(|a| !matching.iter().any(|b| a == b)) +// .collect(); +// stream2 = stream2 +// .into_iter() +// .filter(|a| !matching.iter().any(|b| a == b)) +// .collect(); + +// let matching = matching.iter().map(|m| m.parse().unwrap()).collect(); +// let stream1 = stream1.iter().map(|m| m.parse().unwrap()).collect(); +// let stream2 = stream2.iter().map(|m| m.parse().unwrap()).collect(); +// (stream1, stream2, matching) +// } -- GitLab