use crate::{physics::Polar, Doodad, Sprite, Spriteable}; use cgmath::Deg; pub struct System { bodies: Vec, } impl System { pub fn new() -> Self { let mut s = System { bodies: Vec::new() }; s.bodies.push(Doodad { pos: (0.0, 0.0).into(), sprite: "a0".to_owned(), parallax: 3.0, height: 80.0, }); s.bodies.push(Doodad { pos: Polar { center: (0.0, 0.0).into(), radius: 100.0, angle: Deg { 0: 31.0 }, } .to_cartesian(), sprite: "earth".to_owned(), parallax: 1.0, height: 120.0, }); s.bodies.push(Doodad { pos: Polar { center: (0.0, 0.0).into(), radius: 200.0, angle: Deg { 0: 270.0 }, } .to_cartesian(), sprite: "small".to_owned(), parallax: -1.0, height: 50.0, }); return s; } pub fn sprites(&self) -> Vec { return self.bodies.iter().map(|x| x.sprite()).collect(); } }