Expand description
The message_loop
module provides a way to retreive keyboard and mouse
input messages directly from the system.
Internally, a message-only window is created to receive the messages.
§Examples
ⓘ
use winput::{Vk, Action};
use winput::message_loop;
let receiver = message_loop::start().unwrap();
loop {
match receiver.next_event() {
message_loop::Event::Keyboard {
vk,
action: Action::Press,
..
} => {
if vk == Vk::Escape {
break;
} else {
println!("{:?} was pressed!", vk);
}
},
_ => (),
}
}
Structs§
- Event
Receiver - The result of the
start
function. This structure receives the messages received by the message loop.
Enums§
- Event
- An event of any kind.
- Message
Loop Error - An error that can be produced by the
start
function.