Struct mouse_keyboard_input::VirtualDevice
source · pub struct VirtualDevice { /* private fields */ }
Implementations§
source§impl VirtualDevice
impl VirtualDevice
sourcepub fn new() -> Self
pub fn new() -> Self
Examples found in repository?
More examples
examples/mouse.rs (line 9)
8 9 10 11 12 13 14 15 16 17 18 19 20 21
fn main() {
let mut device = VirtualDevice::new();
for _ in 1..5 {
thread::sleep(Duration::from_secs(1));
// scroll vertically by 100
device.scroll_vertical(100).unwrap();
// move cursor vertically from the current position by 50
device.move_mouse(50, 50).unwrap();
//click the left mouse button
device.click(BTN_LEFT).unwrap();
}
}
pub fn synchronize(&mut self) -> Result<(), Error>
sourcepub fn move_mouse(&mut self, x: i32, y: i32) -> Result<(), Error>
pub fn move_mouse(&mut self, x: i32, y: i32) -> Result<(), Error>
Examples found in repository?
examples/mouse.rs (line 17)
8 9 10 11 12 13 14 15 16 17 18 19 20 21
fn main() {
let mut device = VirtualDevice::new();
for _ in 1..5 {
thread::sleep(Duration::from_secs(1));
// scroll vertically by 100
device.scroll_vertical(100).unwrap();
// move cursor vertically from the current position by 50
device.move_mouse(50, 50).unwrap();
//click the left mouse button
device.click(BTN_LEFT).unwrap();
}
}
sourcepub fn scroll_vertical(&mut self, value: i32) -> Result<(), Error>
pub fn scroll_vertical(&mut self, value: i32) -> Result<(), Error>
Examples found in repository?
examples/mouse.rs (line 15)
8 9 10 11 12 13 14 15 16 17 18 19 20 21
fn main() {
let mut device = VirtualDevice::new();
for _ in 1..5 {
thread::sleep(Duration::from_secs(1));
// scroll vertically by 100
device.scroll_vertical(100).unwrap();
// move cursor vertically from the current position by 50
device.move_mouse(50, 50).unwrap();
//click the left mouse button
device.click(BTN_LEFT).unwrap();
}
}
pub fn scroll_horizontal(&mut self, value: i32) -> Result<(), Error>
pub fn press(&mut self, button: u16) -> Result<(), Error>
pub fn release(&mut self, button: u16) -> Result<(), Error>
sourcepub fn click(&mut self, button: u16) -> Result<(), Error>
pub fn click(&mut self, button: u16) -> Result<(), Error>
Examples found in repository?
More examples
examples/mouse.rs (line 19)
8 9 10 11 12 13 14 15 16 17 18 19 20 21
fn main() {
let mut device = VirtualDevice::new();
for _ in 1..5 {
thread::sleep(Duration::from_secs(1));
// scroll vertically by 100
device.scroll_vertical(100).unwrap();
// move cursor vertically from the current position by 50
device.move_mouse(50, 50).unwrap();
//click the left mouse button
device.click(BTN_LEFT).unwrap();
}
}