Added display callback, restoring full functionality

This commit is contained in:
skyeshroom
2021-08-12 10:52:21 -07:00
parent 1801cb9d80
commit 4faaf7d2c1
4 changed files with 17 additions and 13 deletions

View File

@@ -100,7 +100,7 @@ pub mod core {
}
/// Initializes and runs the simulation using a user-supplied callback as the update logic
pub fn run(&mut self, mut update_callback: impl FnMut(&mut State)) {
pub fn run(&mut self, mut update_callback: impl FnMut(&mut State), mut display_callback: impl FnMut(&State)) {
// Make sure the simulation will run
self.state.simulate = true;
@@ -133,7 +133,7 @@ pub mod core {
// display
if self.realtime {
display(delta_time(self.state.last_tick), self.state.timescale, self.state.update_interval);
display_callback(&self.state);
}
}
}