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

pub enum WindowEvent {
Show variants Moved(Point2), KeyPressed(Key), KeyReleased(Key), MouseMoved(Point2), MousePressed(MouseButton), MouseReleased(MouseButton), MouseEntered, MouseExited, MouseWheel(MouseScrollDeltaTouchPhase), 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, 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)

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)

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.

A mouse wheel movement or touchpad scroll occurred.

Resized(Vec2)

The window was resized to the given dimensions (in DPI-agnostic points, not pixels).

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.

Implementations

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

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Auto Trait Implementations

Blanket Implementations

Convert the source color to the destination color using the specified method Read more

Convert the source color to the destination color using the bradford method by default Read more

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

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

Performs the conversion.

Performs the conversion.

The alignment of pointer.

The type for initializers.

Initializes a with the given initializer. Read more

Dereferences the given pointer. Read more

Mutably dereferences the given pointer. Read more

Drops the object pointed to by the given pointer. Read more

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.