pub const MAX_TOUCH_POINTS: usize = 5;
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum TouchState {
Down,
Up,
Contact,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub struct TouchPoint {
pub id: u8,
pub x: i32,
pub y: i32,
pub state: TouchState,
}
impl Default for TouchPoint {
fn default() -> Self {
Self {
id: 0,
x: 0,
y: 0,
state: TouchState::Up,
}
}
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum Event {
Tick,
PointerDown {
x: i32,
y: i32,
},
PointerUp {
x: i32,
y: i32,
},
PointerMove {
x: i32,
y: i32,
},
Touch {
count: u8,
points: [TouchPoint; MAX_TOUCH_POINTS],
},
PressDown {
x: i32,
y: i32,
},
PressRelease {
x: i32,
y: i32,
},
DoubleTap {
x: i32,
y: i32,
},
KeyDown {
key: Key,
},
KeyUp {
key: Key,
},
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum Key {
Escape,
Enter,
Space,
ArrowUp,
ArrowDown,
ArrowLeft,
ArrowRight,
Function(u8),
Character(char),
Other(u32),
}