-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathclientmenu.h
More file actions
117 lines (86 loc) · 2.88 KB
/
clientmenu.h
File metadata and controls
117 lines (86 loc) · 2.88 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
#include <string>
#include <unordered_map>
#include <IDetoursAPI.h>
#include <base_feature.h>
#include <color.h>
#include <vgui2/VGUI2.h>
//-----------------------------------------------------------------------------
// Label Flags
//-----------------------------------------------------------------------------
#define FL_LABEL_INDENT ( 1 << 0 )
#define FL_LABEL_PLAYERNAME ( 1 << 1 )
//-----------------------------------------------------------------------------
// CClientMenuContext
//-----------------------------------------------------------------------------
class CClientMenuContext
{
friend class CClientMenu;
public:
CClientMenuContext();
~CClientMenuContext();
void Draw(const Color &titleColor, const Color &labelColor, const Color &labelNumberColor);
void SlotInput(int slot);
public:
inline const wchar_t *GetTitle() const { return m_pwszTitle; }
inline const wchar_t *GetLabel(int slot) const { return m_pwszLabels[slot]; }
inline const char *GetCommand(int slot) const { return m_pszCommands[slot]; }
inline int GetFlags(int slot) const { return m_fLabelsFlags[slot]; }
inline bool HasLabel(int slot) const { return m_pwszLabels[slot] != NULL; }
private:
void DrawPrintText(vgui::HFont font, int x, int y, int r, int g, int b, int alpha, const wchar_t *pwszText);
void FeedTitle(const wchar_t *pwszTitle);
void FeedLabel(const wchar_t *pwszLabel, int slot);
void FeedTitle(const char *pszTitle);
void FeedLabel(const char *pszLabel, int slot);
void FeedCommand(const char *pszCommand, int slot);
void FeedFlags(int flags, int slot);
void CalcHeight(vgui::HFont font, int &height, int &titleTall, int labelsTall[10]);
private:
const wchar_t *m_pwszTitle;
const wchar_t *m_pwszLabels[10];
const char *m_pszCommands[10];
int m_fLabelsFlags[10];
};
//-----------------------------------------------------------------------------
// CClientMenu
//-----------------------------------------------------------------------------
class CClientMenu : CBaseFeature
{
public:
CClientMenu();
virtual bool Load();
virtual void PostLoad();
virtual void Unload();
public:
void Draw();
void OnGameFrame();
void OnVideoInit();
bool LoadFromFile();
bool HandleSlotInput(int slot);
void ShowMenu(const char *pszName);
void CloseMenu();
void ResetMenu();
bool IsMenuVisible();
void ClearAllContexts();
private:
CClientMenuContext *m_pCurrentMenu;
CClientMenuContext *m_pFadeMenu;
float m_flMenuCloseTime;
float m_flFadeTime;
float m_flFadeDuration;
Color m_TitleColor;
Color m_LabelColor;
Color m_LabelNumberColor;
std::unordered_map<std::string, CClientMenuContext *> m_Menus;
DetourHandle_t m_hslot10;
DetourHandle_t m_hslot1;
DetourHandle_t m_hslot2;
DetourHandle_t m_hslot3;
DetourHandle_t m_hslot4;
DetourHandle_t m_hslot5;
DetourHandle_t m_hslot6;
DetourHandle_t m_hslot7;
DetourHandle_t m_hslot8;
DetourHandle_t m_hslot9;
};
extern CClientMenu g_ClientMenu;