Add conversion functions for winit feature

This commit is contained in:
Héctor Ramón Jiménez 2019-09-01 05:28:19 +02:00
parent 6fbba6f4ee
commit c0083437eb
5 changed files with 195 additions and 6 deletions

View file

@ -7,3 +7,17 @@ pub enum ButtonState {
/// The button is __not__ pressed.
Released,
}
#[cfg(feature = "winit")]
mod winit_conversion {
use winit::event::ElementState;
impl From<ElementState> for super::ButtonState {
fn from(element_state: ElementState) -> Self {
match element_state {
ElementState::Pressed => super::ButtonState::Pressed,
ElementState::Released => super::ButtonState::Released,
}
}
}
}