[][src]Struct blinds::event_cache::EventCache

pub struct EventCache { /* fields omitted */ }

A struct that stores all input event values

While this is mostly takes care of book keeping necessary to store input event state, it also handles cases like the window losing focus (which should completely reset input state).

It is capable of tracking individual pointers and gamepads, as well as the global key state and mouse.

Implementations

impl EventCache[src]

pub fn new() -> EventCache[src]

pub fn process_event(&mut self, event: &Event)[src]

Take an event and update the internal state to reflect it

pub fn clear(&mut self)[src]

Clear all of the state

pub fn key(&self, key: Key) -> bool[src]

Check if a given key is down

pub fn mouse(&self) -> &PointerState[src]

The state of the global mouse

Under a system with touch input or with multiple cursors, this may report erratic results. The state here is tracked for every pointer event, regardless of pointer ID.

pub fn pointer(&self, id: &PointerId) -> Option<&PointerState>[src]

The state of the given pointer

pub fn pointers(&self) -> impl Iterator<Item = (&PointerId, &PointerState)>[src]

The pointer ID and values that have been tracked

pub fn gamepad(&self, id: &GamepadId) -> Option<&GamepadState>[src]

The state of the given gamepad

pub fn gamepads(&self) -> impl Iterator<Item = (&GamepadId, &GamepadState)>[src]

The gamepad ID and values that have been tracked

Trait Implementations

impl Default for EventCache[src]

Auto Trait Implementations

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, 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.