Module winput::message_loop[][src]

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

The result of the start function. This structure receives the messages received by the message loop.

Enums

An event of any kind.

An error that can be produced by the start function.

Functions

Checks if the message loop is currently active. When this function returns true, calling start always produces an error.

Starts the message loop on a new thread.

Stops the message loop.