use sdl2::render::Canvas; use sdl2::video::Window; use crate::physics::PhysVec; use crate::physics::Position; use crate::Camera; use crate::Drawable; use crate::SpriteAtlas; pub struct Doodad { pub sprite: String, pub pos: Position, pub scale: u32, pub angle: f64, } impl Drawable for Doodad { fn position(&self) -> PhysVec { self.pos.to_cartesian().into() } fn draw( &self, canvas: &mut Canvas, sa: &SpriteAtlas, c: &Camera, ) -> Result<(), String> { let pos = self.screen_position(canvas, c); let sprite = sa.get(&self.sprite); sprite.draw(canvas, pos, self.angle)?; return Ok(()); } }