use crate::integer::Time; #[derive(Clone,Debug)] pub struct MouseState{ pub pos:glam::IVec2, pub time:Time, } impl Default for MouseState{ fn default()->Self{ Self{ time:Time::ZERO, pos:glam::IVec2::ZERO, } } } impl MouseState{ pub fn lerp(&self,target:&MouseState,time:Time)->glam::IVec2{ let m0=self.pos.as_i64vec2(); let m1=target.pos.as_i64vec2(); //these are deltas let t1t=(target.time-time).nanos(); let tt0=(time-self.time).nanos(); let dt=(target.time-self.time).nanos(); ((m0*t1t+m1*tt0)/dt).as_ivec2() } }