Enum nannou::event::SimpleWindowEvent [−][src]
pub enum SimpleWindowEvent { Moved(Point2<DefaultScalar>), KeyPressed(Key), KeyReleased(Key), MouseMoved(Point2<DefaultScalar>), MouseDragged(Point2<DefaultScalar>, MouseButton), MousePressed(MouseButton), MouseReleased(MouseButton), MouseEntered, MouseExited, MouseWheel(MouseScrollDelta, TouchPhase), Resized(Vector2<DefaultScalar>), HoveredFile(PathBuf), DroppedFile(PathBuf), HoveredFileCancelled, Touch { phase: TouchPhase, position: Point2<DefaultScalar>, id: u64, }, TouchpadPressure { pressure: f32, stage: i64, }, Focused(bool), Closed, }
A simplified version of glutin'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<DefaultScalar>)
The window has been moved to a new position.
KeyPressed(Key)
The given keyboard key was pressed.
KeyReleased(Key)
The given keyboard key was released.
MouseMoved(Point2<DefaultScalar>)
The mouse moved to the given x, y position.
MouseDragged(Point2<DefaultScalar>, MouseButton)
The given mouse button was dragged to the given x, y position.
MousePressed(MouseButton)
The given mouse button was pressed.
MouseReleased(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(Vector2<DefaultScalar>)
The window was resized to the given dimensions.
HoveredFile(PathBuf)
A file at the given path was hovered over the window.
DroppedFile(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
Received a touch event.
Fields of Touch
phase: TouchPhase | |
position: Point2<DefaultScalar> | |
id: u64 |
TouchpadPressure
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).
Fields of TouchpadPressure
pressure: f32 | |
stage: i64 |
Focused(bool)
The window gained or lost focus.
The parameter is true if the window has gained focus, and false if it has lost focus.
Closed
The window was closed and is no longer stored in the App
.
Methods
impl SimpleWindowEvent
[src]
impl SimpleWindowEvent
pub fn from_glutin_window_event(
event: WindowEvent,
dpi_factor: f64,
win_w_px: u32,
win_h_px: u32
) -> Option<Self>
[src]
pub fn from_glutin_window_event(
event: WindowEvent,
dpi_factor: f64,
win_w_px: u32,
win_h_px: u32
) -> Option<Self>
Produce a simplified, new-user-friendly version of the given glutin::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
impl Clone for SimpleWindowEvent
[src]
impl Clone for SimpleWindowEvent
fn clone(&self) -> SimpleWindowEvent
[src]
fn clone(&self) -> SimpleWindowEvent
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl Debug for SimpleWindowEvent
[src]
impl Debug for SimpleWindowEvent
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl PartialEq for SimpleWindowEvent
[src]
impl PartialEq for SimpleWindowEvent
fn eq(&self, other: &SimpleWindowEvent) -> bool
[src]
fn eq(&self, other: &SimpleWindowEvent) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &SimpleWindowEvent) -> bool
[src]
fn ne(&self, other: &SimpleWindowEvent) -> bool
This method tests for !=
.
Auto Trait Implementations
impl Send for SimpleWindowEvent
impl Send for SimpleWindowEvent
impl Sync for SimpleWindowEvent
impl Sync for SimpleWindowEvent