From 16af20269e5de56752eeb5aa4b276ddc6c131156 Mon Sep 17 00:00:00 2001 From: Jonathan Johnson Date: Thu, 7 Dec 2023 15:49:03 -0800 Subject: [PATCH] Updated figures + kludgine --- Cargo.lock | 78 ++++++++++++++++--------------------------- Cargo.toml | 1 - examples/tilemap.rs | 5 +-- src/animation.rs | 19 ++++++++--- src/widgets/scroll.rs | 3 +- 5 files changed, 47 insertions(+), 59 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index bdfeb27..0d20f8d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -394,9 +394,9 @@ dependencies = [ [[package]] name = "concurrent-queue" -version = "2.3.0" +version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f057a694a54f12365049b0958a1685bb52d567f5593b355fbf685838e873d400" +checksum = "d16048cd947b08fa32c24458a22f5dc5e835264f689f4f5653210c69fd107363" dependencies = [ "crossbeam-utils", ] @@ -524,29 +524,9 @@ dependencies = [ [[package]] name = "derive-where" -version = "1.2.5" +version = "1.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "146398d62142a0f35248a608f17edf0dde57338354966d6e41d0eb2d16980ccb" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "derive_more" -version = "1.0.0-beta.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7abbfc297053be59290e3152f8cbcd52c8642e0728b69ee187d991d4c1af08d" -dependencies = [ - "derive_more-impl", -] - -[[package]] -name = "derive_more-impl" -version = "1.0.0-beta.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2bba3e9872d7c58ce7ef0fcf1844fcc3e23ef2a58377b50df35dd98e42a5726e" +checksum = "48d9b1fc2a6d7e19c89e706a3769e31ee862ac7a4c810c7c0ff3910e1a42a4ce" dependencies = [ "proc-macro2", "quote", @@ -643,7 +623,7 @@ dependencies = [ [[package]] name = "figures" version = "0.1.0" -source = "git+https://github.com/khonsulabs/figures#cd23383f82f89731c5f0d2dfadbc3ecd36d84f2c" +source = "git+https://github.com/khonsulabs/figures#1809e94c19e56aaf9df36d7553ffa9e65523369d" dependencies = [ "bytemuck", "euclid", @@ -825,7 +805,6 @@ dependencies = [ "ahash", "alot", "arboard", - "derive_more", "gooey-macros", "intentional", "interner", @@ -1077,7 +1056,7 @@ checksum = "e2db585e1d738fc771bf08a151420d3ed193d9d895a36df7f6f8a9456b911ddc" [[package]] name = "kludgine" version = "0.1.0" -source = "git+https://github.com/khonsulabs/kludgine#138997a46158d96509c466751d95d80988c6d7bd" +source = "git+https://github.com/khonsulabs/kludgine#abb5625c3557c3c3b22e088fe1523b1544e7ddb7" dependencies = [ "ahash", "alot", @@ -1195,9 +1174,9 @@ dependencies = [ [[package]] name = "lyon_tessellation" -version = "1.0.11" +version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23bcac20d47825850fabf1e869bf7c2bbe2daefa0776c3cd2eb7cb74635f6e4a" +checksum = "1f5bcf02928361d18e6edb8ad3bc5b93cba8aa57e2508deb072c2d2ade8bbd0d" dependencies = [ "float_next_after", "lyon_path", @@ -1334,9 +1313,9 @@ dependencies = [ [[package]] name = "naga" -version = "0.14.1" +version = "0.14.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6cd05939c491da968a42986204b7431678be21fdcd4b10cc84997ba130ada5a4" +checksum = "ae585df4b6514cf8842ac0f1ab4992edc975892704835b549cf818dc0191249e" dependencies = [ "bit-set", "bitflags 2.4.1", @@ -1499,9 +1478,9 @@ dependencies = [ [[package]] name = "objc-sys" -version = "0.3.1" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99e1d07c6eab1ce8b6382b8e3c7246fe117ff3f8b34be065f5ebace6749fe845" +checksum = "c7c71324e4180d0899963fc83d9d241ac39e699609fc1025a850aadac8257459" [[package]] name = "objc2" @@ -1548,9 +1527,9 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.18.0" +version = "1.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" +checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" [[package]] name = "orbclient" @@ -1736,10 +1715,11 @@ dependencies = [ [[package]] name = "proc-macro-crate" -version = "2.0.0" +version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e8366a6159044a37876a2b9817124296703c586a5c92e2c53751fa06d8d43e8" +checksum = "97dc5fea232fc28d2f597b37c4876b348a40e33f3b02cc975c8d006d78d94b1a" dependencies = [ + "toml_datetime", "toml_edit", ] @@ -2249,15 +2229,15 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "toml_datetime" -version = "0.6.5" +version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3550f4e9685620ac18a50ed434eb3aec30db8ba93b0287467bca5826ea25baf1" +checksum = "7cda73e2f1397b1262d6dfdcef8aafae14d1de7748d66822d3bfeeb6d03e5e4b" [[package]] name = "toml_edit" -version = "0.20.7" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70f427fce4d84c72b5b732388bf4a9f4531b53f74e2887e3ecb2481f68f66d81" +checksum = "396e4d48bbb2b7554c944bde63101b5ae446cff6ec4a24227428f15eb72ef338" dependencies = [ "indexmap", "toml_datetime", @@ -2339,9 +2319,9 @@ checksum = "17f77d76d837a7830fe1d4f12b7b4ba4192c1888001c7164257e4bc6d21d96b4" [[package]] name = "unicode-bidi" -version = "0.3.13" +version = "0.3.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92888ba5573ff080736b3648696b70cafad7d250551175acbaa4e0385b3e1460" +checksum = "6f2528f27a9eb2b21e69c95319b30bd0efd85d09c379741b0f78ea1d86be2416" [[package]] name = "unicode-bidi-mirroring" @@ -3040,9 +3020,9 @@ dependencies = [ [[package]] name = "winnow" -version = "0.5.19" +version = "0.5.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "829846f3e3db426d4cee4510841b71a8e58aa2a76b1132579487ae430ccd9c7b" +checksum = "b67b5f0a4e7a27a64c651977932b9dc5667ca7fc31ac44b03ed37a0cf42fdfff" dependencies = [ "memchr", ] @@ -3147,18 +3127,18 @@ checksum = "dd15f8e0dbb966fd9245e7498c7e9e5055d9e5c8b676b95bd67091cd11a1e697" [[package]] name = "zerocopy" -version = "0.7.28" +version = "0.7.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d6f15f7ade05d2a4935e34a457b936c23dc70a05cc1d97133dc99e7a3fe0f0e" +checksum = "5d075cf85bbb114e933343e087b92f2146bac0d55b534cbb8188becf0039948e" dependencies = [ "zerocopy-derive", ] [[package]] name = "zerocopy-derive" -version = "0.7.28" +version = "0.7.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbbad221e3f78500350ecbd7dfa4e63ef945c05f4c61cb7f4d3f84cd0bba649b" +checksum = "86cd5ca076997b97ef09d3ad65efe811fa68c9e874cb636ccb211223a813b0c2" dependencies = [ "proc-macro2", "quote", diff --git a/Cargo.toml b/Cargo.toml index c7f4237..11a2cb0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -26,7 +26,6 @@ tracing-subscriber = { version = "0.3", optional = true, features = [ palette = "0.7.3" ahash = "0.8.6" gooey-macros = { version = "0.1.0", path = "gooey-macros" } -derive_more = { version = "1.0.0-beta.6", features = ["from"] } arboard = "3.2.1" zeroize = "1.6.1" unicode-segmentation = "1.10.1" diff --git a/examples/tilemap.rs b/examples/tilemap.rs index 28938f5..a344d89 100644 --- a/examples/tilemap.rs +++ b/examples/tilemap.rs @@ -71,10 +71,7 @@ fn main() -> gooey::Result { layers.map_mut(|layers| { let pos = &mut layers.1[myself].position; - *pos += Point::new( - one_second_movement.x * elapsed.as_secs_f32(), - one_second_movement.y * elapsed.as_secs_f32(), - ); + *pos += one_second_movement.x * elapsed.as_secs_f32(); let rect = Rect::new(*pos - Size::squared(8.), Size::squared(16.)); layers.1[myself].color = diff --git a/src/animation.rs b/src/animation.rs index 5643913..2a404c7 100644 --- a/src/animation.rs +++ b/src/animation.rs @@ -49,7 +49,6 @@ use std::thread; use std::time::{Duration, Instant}; use alot::{LotId, Lots}; -use derive_more::From; use intentional::Cast; use kempt::Set; use kludgine::figures::units::{Lp, Px, UPx}; @@ -918,8 +917,8 @@ impl LinearInterpolate for Color { /// /// This wrapper can be used to add [`LinearInterpolate`] to types that normally /// don't support interpolation. -#[derive(Clone, Copy, Debug, Eq, PartialEq, Hash, Ord, PartialOrd, From)] -pub struct BinaryLerp(T); +#[derive(Clone, Copy, Debug, Eq, PartialEq, Hash, Ord, PartialOrd)] +pub struct BinaryLerp(pub T); impl LinearInterpolate for BinaryLerp where @@ -934,12 +933,18 @@ where } } +impl From for BinaryLerp { + fn from(value: T) -> Self { + Self(value) + } +} + /// A wrapper that implements [`LinearInterpolate`] such that the target value /// is immediately returned as long as percent is > 0. /// /// This wrapper can be used to add [`LinearInterpolate`] to types that normally /// don't support interpolation. -#[derive(Clone, Copy, Debug, Eq, PartialEq, Hash, Ord, PartialOrd, From)] +#[derive(Clone, Copy, Debug, Eq, PartialEq, Hash, Ord, PartialOrd)] pub struct ImmediateLerp(T); impl LinearInterpolate for ImmediateLerp @@ -955,6 +960,12 @@ where } } +impl From for ImmediateLerp { + fn from(value: T) -> Self { + Self(value) + } +} + /// Calculates the ratio of one value against a minimum and maximum. pub trait PercentBetween { /// Return the percentage that `self` is between `min` and `max`. diff --git a/src/widgets/scroll.rs b/src/widgets/scroll.rs index 8274899..cc9ae95 100644 --- a/src/widgets/scroll.rs +++ b/src/widgets/scroll.rs @@ -264,7 +264,8 @@ impl Widget for Scroll { context.invalidate_when_changed(&self.scroll); let mut scroll = self.scroll.lock(); let old_scroll = *scroll; - let new_scroll = Self::constrained_scroll(*scroll + amount.cast(), self.max_scroll.get()); + let new_scroll = + Self::constrained_scroll(*scroll + amount.cast::(), self.max_scroll.get()); if old_scroll == new_scroll { IGNORED } else {