diff options
Diffstat (limited to 'src/main.rs')
| -rw-r--r-- | src/main.rs | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/main.rs b/src/main.rs index b6efdcd..ae4233e 100644 --- a/src/main.rs +++ b/src/main.rs @@ -13,6 +13,7 @@ use std::cell::RefCell; use std::thread; use std::time::{Duration, Instant}; +use serde::de; use winit::event::{KeyEvent, WindowEvent}; use winit::event_loop::{EventLoop, ActiveEventLoop, ControlFlow}; use winit::error::{EventLoopError}; @@ -82,6 +83,16 @@ impl GameState pub fn timeman_mut(&mut self) -> &mut TimeMan { &mut self.timeman } + + fn update( + &mut self, + dt: Duration) + { + self.timeman.update(); + self.solar_systems.iter_mut().for_each(|solar_system| { + solar_system.update(self.timeman.seconds()); + }); + } } impl ApplicationHandler for SystemicApp @@ -126,7 +137,7 @@ impl ApplicationHandler for SystemicApp let delta_time = now - self.last_render_time; self.last_render_time = now; - game_state.borrow_mut().timeman.update(); + game_state.borrow_mut().update(delta_time); { window.update(game_state, delta_time); } |
