wolfrpg_map_parser/command/input_key_command/input_toggle/
device_inputs.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#[cfg(feature = "serde")]
use serde::{Serialize, Deserialize};

#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[derive(PartialEq)]
pub enum DeviceInputs {
    KeyboardKey     = 0x00,
    AllMouseInput   = 0x01,
    AllPadInput     = 0x02,
    AllDevices      = 0x03,
    Unknown
}

impl DeviceInputs {
    pub const fn new(inputs: u8) -> Self {
        match inputs {
            0x00 => DeviceInputs::KeyboardKey,
            0x01 => DeviceInputs::AllMouseInput,
            0x02 => DeviceInputs::AllPadInput,
            0x03 => DeviceInputs::AllDevices,
            _ => DeviceInputs::Unknown
        }
    }
}