Enum nannou::event::WindowEvent [−][src]
pub enum WindowEvent {
Show 19 variants
Moved(Point2),
KeyPressed(Key),
KeyReleased(Key),
ReceivedCharacter(char),
MouseMoved(Point2),
MousePressed(MouseButton),
MouseReleased(MouseButton),
MouseEntered,
MouseExited,
MouseWheel(MouseScrollDelta, TouchPhase),
Resized(Vec2),
HoveredFile(PathBuf),
DroppedFile(PathBuf),
HoveredFileCancelled,
Touch(TouchEvent),
TouchPressure(TouchpadPressure),
Focused,
Unfocused,
Closed,
}
Expand description
A simplified version of winit’s WindowEvent
type to make it easier to get started.
All co-ordinates and dimensions are DPI-agnostic scalar values.
Co-ordinates for each window are as follows:
(0.0, 0.0)
is the centre of the window.- positive
x
points to the right, negativex
points to the left. - positive
y
points upwards, negativey
points downwards. - positive
z
points into the screen, negativez
points out of the screen.
Variants
Moved(Point2)
Tuple Fields
0: Point2
The window has been moved to a new position.
KeyPressed(Key)
Tuple Fields
0: Key
The given keyboard key was pressed.
KeyReleased(Key)
Tuple Fields
0: Key
The given keyboard key was released.
ReceivedCharacter(char)
Tuple Fields
0: char
Character input received event.
MouseMoved(Point2)
Tuple Fields
0: Point2
The mouse moved to the given x, y position.
MousePressed(MouseButton)
Tuple Fields
0: MouseButton
The given mouse button was pressed.
MouseReleased(MouseButton)
Tuple Fields
0: MouseButton
The given mouse button was released.
MouseEntered
The mouse entered the window.
MouseExited
The mouse exited the window.
MouseWheel(MouseScrollDelta, TouchPhase)
A mouse wheel movement or touchpad scroll occurred.
Resized(Vec2)
Tuple Fields
0: Vec2
The window was resized to the given dimensions (in DPI-agnostic points, not pixels).
HoveredFile(PathBuf)
Tuple Fields
0: PathBuf
A file at the given path was hovered over the window.
DroppedFile(PathBuf)
Tuple Fields
0: PathBuf
A file at the given path was dropped onto the window.
HoveredFileCancelled
A file at the given path that was hovered over the window was cancelled.
Touch(TouchEvent)
Tuple Fields
0: TouchEvent
Received a touch event.
TouchPressure(TouchpadPressure)
Tuple Fields
Touchpad pressure event.
At the moment, only supported on Apple forcetouch-capable macbooks. The parameters are: pressure level (value between 0 and 1 representing how hard the touchpad is being pressed) and stage (integer representing the click level).
Focused
The window gained focus.
Unfocused
The window lost focus.
Closed
The window was closed and is no longer stored in the App
.
Implementations
pub fn from_winit_window_event(
event: &WindowEvent<'_>,
win_w: f64,
win_h: f64,
scale_factor: f64
) -> Option<Self>
pub fn from_winit_window_event(
event: &WindowEvent<'_>,
win_w: f64,
win_h: f64,
scale_factor: f64
) -> Option<Self>
Produce a simplified, new-user-friendly version of the given winit::event::WindowEvent
.
This strips rarely needed technical information from the event type such as information about the source device, scancodes for keyboard events, etc to make the experience of pattern matching on window events nicer for new users.
This also interprets the raw pixel positions and dimensions of the raw event into a
dpi-agnostic scalar value where (0, 0, 0) is the centre of the screen with the y
axis
increasing in the upwards direction.
If the user requires this extra information, they should use the raw
field of the
WindowEvent
type rather than the simple
one.
Trait Implementations
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
This method tests for !=
.
Auto Trait Implementations
impl RefUnwindSafe for WindowEvent
impl Send for WindowEvent
impl Sync for WindowEvent
impl Unpin for WindowEvent
impl UnwindSafe for WindowEvent
Blanket Implementations
impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for S where
T: Component + Float,
Swp: WhitePoint,
Dwp: WhitePoint,
D: AdaptFrom<S, Swp, Dwp, T>,
impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for S where
T: Component + Float,
Swp: WhitePoint,
Dwp: WhitePoint,
D: AdaptFrom<S, Swp, Dwp, T>,
Mutably borrows from an owned value. Read more
Convert into T with values clamped to the color defined bounds Read more
Convert into T. The resulting color might be invalid in its color space Read more
Convert into T, returning ok if the color is inside of its defined range,
otherwise an OutOfBounds
error is returned which contains the unclamped color. Read more