cacf71b61c
Former-commit-id: c57ef7336468ec1b2386a1c3faa753468b45eeb3 Former-commit-id: a98ec18b83a192c371cedbf3cd0efbb1586c4552
34 lines
626 B
Rust
34 lines
626 B
Rust
#[derive(Debug, Primitive, PartialEq, Eq, Clone, Copy)]
|
|
#[repr(u8)]
|
|
pub enum Keys {
|
|
ButtonA = 0,
|
|
ButtonB = 1,
|
|
Select = 2,
|
|
Start = 3,
|
|
Right = 4,
|
|
Left = 5,
|
|
Up = 6,
|
|
Down = 7,
|
|
ButtonR = 8,
|
|
ButtonL = 9,
|
|
}
|
|
|
|
pub const NUM_KEYS: usize = 10;
|
|
pub const KEYINPUT_ALL_RELEASED: u16 = 0b1111111111;
|
|
|
|
#[derive(Debug, Primitive, PartialEq, Eq)]
|
|
#[repr(u8)]
|
|
pub enum KeyState {
|
|
Pressed = 0,
|
|
Released = 1,
|
|
}
|
|
|
|
impl From<KeyState> for bool {
|
|
fn from(val: KeyState) -> Self {
|
|
match val {
|
|
KeyState::Pressed => false,
|
|
KeyState::Released => true,
|
|
}
|
|
}
|
|
}
|