PistonDevelopers / input

DEPRECATED - moved into the piston repo
MIT License
7 stars 11 forks source link

Add `Trigger` trait #33

Closed bvssvni closed 10 years ago

bvssvni commented 10 years ago
pub trait Trigger<U> {
    /// Updates state and returns true if triggering on event.
    fn trigger(&mut self, event: &U) -> bool;
}

This will make it possible to handle arbitrary mappings with Box<Trigger>. For example, in Piston we have a FirstPerson camera controller which uses FirstPersonSettings. The key controls are limited to the keyboard. By using Box<Trigger> instead we can for example control the camera with both keyboard and gamepad at the same time.

bvssvni commented 10 years ago

This could be moved to rust-event.

bvssvni commented 10 years ago

Will wait with this since we now can use the Button enum.