Create iced_core and iced_native
This commit is contained in:
parent
b83a4b42dd
commit
b9e0f74948
81 changed files with 2576 additions and 2709 deletions
24
native/src/input/button_state.rs
Normal file
24
native/src/input/button_state.rs
Normal 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,
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue