pub struct KeyBuf { /* private fields */ }Expand description
A container for Window-based keyboard input events.
NOTE: Keys pressed and released during a single update (is that possible, really?) will show as both released and pressed.
Implementations
sourceimpl KeyBuf
impl KeyBuf
sourcepub fn any_pressed(&self) -> bool
pub fn any_pressed(&self) -> bool
Returns true if any keys have been pressed since the last frame.
sourcepub fn any_released(&self) -> bool
pub fn any_released(&self) -> bool
Returns true if any keys have been released since the last frame.
sourcepub fn chars(&self) -> impl Iterator<Item = char> + '_
pub fn chars(&self) -> impl Iterator<Item = char> + '_
Returns an iterator of characters typed since the last frame.
sourcepub fn handle_event(&mut self, event: &Event<'_, ()>) -> bool
pub fn handle_event(&mut self, event: &Event<'_, ()>) -> bool
Handles a single event.
sourcepub fn is_held(&self, key: &VirtualKeyCode) -> bool
pub fn is_held(&self, key: &VirtualKeyCode) -> bool
Returns true if the given key has been pressed for multiple frames.
sourcepub fn is_pressed(&self, key: &VirtualKeyCode) -> bool
pub fn is_pressed(&self, key: &VirtualKeyCode) -> bool
Returns true if the given key has been pressed since the last frame.
sourcepub fn is_released(&self, key: &VirtualKeyCode) -> bool
pub fn is_released(&self, key: &VirtualKeyCode) -> bool
Returns true if the given key has been released since the last frame.
sourcepub fn held(&self) -> impl Iterator<Item = VirtualKeyCode> + '_
pub fn held(&self) -> impl Iterator<Item = VirtualKeyCode> + '_
Returns an iterator of keys pressed for multiple frames.
sourcepub fn pressed(&self) -> impl Iterator<Item = VirtualKeyCode> + '_
pub fn pressed(&self) -> impl Iterator<Item = VirtualKeyCode> + '_
Returns an iterator of keys pressed since the last frame.
sourcepub fn released(&self) -> impl Iterator<Item = VirtualKeyCode> + '_
pub fn released(&self) -> impl Iterator<Item = VirtualKeyCode> + '_
Returns an iterator of keys released since the last frame.