From bfb5bfaa0ace265ae70390da7f58a7879ca46141 Mon Sep 17 00:00:00 2001 From: griffi-gh Date: Mon, 25 Mar 2024 02:05:26 +0100 Subject: [PATCH] add custom slider as an example --- hui-examples/examples/ui_test_7_9patch.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/hui-examples/examples/ui_test_7_9patch.rs b/hui-examples/examples/ui_test_7_9patch.rs index d85b7b0..502c265 100644 --- a/hui-examples/examples/ui_test_7_9patch.rs +++ b/hui-examples/examples/ui_test_7_9patch.rs @@ -2,7 +2,7 @@ use std::time::Instant; use glam::vec2; use hui::{ color, element::{ - container::Container, fill_rect::FillRect, text::Text, UiElementExt + container::Container, fill_rect::FillRect, slider::Slider, text::Text, UiElementExt }, frame::nine_patch::{NinePatchAsset, NinePatchFrame}, frame_rect, layout::{Alignment, Direction}, rect::Rect, size }; @@ -56,6 +56,14 @@ ui_main!( (0., 0., 1.), ))) .add_child(ui); + Slider::new(0.33) + .with_size(size!(50%, 30)) + .with_track_height(1.) + .with_handle_size((20., 0.9)) + .with_handle(NinePatchFrame::from_asset(*asset).with_color(color::CYAN)) + .with_track(NinePatchFrame::from_asset(*asset)) + .with_track_active(color::TRANSPARENT) + .add_child(ui); }) .add_root(ui, size); }