From e9cfd19c01f0388e0ae40acf290bbe30334f778e Mon Sep 17 00:00:00 2001 From: griffi-gh Date: Mon, 19 Feb 2024 23:13:35 +0100 Subject: [PATCH] restructure stuff, add `builtin_container` feature --- hui/Cargo.toml | 6 ++++-- hui/src/element.rs | 11 +---------- hui/src/element/builtin.rs | 14 ++++++++++++++ 3 files changed, 19 insertions(+), 12 deletions(-) create mode 100644 hui/src/element/builtin.rs diff --git a/hui/Cargo.toml b/hui/Cargo.toml index ecd6c67..f0518aa 100644 --- a/hui/Cargo.toml +++ b/hui/Cargo.toml @@ -29,8 +29,10 @@ document-features = "0.2" default = ["builtin_elements", "builtin_font", "pixel_perfect"] ## Enable the built-in font (ProggyTiny, adds 35kb to the executable) builtin_font = [] -## Enable the built-in elements (`Container`, `ProgressBar`, etc.) -builtin_elements = [] +## Enable the built-in elements (`Container`, `ProgressBar`, etc.)\ +builtin_elements = ["builtin_container"] +## Enable only the `Container` component (which is essential for laying out other components) +builtin_container = [] ## Round vertex positions to nearest integer coordinates (fixes blurry text) pixel_perfect = [] diff --git a/hui/src/element.rs b/hui/src/element.rs index ae76851..b1acc3c 100644 --- a/hui/src/element.rs +++ b/hui/src/element.rs @@ -7,16 +7,7 @@ use crate::{ LayoutInfo }; -#[cfg(feature = "builtin_elements")] -mod builtin { - pub mod rect; - pub mod container; - pub mod spacer; - pub mod progress_bar; - pub mod text; -} - -#[cfg(feature = "builtin_elements")] +mod builtin; pub use builtin::*; pub struct MeasureContext<'a> { diff --git a/hui/src/element/builtin.rs b/hui/src/element/builtin.rs new file mode 100644 index 0000000..6f8fe6f --- /dev/null +++ b/hui/src/element/builtin.rs @@ -0,0 +1,14 @@ +#[cfg(feature = "builtin_container")] +pub mod container; + +#[cfg(feature = "builtin_elements")] +pub mod rect; + +#[cfg(feature = "builtin_elements")] +pub mod spacer; + +#[cfg(feature = "builtin_elements")] +pub mod progress_bar; + +#[cfg(feature = "builtin_elements")] +pub mod text;