summaryrefslogtreecommitdiffstats
path: root/src/main.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/main.rs b/src/main.rs
index 7a7e3a1..72cd3dd 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -22,7 +22,7 @@ use winit::application::{ApplicationHandler};
use winit::keyboard::PhysicalKey;
use winit::window::{Window, WindowId, WindowAttributes};
-use solar_system::SolarSystem;
+use solar_system::*;
use crate::timeman::TimeMan;
use crate::window::GameWindow;
@@ -64,12 +64,14 @@ impl GameState
pub fn new()
-> Self {
let timeman = TimeMan::new(0);
- let sol_system = match SolarSystem::new_from_known_star(0, "sol")
+ let mut sol_system = match SolarSystem::new_from_known_star(0, "sol")
{
Ok(system) => system,
Err(e) => panic!("Unable to create sol system : {}", e)
};
+ sol_system.update(timeman.seconds());
+
Self {
timeman: timeman,
solar_systems: vec![ sol_system ]
@@ -89,9 +91,9 @@ impl GameState
&mut self,
dt: Duration)
{
- self.timeman.update();
- self.solar_systems.iter_mut().for_each(|solar_system| {
- solar_system.update(self.timeman.seconds());
+ let ticks = self.timeman.update();
+ ticks.iter().for_each(|time| {
+ solar_system::update_systems(self.solar_systems.iter_mut(), *time);
});
}
}