1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
use stockton_types::Vector2; #[derive(Debug, Clone)] pub struct Mouse { pub abs: Vector2, pub delta: Vector2, } impl Default for Mouse { fn default() -> Self { Mouse { abs: Vector2::zeros(), delta: Vector2::zeros(), } } } impl Mouse { pub fn handle_frame(&mut self, new: Vector2) { self.delta = new - self.abs; self.abs = new; } }