mirror of
https://github.com/griffi-gh/hUI.git
synced 2024-11-21 22:58:42 -06:00
update example 5
This commit is contained in:
parent
f514746ecc
commit
ad89088557
|
@ -34,12 +34,17 @@ ui_main!(
|
||||||
run: |ui, size, (ref mut counter, image)| {
|
run: |ui, size, (ref mut counter, image)| {
|
||||||
Container::default()
|
Container::default()
|
||||||
.with_size(size!(100%))
|
.with_size(size!(100%))
|
||||||
.with_align(Alignment::Center)
|
.with_padding(10.)
|
||||||
|
.with_align((Alignment::Center, Alignment::Begin))
|
||||||
.with_direction(Direction::Horizontal)
|
.with_direction(Direction::Horizontal)
|
||||||
.with_gap(5.)
|
.with_gap(5.)
|
||||||
.with_background((0.1, 0.1, 0.1))
|
.with_background((0.1, 0.1, 0.1))
|
||||||
.with_wrap(true)
|
.with_wrap(true)
|
||||||
.with_children(|ui| {
|
.with_children(|ui| {
|
||||||
|
Text::new("Number of images:")
|
||||||
|
.with_text_size(24)
|
||||||
|
.add_child(ui);
|
||||||
|
Br.add_child(ui);
|
||||||
Container::default()
|
Container::default()
|
||||||
.with_padding(10.)
|
.with_padding(10.)
|
||||||
.with_background(color::ORANGE)
|
.with_background(color::ORANGE)
|
||||||
|
@ -78,11 +83,9 @@ ui_main!(
|
||||||
})
|
})
|
||||||
.add_root(ui, size);
|
.add_root(ui, size);
|
||||||
|
|
||||||
ui.process_signals(|sig| {
|
ui.process_signals(|sig| match sig {
|
||||||
match sig {
|
CounterSignal::Increment => *counter += 1,
|
||||||
CounterSignal::Increment => *counter += 1,
|
CounterSignal::Decrement => *counter -= 1,
|
||||||
CounterSignal::Decrement => *counter -= 1,
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in a new issue