use std::sync::Arc;
use crate::AppState;
pub use winit::event::*;
#[derive(Copy, Clone)]
pub enum EventCharacteristic {
KeyPress(VirtualKeyCode),
MousePress(MouseButton),
MouseDown(MouseButton),
MouseScroll(MouseScrollDelta),
}
#[derive(Copy, Clone)]
pub struct EventModifiers {
pub ctrl: bool,
pub shift: bool,
pub alt: bool,
}
impl EventModifiers {
pub fn new(ctrl: bool, shift: bool, alt: bool) -> Self {
Self {
ctrl,
shift,
alt,
}
}
pub fn default() -> Self {
Self {
ctrl: false,
shift: false,
alt: false,
}
}
}
impl PartialEq for EventModifiers {
fn eq(&self, other: &Self) -> bool {
self.ctrl == other.ctrl && self.shift == other.shift && self.alt == other.alt
}
}
pub type EventFunction = Arc<dyn Fn(&mut AppState)>;