Rethink workspace structure

This commit is contained in:
Héctor Ramón Jiménez 2019-09-14 19:16:06 +02:00
parent 8b8f7563ad
commit a97401aed2
44 changed files with 684 additions and 51 deletions

24
src/input/button_state.rs Normal file
View file

@ -0,0 +1,24 @@
/// The state of a button.
///
/// If you are using [`winit`], consider enabling the `winit` feature to get
/// conversion implementations for free!
///
/// [`winit`]: https://docs.rs/winit/0.20.0-alpha3/winit/
#[derive(Debug, Hash, Ord, PartialOrd, PartialEq, Eq, Clone, Copy)]
pub enum ButtonState {
/// The button is pressed.
Pressed,
/// The button is __not__ pressed.
Released,
}
#[cfg(feature = "winit")]
impl From<winit::event::ElementState> for ButtonState {
fn from(element_state: winit::event::ElementState) -> Self {
match element_state {
winit::event::ElementState::Pressed => ButtonState::Pressed,
winit::event::ElementState::Released => ButtonState::Released,
}
}
}