pub enum Event {
}
Expand description
Represents an event as seen by the application.
Variants
WindowResize
Event fired when the window is resized.
Refresh
Event fired regularly when a auto-refresh is set.
Char(char)
A character was entered (includes numbers, punctuation, …).
CtrlChar(char)
A character was entered with the Ctrl key pressed.
AltChar(char)
A character was entered with the Alt key pressed.
Key(Key)
A non-character key was pressed.
Shift(Key)
A non-character key was pressed with the Shift key pressed.
Alt(Key)
A non-character key was pressed with the Alt key pressed.
AltShift(Key)
A non-character key was pressed with the Shift and Alt keys pressed.
Ctrl(Key)
A non-character key was pressed with the Ctrl key pressed.
CtrlShift(Key)
A non-character key was pressed with the Ctrl and Shift keys pressed.
CtrlAlt(Key)
A non-character key was pressed with the Ctrl and Alt keys pressed.
Mouse
Fields
offset: Vec2
Position of the top-left corner of the view receiving this event.
position: Vec2
Position of the mouse when this event was fired.
event: MouseEvent
The mouse event itself.
A mouse event was sent.
Unknown(Vec<u8>)
An unknown event was received.
Implementations
sourceimpl Event
impl Event
sourcepub fn mouse_position(&self) -> Option<Vec2>
pub fn mouse_position(&self) -> Option<Vec2>
Returns the position of the mouse, if self
is a mouse event.
sourcepub fn mouse_position_mut(&mut self) -> Option<&mut Vec2>
pub fn mouse_position_mut(&mut self) -> Option<&mut Vec2>
Returns a mutable reference to the position of the mouse/
Returns None
if self
is not a mouse event.
sourcepub fn relativize<V>(&mut self, top_left: V)where
V: Into<Vec2>,
pub fn relativize<V>(&mut self, top_left: V)where
V: Into<Vec2>,
Update self
with the given offset.
If self
is a mouse event, adds top_left
to its offset.
Otherwise, do nothing.
sourcepub fn relativized<V>(&self, top_left: V) -> Selfwhere
V: Into<Vec2>,
pub fn relativized<V>(&self, top_left: V) -> Selfwhere
V: Into<Vec2>,
Returns a cloned, relativized event.
If self
is a mouse event, adds top_left
to its offset.
Otherwise, returns a simple clone.