Struct sdl2::EventPump[][src]

pub struct EventPump { /* fields omitted */ }
Expand description

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

Implementations

Query if an event type is enabled.

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

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

Polls for currently pending events.

If no events are pending, None is returned.

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 {..} => { /*...*/ },
        _ => ()
    }
}

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

Waits indefinitely for the next available event.

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

Returns a waiting iterator that calls wait_event().

Note: The iterator will never terminate.

Returns a waiting iterator that calls wait_event_timeout().

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

Trait Implementations

Executes the destructor for this type. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.