From dc3f89db370be9364457ac68166b043f36590bd5 Mon Sep 17 00:00:00 2001 From: griffi-gh Date: Mon, 11 Mar 2024 20:52:25 +0100 Subject: [PATCH] make arg mut --- hui-examples/boilerplate.rs | 2 +- hui-examples/examples/ui_test_5_input.rs | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/hui-examples/boilerplate.rs b/hui-examples/boilerplate.rs index e40b817..afc36bd 100644 --- a/hui-examples/boilerplate.rs +++ b/hui-examples/boilerplate.rs @@ -29,7 +29,7 @@ macro_rules! ui_main { /// Initializes glium renderer, `UiInstance`, and runs the event loop. pub fn ui( 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(); diff --git a/hui-examples/examples/ui_test_5_input.rs b/hui-examples/examples/ui_test_5_input.rs index 22237b2..93fe27a 100644 --- a/hui-examples/examples/ui_test_5_input.rs +++ b/hui-examples/examples/ui_test_5_input.rs @@ -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); })