mirror of
https://github.com/griffi-gh/hUI.git
synced 2024-11-25 16:38:42 -06:00
add custom slider as an example
This commit is contained in:
parent
1666b08873
commit
bfb5bfaa0a
|
@ -2,7 +2,7 @@ use std::time::Instant;
|
||||||
use glam::vec2;
|
use glam::vec2;
|
||||||
use hui::{
|
use hui::{
|
||||||
color, element::{
|
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
|
}, frame::nine_patch::{NinePatchAsset, NinePatchFrame}, frame_rect, layout::{Alignment, Direction}, rect::Rect, size
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -56,6 +56,14 @@ ui_main!(
|
||||||
(0., 0., 1.),
|
(0., 0., 1.),
|
||||||
)))
|
)))
|
||||||
.add_child(ui);
|
.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);
|
.add_root(ui, size);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue