use winit::event::ElementState;

/// Denotes whether an event was a press event or a release event.
#[derive(Clone, Copy, PartialEq, Debug)]
pub enum PressState {
    Pressed,
    Released,
}

impl PressState {
    pub fn is_pressed(&self) -> bool {
        *self == Self::Pressed
    }
    pub fn is_released(&self) -> bool {
        *self == Self::Released
    }
}

impl From<ElementState> for PressState {
    fn from(value: ElementState) -> Self {
        match value {
            ElementState::Pressed => PressState::Pressed,
            ElementState::Released => PressState::Released,
        }
    }
}