From 915d17da80ad1402ad93225c60fa43363969a10a Mon Sep 17 00:00:00 2001 From: skyeshroom <61299664+skyeshroom@users.noreply.github.com> Date: Thu, 12 Aug 2021 13:43:39 -0700 Subject: [PATCH] Added getter + setter for update interval --- src/lib.rs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/lib.rs b/src/lib.rs index 0a360d1..7e13e94 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -36,7 +36,12 @@ pub mod core { new_state } - /// Returns the current "delta time", the time elapsed since the last update tick in milliseconds + /// Returns the "update interval", the minimum time (in ms) which will elapse between update ticks + pub fn get_update_interval(self) -> u32 { + self.update_interval + } + + /// Returns the current "delta time", the time (in ms) elapsed since the last update tick pub fn get_delta_time(self) -> u32 { self.delta_time } @@ -71,6 +76,11 @@ pub mod core { self.simulate = true; } + /// Changes the simulation update interval + pub fn set_update_interval(&mut self, update_interval: u32) { + self.update_interval = update_interval; + } + /// Changes the simulation timescale pub fn set_timescale(&mut self, timescale: f32) { self.timescale = timescale;