1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
pub trait Mouse { fn press(&self, button: MouseButton) -> bool; fn release(&self, button: MouseButton) -> bool; fn is_pressed(&self, button: MouseButton) -> bool; fn move_to(&self, x: u16, y: u16, display_index: Option<usize>) -> bool; fn get_position(&self) -> MousePosition; } #[derive(Debug, Copy, Clone)] pub enum MouseButton { Left, Middle, Right, } #[derive(Debug, Copy, Clone)] pub struct MousePosition { pub display_index: usize, pub x: u16, pub y: u16, }