Replies: 2 comments
-
Internally winit (at least for windows) even knows what type of device the newly added one is.. Check line 56 at https://github.com/rust-windowing/winit/blob/76f158d3102aeb54e6c1c2ce2fd34dbe6b0daab1/src/platform_impl/windows/raw_input.rs) |
Beta Was this translation helpful? Give feedback.
0 replies
-
Yeah, maybe we could add something like: enum DeviceHint {
Mouse,
TouchScreen,
Keyboard,
...
Unknown,
}
impl DeviceId {
fn hint(&self) -> DeviceHint;
} |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Guys, I am using winit to create a window and everything works fine.
Now I need to manage input in my application, and winit fires the DeviceEvent::Added when a new device is added, so that's great.
The problem is: how do I know what type of device was added? Was it a mouse, a keyboard..??
And is there any way to get extra info about it (something like how many buttons the mouse has)?
I received as an answer from other people that a device may send many types of event, but even knowing that a device could be a keyboard or a mouse, rather than knowing nothing would be useful.. (exposing an HID device struct?)
Beta Was this translation helpful? Give feedback.
All reactions