use cgmath::Point2; use crate::physics::Pfloat; use crate::physics::PhysBody; use crate::Camera; use crate::Sprite; use crate::Spriteable; pub enum ShipKind { Gypsum, } impl ShipKind { fn sprite(&self) -> &'static str { match self { Self::Gypsum => "gypsum", } } } pub struct Ship { pub body: PhysBody, kind: ShipKind, } impl Ship { pub fn new(kind: ShipKind, pos: Point2) -> Self { Ship { body: PhysBody::new(pos), kind, } } } impl Spriteable for Ship { fn sprite(&self, camera: &Camera) -> Sprite { return Sprite { position: self.body.pos, camera: camera.pos, name: self.kind.sprite().to_owned(), angle: self.body.angle, }; } }