[][src]Struct sdl2::EventPump

pub struct EventPump { /* fields omitted */ }

A thread-safe type that encapsulates SDL event-pumping functions.

Methods

impl EventPump[src]

pub fn is_event_enabled(&self, event_type: EventType) -> bool[src]

Query if an event type is enabled.

pub fn enable_event(&mut self, event_type: EventType) -> bool[src]

Enable an event type. Returns if the event type was enabled before the call.

pub fn disable_event(&mut self, event_type: EventType) -> bool[src]

Disable an event type. Returns if the event type was enabled before the call.

pub fn poll_event(&mut self) -> Option<Event>[src]

Polls for currently pending events.

If no events are pending, None is returned.

pub fn poll_iter(&mut self) -> EventPollIterator[src]

Returns a polling iterator that calls poll_event(). The iterator will terminate once there are no more pending events.

Example

let sdl_context = sdl2::init().unwrap();
let mut event_pump = sdl_context.event_pump().unwrap();

for event in event_pump.poll_iter() {
    use sdl2::event::Event;
    match event {
        Event::KeyDown {..} => { /*...*/ },
        _ => ()
    }
}

pub fn pump_events(&mut self)[src]

Pumps the event loop, gathering events from the input devices.

pub fn wait_event(&mut self) -> Event[src]

Waits indefinitely for the next available event.

pub fn wait_event_timeout(&mut self, timeout: u32) -> Option<Event>[src]

Waits until the specified timeout (in milliseconds) for the next available event.

pub fn wait_iter(&mut self) -> EventWaitIterator[src]

Returns a waiting iterator that calls wait_event().

Note: The iterator will never terminate.

pub fn wait_timeout_iter(&mut self, timeout: u32) -> EventWaitTimeoutIterator[src]

Returns a waiting iterator that calls wait_event_timeout().

Note: The iterator will never terminate, unless waiting for an event exceeds the specified timeout.

pub fn keyboard_state(&self) -> KeyboardState[src]

pub fn mouse_state(&self) -> MouseState[src]

pub fn relative_mouse_state(&self) -> RelativeMouseState[src]

Trait Implementations

impl Drop for EventPump[src]

Auto Trait Implementations

impl !RefUnwindSafe for EventPump

impl !Send for EventPump

impl !Sync for EventPump

impl Unpin for EventPump

impl UnwindSafe for EventPump

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.