classicube_sys\screen/
priority.rs

1use crate::bindings::{
2    GuiPriority_GUI_PRIORITY_CHAT, GuiPriority_GUI_PRIORITY_DISCONNECT,
3    GuiPriority_GUI_PRIORITY_HUD, GuiPriority_GUI_PRIORITY_INVENTORY,
4    GuiPriority_GUI_PRIORITY_LOADING, GuiPriority_GUI_PRIORITY_MENU,
5    GuiPriority_GUI_PRIORITY_OLDLOADING, GuiPriority_GUI_PRIORITY_TEXIDS,
6    GuiPriority_GUI_PRIORITY_TEXPACK, GuiPriority_GUI_PRIORITY_TOUCH,
7    GuiPriority_GUI_PRIORITY_TOUCHMORE, GuiPriority_GUI_PRIORITY_URLWARNING,
8};
9
10#[derive(Debug, Clone)]
11pub enum Priority {
12    UnderDisconnect,
13    Disconnect,
14    OverDisconnect,
15    UnderOldLoading,
16    OldLoading,
17    OverOldLoading,
18    UnderMenu,
19    Menu,
20    OverMenu,
21    UnderTouchMore,
22    TouchMore,
23    OverTouchMore,
24    UnderUrlWarning,
25    UrlWarning,
26    OverUrlWarning,
27    UnderTexPack,
28    TexPack,
29    OverTexPack,
30    UnderTexIds,
31    TexIds,
32    OverTexIds,
33    UnderTouch,
34    Touch,
35    OverTouch,
36    UnderInventory,
37    Inventory,
38    OverInventory,
39    UnderChat,
40    Chat,
41    OverChat,
42    UnderHud,
43    Hud,
44    OverHud,
45    UnderLoading,
46    Loading,
47    OverLoading,
48    UnderEverything,
49    OverEverything,
50    Custom(u8),
51}
52
53impl From<u8> for Priority {
54    fn from(n: u8) -> Self {
55        Self::Custom(n)
56    }
57}
58
59impl Priority {
60    pub fn to_u8(&self) -> u8 {
61        match self {
62            Self::UnderDisconnect => GuiPriority_GUI_PRIORITY_DISCONNECT as u8 - 1,
63            Self::Disconnect => GuiPriority_GUI_PRIORITY_DISCONNECT as u8,
64            Self::OverDisconnect => GuiPriority_GUI_PRIORITY_DISCONNECT as u8 + 1,
65            Self::UnderOldLoading => GuiPriority_GUI_PRIORITY_OLDLOADING as u8 - 1,
66            Self::OldLoading => GuiPriority_GUI_PRIORITY_OLDLOADING as u8,
67            Self::OverOldLoading => GuiPriority_GUI_PRIORITY_OLDLOADING as u8 + 1,
68            Self::UnderMenu => GuiPriority_GUI_PRIORITY_MENU as u8 - 1,
69            Self::Menu => GuiPriority_GUI_PRIORITY_MENU as u8,
70            Self::OverMenu => GuiPriority_GUI_PRIORITY_MENU as u8 + 1,
71            Self::UnderTouchMore => GuiPriority_GUI_PRIORITY_TOUCHMORE as u8 - 1,
72            Self::TouchMore => GuiPriority_GUI_PRIORITY_TOUCHMORE as u8,
73            Self::OverTouchMore => GuiPriority_GUI_PRIORITY_TOUCHMORE as u8 + 1,
74            Self::UnderUrlWarning => GuiPriority_GUI_PRIORITY_URLWARNING as u8 - 1,
75            Self::UrlWarning => GuiPriority_GUI_PRIORITY_URLWARNING as u8,
76            Self::OverUrlWarning => GuiPriority_GUI_PRIORITY_URLWARNING as u8 + 1,
77            Self::UnderTexPack => GuiPriority_GUI_PRIORITY_TEXPACK as u8 - 1,
78            Self::TexPack => GuiPriority_GUI_PRIORITY_TEXPACK as u8,
79            Self::OverTexPack => GuiPriority_GUI_PRIORITY_TEXPACK as u8 + 1,
80            Self::UnderTexIds => GuiPriority_GUI_PRIORITY_TEXIDS as u8 - 1,
81            Self::TexIds => GuiPriority_GUI_PRIORITY_TEXIDS as u8,
82            Self::OverTexIds => GuiPriority_GUI_PRIORITY_TEXIDS as u8 + 1,
83            Self::UnderTouch => GuiPriority_GUI_PRIORITY_TOUCH as u8 - 1,
84            Self::Touch => GuiPriority_GUI_PRIORITY_TOUCH as u8,
85            Self::OverTouch => GuiPriority_GUI_PRIORITY_TOUCH as u8 + 1,
86            Self::UnderInventory => GuiPriority_GUI_PRIORITY_INVENTORY as u8 - 1,
87            Self::Inventory => GuiPriority_GUI_PRIORITY_INVENTORY as u8,
88            Self::OverInventory => GuiPriority_GUI_PRIORITY_INVENTORY as u8 + 1,
89            Self::UnderChat => GuiPriority_GUI_PRIORITY_CHAT as u8 - 1,
90            Self::Chat => GuiPriority_GUI_PRIORITY_CHAT as u8,
91            Self::OverChat => GuiPriority_GUI_PRIORITY_CHAT as u8 + 1,
92            Self::UnderHud => GuiPriority_GUI_PRIORITY_HUD as u8 - 1,
93            Self::Hud => GuiPriority_GUI_PRIORITY_HUD as u8,
94            Self::OverHud => GuiPriority_GUI_PRIORITY_HUD as u8 + 1,
95            Self::UnderLoading => GuiPriority_GUI_PRIORITY_LOADING as u8 - 1,
96            Self::Loading => GuiPriority_GUI_PRIORITY_LOADING as u8,
97            Self::OverLoading => GuiPriority_GUI_PRIORITY_LOADING as u8 + 1,
98            Self::UnderEverything => 0,
99            Self::OverEverything => 255,
100            Self::Custom(n) => *n,
101        }
102    }
103}