[][src]Enum nannou::event::WindowEvent

pub enum WindowEvent {
    Moved(Point2<Default>),
    KeyPressed(Key),
    KeyReleased(Key),
    MouseMoved(Point2<Default>),
    MousePressed(MouseButton),
    MouseReleased(MouseButton),
    MouseEntered,
    MouseExited,
    MouseWheel(MouseScrollDeltaTouchPhase),
    Resized(Vector2<Default>),
    HoveredFile(PathBuf),
    DroppedFile(PathBuf),
    HoveredFileCancelled,
    Touch(TouchEvent),
    TouchPressure(TouchpadPressure),
    Focused,
    Unfocused,
    Closed,
}

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, negative x points to the left.
  • positive y points upwards, negative y points downwards.
  • positive z points into the screen, negative z points out of the screen.

Variants

Moved(Point2<Default>)

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<Default>)

The mouse moved 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(MouseScrollDeltaTouchPhase)

A mouse wheel movement or touchpad scroll occurred.

Resized(Vector2<Default>)

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(TouchEvent)

Received a touch event.

TouchPressure(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).

Focused

The window gained focus.

Unfocused

The window lost focus.

Closed

The window was closed and is no longer stored in the App.

Methods

impl WindowEvent[src]

pub fn from_winit_window_event(
    event: WindowEvent,
    win_w: f64,
    win_h: f64
) -> Option<Self>
[src]

Produce a simplified, new-user-friendly version of the given winit::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 PartialEq<WindowEvent> for WindowEvent[src]

impl Clone for WindowEvent[src]

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl Debug for WindowEvent[src]

Auto Trait Implementations

impl Send for WindowEvent

impl Sync for WindowEvent

Blanket Implementations

impl<T> From<T> for T[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Style for T where
    T: Any + Debug + PartialEq<T>, 
[src]

impl<T> Content for T[src]

impl<T> SafeBorrow<T> for T[src]

impl<T> Erased for T

impl<S> FromSample<S> for S[src]

impl<T, U> ToSample<U> for T where
    U: FromSample<T>, 
[src]

impl<S, T> Duplex<S> for T where
    T: FromSample<S> + ToSample<S>, 
[src]

impl<T> SetParameter for T

fn set<T>(&mut self, value: T) -> <T as Parameter<Self>>::Result where
    T: Parameter<Self>, 

Sets value as a parameter of self.

impl<T> SetParameter for T

fn set<T>(&mut self, value: T) -> <T as Parameter<Self>>::Result where
    T: Parameter<Self>, 

Sets value as a parameter of self.