[][src]Enum turtle::event::Event

pub enum Event {
    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,
}

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.

Fields of MouseMove

x: f64y: f64
MouseScroll

Sent when the mouse is scrolled. Only sent when the mouse is over the window. x and y are in scroll ticks.

Fields of MouseScroll

x: f64y: f64
Touch(Touch)

Sent when a user touches the screen

WindowResized

Sent when the window gets resized

Fields of WindowResized

width: u32height: u32
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

impl Clone for Event[src]

impl Copy for Event[src]

impl PartialEq<Event> for Event[src]

impl Debug for Event[src]

impl StructuralPartialEq for Event[src]

impl Serialize for Event[src]

impl<'de> Deserialize<'de> for Event[src]

Auto Trait Implementations

impl Send for Event

impl Sync for Event

impl Unpin for Event

impl UnwindSafe for Event

impl RefUnwindSafe for Event

Blanket Implementations

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

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

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

type Owned = T

The resulting type after obtaining ownership.

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

type Error = !

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> DeserializeOwned for T where
    T: Deserialize<'de>, 
[src]

impl<T> SetParameter for T