2020-09-03 07:22:49 +10:00
|
|
|
#[derive(Debug, Copy, Clone, Eq, PartialEq)]
|
|
|
|
pub enum MouseButtonID {
|
|
|
|
Left,
|
|
|
|
Middle,
|
|
|
|
Right,
|
|
|
|
Back,
|
|
|
|
Forward,
|
|
|
|
Other(u8),
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Debug, Copy, Clone)]
|
|
|
|
pub struct MouseScroll {
|
|
|
|
pub x_delta: f64,
|
|
|
|
pub y_delta: f64,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Debug, Copy, Clone)]
|
|
|
|
pub struct MouseClick {
|
|
|
|
pub id: MouseButtonID,
|
2020-09-06 05:55:45 +10:00
|
|
|
pub click_count: usize,
|
2020-09-03 07:22:49 +10:00
|
|
|
pub x: i32,
|
|
|
|
pub y: i32,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Debug)]
|
|
|
|
pub struct WindowInfo {
|
|
|
|
pub width: u32,
|
|
|
|
pub height: u32,
|
2020-09-06 05:55:45 +10:00
|
|
|
pub scale: f64,
|
2020-09-03 07:22:49 +10:00
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Debug)]
|
2020-09-04 02:38:22 +10:00
|
|
|
pub enum Event {
|
2020-09-03 07:22:49 +10:00
|
|
|
CursorMotion(i32, i32), // new (x, y) relative to window
|
|
|
|
MouseDown(MouseButtonID),
|
|
|
|
MouseUp(MouseButtonID),
|
|
|
|
MouseScroll(MouseScroll),
|
|
|
|
MouseClick(MouseClick),
|
2020-09-03 07:23:03 +10:00
|
|
|
KeyDown(u8), // keycode
|
|
|
|
KeyUp(u8), // keycode
|
|
|
|
CharacterInput(u32), // character code
|
2020-09-03 07:22:49 +10:00
|
|
|
WindowResized(WindowInfo), // new (width, height)
|
|
|
|
WindowFocus,
|
|
|
|
WindowUnfocus,
|
|
|
|
WillClose,
|
2020-09-03 07:23:03 +10:00
|
|
|
}
|