drain remaining signals

This commit is contained in:
griffi-gh 2024-03-12 01:40:51 +01:00
parent de9f41c296
commit 509d39ddea
2 changed files with 9 additions and 0 deletions

View file

@ -153,6 +153,9 @@ impl UiInstance {
//first, drain and process the event queue
self.input.update_state(&mut self.events);
//then, reset the (remaining) signals
self.signal.clear();
//then, reset the draw commands
std::mem::swap(&mut self.prev_draw_commands, &mut self.draw_commands);
self.draw_commands.commands.clear();

View file

@ -46,4 +46,10 @@ impl SignalStore {
.drain(..)
.map(|x| *x.downcast::<T>().unwrap()) //unchecked?
}
/// Clear all signals
pub(crate) fn clear(&mut self) {
//XXX: should we clear the vecs instead?
self.sig.clear();
}
}