[][src]Enum sdl2::event::Event

pub enum Event {
    Quit {
        timestamp: u32,
    },
    AppTerminating {
        timestamp: u32,
    },
    AppLowMemory {
        timestamp: u32,
    },
    AppWillEnterBackground {
        timestamp: u32,
    },
    AppDidEnterBackground {
        timestamp: u32,
    },
    AppWillEnterForeground {
        timestamp: u32,
    },
    AppDidEnterForeground {
        timestamp: u32,
    },
    Window {
        timestamp: u32,
        window_id: u32,
        win_event: WindowEvent,
    },
    KeyDown {
        timestamp: u32,
        window_id: u32,
        keycode: Option<Keycode>,
        scancode: Option<Scancode>,
        keymod: Mod,
        repeat: bool,
    },
    KeyUp {
        timestamp: u32,
        window_id: u32,
        keycode: Option<Keycode>,
        scancode: Option<Scancode>,
        keymod: Mod,
        repeat: bool,
    },
    TextEditing {
        timestamp: u32,
        window_id: u32,
        text: String,
        start: i32,
        length: i32,
    },
    TextInput {
        timestamp: u32,
        window_id: u32,
        text: String,
    },
    MouseMotion {
        timestamp: u32,
        window_id: u32,
        which: u32,
        mousestate: MouseState,
        x: i32,
        y: i32,
        xrel: i32,
        yrel: i32,
    },
    MouseButtonDown {
        timestamp: u32,
        window_id: u32,
        which: u32,
        mouse_btn: MouseButton,
        clicks: u8,
        x: i32,
        y: i32,
    },
    MouseButtonUp {
        timestamp: u32,
        window_id: u32,
        which: u32,
        mouse_btn: MouseButton,
        clicks: u8,
        x: i32,
        y: i32,
    },
    MouseWheel {
        timestamp: u32,
        window_id: u32,
        which: u32,
        x: i32,
        y: i32,
        direction: MouseWheelDirection,
    },
    JoyAxisMotion {
        timestamp: u32,
        which: u32,
        axis_idx: u8,
        value: i16,
    },
    JoyBallMotion {
        timestamp: u32,
        which: u32,
        ball_idx: u8,
        xrel: i16,
        yrel: i16,
    },
    JoyHatMotion {
        timestamp: u32,
        which: u32,
        hat_idx: u8,
        state: HatState,
    },
    JoyButtonDown {
        timestamp: u32,
        which: u32,
        button_idx: u8,
    },
    JoyButtonUp {
        timestamp: u32,
        which: u32,
        button_idx: u8,
    },
    JoyDeviceAdded {
        timestamp: u32,
        which: u32,
    },
    JoyDeviceRemoved {
        timestamp: u32,
        which: u32,
    },
    ControllerAxisMotion {
        timestamp: u32,
        which: u32,
        axis: Axis,
        value: i16,
    },
    ControllerButtonDown {
        timestamp: u32,
        which: u32,
        button: Button,
    },
    ControllerButtonUp {
        timestamp: u32,
        which: u32,
        button: Button,
    },
    ControllerDeviceAdded {
        timestamp: u32,
        which: u32,
    },
    ControllerDeviceRemoved {
        timestamp: u32,
        which: u32,
    },
    ControllerDeviceRemapped {
        timestamp: u32,
        which: u32,
    },
    FingerDown {
        timestamp: u32,
        touch_id: i64,
        finger_id: i64,
        x: f32,
        y: f32,
        dx: f32,
        dy: f32,
        pressure: f32,
    },
    FingerUp {
        timestamp: u32,
        touch_id: i64,
        finger_id: i64,
        x: f32,
        y: f32,
        dx: f32,
        dy: f32,
        pressure: f32,
    },
    FingerMotion {
        timestamp: u32,
        touch_id: i64,
        finger_id: i64,
        x: f32,
        y: f32,
        dx: f32,
        dy: f32,
        pressure: f32,
    },
    DollarGesture {
        timestamp: u32,
        touch_id: i64,
        gesture_id: i64,
        num_fingers: u32,
        error: f32,
        x: f32,
        y: f32,
    },
    DollarRecord {
        timestamp: u32,
        touch_id: i64,
        gesture_id: i64,
        num_fingers: u32,
        error: f32,
        x: f32,
        y: f32,
    },
    MultiGesture {
        timestamp: u32,
        touch_id: i64,
        d_theta: f32,
        d_dist: f32,
        x: f32,
        y: f32,
        num_fingers: u16,
    },
    ClipboardUpdate {
        timestamp: u32,
    },
    DropFile {
        timestamp: u32,
        window_id: u32,
        filename: String,
    },
    DropText {
        timestamp: u32,
        window_id: u32,
        filename: String,
    },
    DropBegin {
        timestamp: u32,
        window_id: u32,
    },
    DropComplete {
        timestamp: u32,
        window_id: u32,
    },
    AudioDeviceAdded {
        timestamp: u32,
        which: u32,
        iscapture: bool,
    },
    AudioDeviceRemoved {
        timestamp: u32,
        which: u32,
        iscapture: bool,
    },
    RenderTargetsReset {
        timestamp: u32,
    },
    RenderDeviceReset {
        timestamp: u32,
    },
    User {
        timestamp: u32,
        window_id: u32,
        type_: u32,
        code: i32,
        data1: *mut c_void,
        data2: *mut c_void,
    },
    Unknown {
        timestamp: u32,
        type_: u32,
    },
}

Different event types.

Variants

Quit

Fields of Quit

timestamp: u32
AppTerminating

Fields of AppTerminating

timestamp: u32
AppLowMemory

Fields of AppLowMemory

timestamp: u32
AppWillEnterBackground

Fields of AppWillEnterBackground

timestamp: u32
AppDidEnterBackground

Fields of AppDidEnterBackground

timestamp: u32
AppWillEnterForeground

Fields of AppWillEnterForeground

timestamp: u32
AppDidEnterForeground

Fields of AppDidEnterForeground

timestamp: u32
Window

Fields of Window

timestamp: u32window_id: u32win_event: WindowEvent
KeyDown

Fields of KeyDown

timestamp: u32window_id: u32keycode: Option<Keycode>scancode: Option<Scancode>keymod: Modrepeat: bool
KeyUp

Fields of KeyUp

timestamp: u32window_id: u32keycode: Option<Keycode>scancode: Option<Scancode>keymod: Modrepeat: bool
TextEditing

Fields of TextEditing

timestamp: u32window_id: u32text: Stringstart: i32length: i32
TextInput

Fields of TextInput

timestamp: u32window_id: u32text: String
MouseMotion

Fields of MouseMotion

timestamp: u32window_id: u32which: u32mousestate: MouseStatex: i32y: i32xrel: i32yrel: i32
MouseButtonDown

Fields of MouseButtonDown

timestamp: u32window_id: u32which: u32mouse_btn: MouseButtonclicks: u8x: i32y: i32
MouseButtonUp

Fields of MouseButtonUp

timestamp: u32window_id: u32which: u32mouse_btn: MouseButtonclicks: u8x: i32y: i32
MouseWheel

Fields of MouseWheel

timestamp: u32window_id: u32which: u32x: i32y: i32direction: MouseWheelDirection
JoyAxisMotion

Fields of JoyAxisMotion

timestamp: u32which: u32

The joystick's id

axis_idx: u8value: i16
JoyBallMotion

Fields of JoyBallMotion

timestamp: u32which: u32

The joystick's id

ball_idx: u8xrel: i16yrel: i16
JoyHatMotion

Fields of JoyHatMotion

timestamp: u32which: u32

The joystick's id

hat_idx: u8state: HatState
JoyButtonDown

Fields of JoyButtonDown

timestamp: u32which: u32

The joystick's id

button_idx: u8
JoyButtonUp

Fields of JoyButtonUp

timestamp: u32which: u32

The joystick's id

button_idx: u8
JoyDeviceAdded

Fields of JoyDeviceAdded

timestamp: u32which: u32

The newly added joystick's joystick_index

JoyDeviceRemoved

Fields of JoyDeviceRemoved

timestamp: u32which: u32

The joystick's id

ControllerAxisMotion

Fields of ControllerAxisMotion

timestamp: u32which: u32

The controller's joystick id

axis: Axisvalue: i16
ControllerButtonDown

Fields of ControllerButtonDown

timestamp: u32which: u32

The controller's joystick id

button: Button
ControllerButtonUp

Fields of ControllerButtonUp

timestamp: u32which: u32

The controller's joystick id

button: Button
ControllerDeviceAdded

Fields of ControllerDeviceAdded

timestamp: u32which: u32

The newly added controller's joystick_index

ControllerDeviceRemoved

Fields of ControllerDeviceRemoved

timestamp: u32which: u32

The controller's joystick id

ControllerDeviceRemapped

Fields of ControllerDeviceRemapped

timestamp: u32which: u32

The controller's joystick id

FingerDown

Fields of FingerDown

timestamp: u32touch_id: i64finger_id: i64x: f32y: f32dx: f32dy: f32pressure: f32
FingerUp

Fields of FingerUp

timestamp: u32touch_id: i64finger_id: i64x: f32y: f32dx: f32dy: f32pressure: f32
FingerMotion

Fields of FingerMotion

timestamp: u32touch_id: i64finger_id: i64x: f32y: f32dx: f32dy: f32pressure: f32
DollarGesture

Fields of DollarGesture

timestamp: u32touch_id: i64gesture_id: i64num_fingers: u32error: f32x: f32y: f32
DollarRecord

Fields of DollarRecord

timestamp: u32touch_id: i64gesture_id: i64num_fingers: u32error: f32x: f32y: f32
MultiGesture

Fields of MultiGesture

timestamp: u32touch_id: i64d_theta: f32d_dist: f32x: f32y: f32num_fingers: u16
ClipboardUpdate

Fields of ClipboardUpdate

timestamp: u32
DropFile

Fields of DropFile

timestamp: u32window_id: u32filename: String
DropText

Fields of DropText

timestamp: u32window_id: u32filename: String
DropBegin

Fields of DropBegin

timestamp: u32window_id: u32
DropComplete

Fields of DropComplete

timestamp: u32window_id: u32
AudioDeviceAdded

Fields of AudioDeviceAdded

timestamp: u32which: u32iscapture: bool
AudioDeviceRemoved

Fields of AudioDeviceRemoved

timestamp: u32which: u32iscapture: bool
RenderTargetsReset

Fields of RenderTargetsReset

timestamp: u32
RenderDeviceReset

Fields of RenderDeviceReset

timestamp: u32
User

Fields of User

timestamp: u32window_id: u32type_: u32code: i32data1: *mut c_voiddata2: *mut c_void
Unknown

Fields of Unknown

timestamp: u32type_: u32

Methods

impl Event[src]

pub fn unwrap_keymod(keymod_option: Option<Mod>) -> Mod[src]

Deprecated since 0.33.0:

This method has been made public accidentally

pub fn is_user_event(&self) -> bool[src]

pub fn as_user_event_type<T: Any>(&self) -> Option<T>[src]

Trait Implementations

impl Clone for Event[src]

impl Debug for Event[src]

impl PartialEq<Event> for Event[src]

impl Send for Event[src]

This does not auto-derive because User's data fields can be used to store pointers to types that are !Send. Dereferencing these as pointers requires using unsafe and ensuring your own safety guarantees.

impl StructuralPartialEq for Event[src]

impl Sync for Event[src]

This does not auto-derive because User's data fields can be used to store pointers to types that are !Sync. Dereferencing these as pointers requires using unsafe and ensuring your own safety guarantees.

Auto Trait Implementations

impl RefUnwindSafe 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> 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 = 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.