[−][src]Enum tetra::Event
Events that can occur while the game is running.
The event
method on the State
trait will recieve
events as they occur.
Examples
The events
example demonstrates how to handle events.
Variants (Non-exhaustive)
The game window was resized.
Fields of Resized
The game window was focused by the user.
The game window was un-focused by the user.
A key on the keyboard was pressed.
Fields of KeyPressed
key: Key
The key that was pressed.
A key on the keyboard was released.
Fields of KeyReleased
key: Key
The key that was released.
A button on the mouse was pressed.
Fields of MouseButtonPressed
The button that was pressed.
A button on the mouse was released.
Fields of MouseButtonReleased
The button that was released.
The mouse was moved.
Fields of MouseMoved
position: Vec2<f32>
The new position of the mouse, in window co-ordinates.
If relative mouse mode is enabled, this field is not guarenteed to update.
delta: Vec2<f32>
The movement of the mouse, relative to the position
of the previous
MouseMoved
event.
The mouse wheel was moved.
Fields of MouseWheelMoved
amount: Vec2<i32>
The amount that the wheel was moved.
Most 'normal' mice can only scroll vertically, but some devices can also scroll horizontally. Use the Y component of the returned vector if you don't care about horizontal scroll.
Positive values correspond to scrolling up/right, negative values correspond to scrolling down/left.
A gamepad was connected to the system.
Fields of GamepadAdded
id: usize
The ID that was assigned to the gamepad.
A gamepad was removed from the system.
Fields of GamepadRemoved
id: usize
The ID of the gamepad that was removed.
A button on a gamepad was pressed.
Fields of GamepadButtonPressed
A button on a gamepad was released.
Fields of GamepadButtonReleased
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.
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.
The user typed some text.
Fields of TextInput
text: String
The text that was typed by the user.
The user dropped a file into the window.
This event will be fired multiple times if the user dropped multiple files at the same time.
Note that on MacOS, you must edit your info.plist
file to set which document types
you want your application to support,
otherwise no FileDropped
events will be fired.
Fields of FileDropped
path: PathBuf
The path of the file that was dropped.
Trait Implementations
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]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> SetParameter for T
pub fn set<T>(&mut self, value: T) -> <T as Parameter<Self>>::Result where
T: Parameter<Self>,
T: Parameter<Self>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut 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.
pub 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>,