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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
//! A simple library for querying mouse and keyboard state without requiring
//! an active window. Currently works in Windows, Linux, and macOS.
//!
//! ```no_run
//! use device_query::{DeviceQuery, DeviceState, MouseState, Keycode};
//!
//! let device_state = DeviceState::new();
//!
//! let mouse: MouseState = device_state.get_mouse();
//! println!("Current Mouse Coordinates: {:?}", mouse.coords);
//!
//! let keys: Vec<Keycode> = device_state.get_keys();
//! println!("Is A pressed? {}", keys.contains(&Keycode::A));
//! ```
//!
//! It's also possible to listen for events.
//! ```no_run
//! use device_query::{DeviceEvents, DeviceEventsHandler};
//! use std::time::Duration;
//!
//! let device_state = DeviceEventsHandler::new(Duration::from_millis(10))
//! .expect("Failed to start event loop");
//!
//! // Register a key down event callback
//! // The guard is used to keep the callback alive
//! let _guard = device_state.on_mouse_move(|position| {
//! println!("Mouse position: {:#?}", position);
//! });
//!
//! // Keep the main thread alive
//! loop {}
//! ```
extern crate windows;
pub use *;
pub use *;
pub use *;
pub use *;
pub use *;