From 3dc92fad981e28c760f3c6e95f5a8153ea6c9be4 Mon Sep 17 00:00:00 2001 From: Jon Santmyer Date: Wed, 15 Apr 2026 22:22:45 -0400 Subject: work on orbits (not right yet), orbit camera --- src/main.rs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'src/main.rs') 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); } -- cgit v1.2.3