[][src]Enum tetra::Event

pub enum Event {
    Resized {
        width: i32,
        height: i32,
    },
    FocusGained,
    FocusLost,
    KeyPressed {
        key: Key,
    },
    KeyReleased {
        key: Key,
    },
    MouseButtonPressed {
        button: MouseButton,
    },
    MouseButtonReleased {
        button: MouseButton,
    },
    MouseMoved {
        position: Vec2<f32>,
    },
    GamepadAdded {
        id: usize,
    },
    GamepadRemoved {
        id: usize,
    },
    GamepadButtonPressed {
        id: usize,
        button: GamepadButton,
    },
    GamepadButtonReleased {
        id: usize,
        button: GamepadButton,
    },
    GamepadAxisMoved {
        id: usize,
        axis: GamepadAxis,
        position: f32,
    },
    GamepadStickMoved {
        id: usize,
        stick: GamepadStick,
        position: Vec2<f32>,
    },
    TextInput {
        text: String,
    },
    // some variants omitted
}

Events that can occur while the game is running.

The event method on the State trait will recieve events as they occur.

Variants

Resized

The game window was resized.

Fields of Resized

width: i32

The new width of the game window.

height: i32

The new height of the game window.

FocusGained

The game window was focused by the user.

FocusLost

The game window was un-focused by the user.

KeyPressed

A key on the keyboard was pressed.

Fields of KeyPressed

key: Key

The key that was pressed.

KeyReleased

A key on the keyboard was released.

Fields of KeyReleased

key: Key

The key that was released.

MouseButtonPressed

A button on the mouse was pressed.

Fields of MouseButtonPressed

button: MouseButton

The button that was pressed.

MouseButtonReleased

A button on the mouse was released.

Fields of MouseButtonReleased

button: MouseButton

The button that was released.

MouseMoved

The mouse was moved.

Fields of MouseMoved

position: Vec2<f32>

The new position of the mouse, in window co-ordinates.

GamepadAdded

A gamepad was connected to the system.

Fields of GamepadAdded

id: usize

The ID that was assigned to the gamepad.

GamepadRemoved

A gamepad was removed from the system.

Fields of GamepadRemoved

id: usize

The ID of the gamepad that was removed.

GamepadButtonPressed

A button on a gamepad was pressed.

Fields of GamepadButtonPressed

id: usize

The ID of the gamepad.

button: GamepadButton

The button that was pressed.

GamepadButtonReleased

A button on a gamepad was released.

Fields of GamepadButtonReleased

id: usize

The ID of the gamepad.

button: GamepadButton

The button that was released.

GamepadAxisMoved

An axis on a gamepad was moved.

Fields of GamepadAxisMoved

id: usize

The ID of the gamepad.

axis: GamepadAxis

The axis that was moved.

position: f32

The new position of the axis.

GamepadStickMoved

A control stick on a gamepad was moved.

Fields of GamepadStickMoved

id: usize

The ID of the gamepad.

stick: GamepadStick

The stick that was moved.

position: Vec2<f32>

The new position of the stick.

TextInput

The user typed some text.

Fields of TextInput

text: String

The text that was typed by the user.

Trait Implementations

impl Clone for Event[src]

impl Debug for Event[src]

Auto Trait Implementations

impl RefUnwindSafe for Event

impl Send for Event

impl Sync for Event

impl Unpin for Event

impl UnwindSafe for Event

Blanket Implementations

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

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

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

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

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

impl<T> SetParameter for T

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<V, T> VZip<V> for T where
    V: MultiLane<T>,