Add conversion functions for winit feature
This commit is contained in:
parent
6fbba6f4ee
commit
c0083437eb
5 changed files with 195 additions and 6 deletions
|
|
@ -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,
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue