Trait minifb::InputCallback

source ·
pub trait InputCallback {
    // Required method
    fn add_char(&mut self, uni_char: u32);

    // Provided method
    fn set_key_state(&mut self, _key: Key, _state: bool) { ... }
}
Expand description

This trait can be implemented and set with set_input_callback to receive a callback when there is inputs.

Required Methods§

source

fn add_char(&mut self, uni_char: u32)

Called when text is added to the window, or a key is pressed. This passes in a unicode character, and therefore does not report control characters.

Provided Methods§

source

fn set_key_state(&mut self, _key: Key, _state: bool)

Called whenever a key is pressed or released. This reports the state of the key in the state argument, as well as the translated key in the key argument. This includes control characters such as Key::LeftShift.

Implementors§