make arg mut

This commit is contained in:
griffi-gh 2024-03-11 20:52:25 +01:00
parent 2d59f76ba7
commit 197b327b1f
2 changed files with 6 additions and 3 deletions

View file

@ -29,7 +29,7 @@ macro_rules! ui_main {
/// Initializes glium renderer, `UiInstance`, and runs the event loop.
pub fn ui<T>(
mut init: impl FnMut(&mut UiInstance) -> T,
mut draw: impl FnMut(&mut UiInstance, Vec2, &T),
mut draw: impl FnMut(&mut UiInstance, Vec2, &mut T),
name: &'static str
) {
kubi_logging::init();

View file

@ -16,8 +16,10 @@ mod boilerplate;
ui_main!(
"hUI: Internal input test",
init: |_| {},
run: |ui, size, _| {
init: |_| {
0
},
run: |ui, size, n| {
Container::default()
.with_size(size!(100%))
.with_align(Alignment::Center)
@ -30,6 +32,7 @@ ui_main!(
.into_interactable()
.on_click(|| {
println!("clicked");
*n += 1;
})
.add_child(ui);
})