pub enum Event {
Show 14 variants
KeyPressed(Key),
KeyReleased(Key),
MouseButtonPressed(MouseButton),
MouseButtonReleased(MouseButton),
ControllerButtonPressed(ControllerButton),
ControllerButtonReleased(ControllerButton),
ControllerAxisChange(ControllerAxis),
MouseMove {
x: f64,
y: f64,
},
MouseScroll {
x: f64,
y: f64,
},
Touch(Touch),
WindowResized {
width: u32,
height: u32,
},
WindowFocused(bool),
WindowCursor(bool),
WindowClosed,
}
Expand description
Possible events returned from Drawing::poll_event()
.
Events are used to make programs more interactive. See that method’s documentation for more information about how to use events.
This type is meant to provide a simplified model of piston_window
’s Event
type.
Variants§
KeyPressed(Key)
Sent when a keyboard key is pressed
KeyReleased(Key)
Sent when a keyboard key is released
MouseButtonPressed(MouseButton)
Sent when a mouse button is pressed
MouseButtonReleased(MouseButton)
Sent when a mouse button is released
ControllerButtonPressed(ControllerButton)
Sent when a controller button is pressed
ControllerButtonReleased(ControllerButton)
Sent when a controller button is released
ControllerAxisChange(ControllerAxis)
Sent when a controller axis (usually a joystick) is changed
MouseMove
Sent when the mouse is moving. Only sent when the mouse is over the window.
x
and y
represent the new coordinates of where the mouse is currently.
Coordinates are relative to the center of the window.
MouseScroll
Sent when the mouse is scrolled. Only sent when the mouse is over the window.
x
and y
are in scroll ticks.
Touch(Touch)
Sent when a user touches the screen
WindowResized
Sent when the window gets resized
WindowFocused(bool)
Sent when the window focus changes
The boolean value is true if the window is in focus.
WindowCursor(bool)
Sent when the window gains or loses the cursor.
The boolean value is true if the window gained the cursor.
WindowClosed
Sent when the window is closed
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Event
impl<'de> Deserialize<'de> for Event
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Copy for Event
impl StructuralPartialEq for Event
Auto Trait Implementations§
impl Freeze for Event
impl RefUnwindSafe for Event
impl Send for Event
impl Sync for Event
impl Unpin for Event
impl UnwindSafe for Event
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)