use crate::WindowId;
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
pub enum PixEvent {
None,
Quit,
AppTerminating,
GamepadBtn(u32, Button, bool),
GamepadAxis(u32, Axis, i16),
KeyPress(Key, bool, bool),
MousePress(Mouse, i32, i32, bool),
MouseWheel(i32),
MouseMotion(i32, i32),
WinClose(WindowId),
Resized,
Focus(u32, bool),
Background(bool),
}
#[derive(Debug, Copy, Clone)]
pub struct Input {
pub pressed: bool,
pub released: bool,
pub held: bool,
}
impl Input {
pub(super) fn new() -> Self {
Self {
pressed: false,
released: false,
held: false,
}
}
}
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
pub enum Mouse {
Left,
Middle,
Right,
X1,
X2,
Unknown,
}
#[rustfmt::skip]
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
pub enum Key {
A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z,
Num0, Num1, Num2, Num3, Num4, Num5, Num6, Num7, Num8, Num9,
Kp0, Kp1, Kp2, Kp3, Kp4, Kp5, Kp6, Kp7, Kp8, Kp9,
F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12,
Left, Up, Down, Right,
Tab, Insert, Delete, Home, End, PageUp, PageDown,
Escape, Backspace, Return, KpEnter, Pause, ScrollLock,
Plus, Minus, Period, Underscore, Equals,
KpMultiply, KpDivide, KpPlus, KpMinus, KpPeriod,
Backquote, Exclaim, At, Hash, Dollar, Percent,
Caret, Ampersand, Asterisk, LeftParen, RightParen,
LeftBracket, RightBracket, Backslash,
CapsLock, Semicolon, Colon, Quotedbl, Quote,
Less, Comma, Greater, Question, Slash,
LShift, RShift, Space, Ctrl, Alt, Meta,
Unknown,
}
#[rustfmt::skip]
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
pub enum Button {
A, B, X, Y, Back, Start, Guide, DPadUp, DPadDown, DPadLeft, DPadRight,
LeftStick, RightStick, LeftShoulder, RightShoulder,
}
#[rustfmt::skip]
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
pub enum Axis {
LeftX, RightX, LeftY, RightY, TriggerLeft, TriggerRight,
}
impl Default for PixEvent {
fn default() -> Self {
Self::None
}
}
impl Default for Mouse {
fn default() -> Self {
Self::Left
}
}
impl Default for Key {
fn default() -> Self {
Self::A
}
}
impl Default for Button {
fn default() -> Self {
Self::A
}
}
impl Default for Axis {
fn default() -> Self {
Self::LeftX
}
}
impl Default for Input {
fn default() -> Self {
Self::new()
}
}