[−][src]Enum beryllium::Event
The various events that can happen.
Variants
Quit
Quit was requested by the user
Fields of Quit
timestamp: u32
Time, in milliseconds, since SDL2 was initialized.
MouseMotion
Event for any time the user moves the mouse within a window, or if
warp_mouse_in_window
is called.
Fields of MouseMotion
timestamp: u32
Time, in milliseconds, since SDL2 was initialized.
window_id: u32
Window with mouse focus, if any
mouse_id: Option<u32>
The mouse that generated this event. If None
it was a touch event.
state: MouseButtonState
State of the mouse buttons during this event
x: i32
X, relative to the window
y: i32
Y, relative to the window
delta_x: i32
Change in X position
delta_y: i32
Change in Y position
MouseButtonEvent
Generated whenever a mouse button is pressed or released.
Fields of MouseButtonEvent
timestamp: u32
Time, in milliseconds, since SDL2 was initialized.
window_id: u32
Window with mouse focus, if any
mouse_id: Option<u32>
The mouse that generated this event. If None
it was a touch event.
The button that changed
is_pressed: bool
If the button is now pressed or released
clicks: u8
1 for single-click, 2 for double-click, etc
x: i32
X, relative to the window
y: i32
Y, relative to the window
MouseWheel
Generated whenever the user moves the mouse wheel.
Fields of MouseWheel
timestamp: u32
Time, in milliseconds, since SDL2 was initialized.
window_id: u32
Window with mouse focus, if any
mouse_id: Option<u32>
The mouse that generated this event. If None
it was a touch event.
x: i32
Horizontal scroll, negative Left or positive Right
y: i32
Vertical scroll, negative to User or positive away from User
is_flipped: bool
Mouse wheel isn't consistent on all platforms. If this bool is set, the
meaning of the x
and y
field is inverted compared to normal.
Keyboard
Keyboard button event information (a press or release).
Fields of Keyboard
timestamp: u32
When the event happened
window_id: u32
The window that was focused when the event happened.
is_key_down: bool
If the key was pressed or released by this event.
repeat_count: u8
If this is a "key repeat" event (usually 0 or 1, though possibly more).
key: KeyInfo
The information about the key being pressed or released.
WindowSizeChanged
Something has changed the size of the window.
If (and only if) this was done by an external action (the user or window
manager changing the size of the window, for example), this event will be
followed by an Event::WindowResized
.
Fields of WindowSizeChanged
WindowResized
The size of the window has been changed externally.
This event is always preceeded by a Event::WindowSizeChanged
, however
the inverse is not always true.
The difference between these two events is that Event::WindowResized
is
only generated if the resize is triggered externally (by a user, their
window manager, etc), and not by calls to beryllium
functions which
may change the size of a window, such as Window::set_size
,
Window::set_display_mode
, whereas Event::WindowSizeChanged
is called
whenever the size of the window is changed, regardless of the cause.
Fields of WindowResized
WindowMoved
The window has been moved.
Fields of WindowMoved
WindowClosed
The window manager requests that the window be closed.
Fields of WindowClosed
WindowGainedFocus
The window has gained keyboard focus.
Inverse of Event::WindowLostFocus
.
Fields of WindowGainedFocus
WindowLostFocus
The window has lost keyboard focus.
Inverse of Event::WindowGainedFocus
.
Fields of WindowLostFocus
MouseEnteredWindow
The window has gained mouse focus.
Inverse of Event::MouseLeftWindow
.
Fields of MouseEnteredWindow
MouseLeftWindow
The window has lost mouse focus.
Inverse of Event::MouseEnteredWindow
.
Fields of MouseLeftWindow
WindowHidden
The window has been hidden.
Inverse of Event::WindowShown
.
Fields of WindowHidden
WindowShown
The window has been shown.
Inverse of Event::WindowHidden
.
Fields of WindowShown
WindowNeedsRepaint
The window needs repainting for one reason or another.
This maps to SDL_WINDOWEVENT_EXPOSED
, but has been renamed in order to
make it more clear what the event indicates.
Fields of WindowNeedsRepaint
WindowMinimized
The window has been minimized.
Fields of WindowMinimized
WindowMaximized
The window has been maximized.
Fields of WindowMaximized
WindowRestored
The window has been restored to normal size and position.
Fields of WindowRestored
UnknownEventType
It's always possible that we'll load some future version which will have event variants we don't understand, which we have to just ignore.
Trait Implementations
impl Clone for Event
[src]
fn clone(&self) -> Event
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl Copy for Event
[src]
impl From<SDL_Event> for Event
[src]
fn from(event: SDL_Event) -> Self
[src]
Parses "without fail", but will turn unknown events into UnknownEventType
.
So, it's not lossless I guess. Whatever.
impl Debug for Event
[src]
Auto Trait Implementations
Blanket Implementations
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,