wolfrpg_map_parser/command/input_key_command/input_key/
direction_keys.rs1#[cfg(feature = "serde")]
2use serde::{Serialize, Deserialize};
3
4#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
5#[derive(PartialEq, Clone)]
6pub enum DirectionKeys {
7 No = 0x00,
8 Dir4 = 0x01,
9 Dir8 = 0x02,
10 Up = 0x03,
11 Down = 0x04,
12 Left = 0x05,
13 Right = 0x06,
14 UpDown = 0x07,
15 LeftRight = 0x08,
16 Unknown
17}
18
19impl DirectionKeys {
20 pub const fn new(direction: u8) -> Self {
21 match direction {
22 0x00 => Self::No,
23 0x01 => Self::Dir4,
24 0x02 => Self::Dir8,
25 0x03 => Self::Up,
26 0x04 => Self::Down,
27 0x05 => Self::Left,
28 0x06 => Self::Right,
29 0x07 => Self::UpDown,
30 0x08 => Self::LeftRight,
31 _ => Self::Unknown,
32 }
33 }
34}