-
Notifications
You must be signed in to change notification settings - Fork 1
/
Menu.h
120 lines (84 loc) · 2.63 KB
/
Menu.h
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
118
119
120
#pragma once
#include <Windows.h>
#include <string>
#include <string_view>
#include "ImGui/imgui_internal.h"
#include "Console.h"
#include "Utils.h"
#include "Variables.h"
class CConfig;
struct ImColorScheme : public ImColor
{
//constexpr ImColorScheme(ImColor& Color, float flAlpha)
//{
// this->Value = Color.Value;
// this->Value.w = flAlpha;
//}
// Slightly Skewed for alpha blending
static void Analogous(ImColor& Color, ImColor& Secondary, ImColor& Tertiary, float flVariance)
{
WORD H, L, S;
//WORD Alpha = 0xFF;
WORD Alpha = (WORD)((1.0f - sinf(M_PI_F * flVariance)) * 255.f);
ColorRGBToHLS(Color, &H, &L, &S);
Secondary = (Alpha << IM_COL32_A_SHIFT) | ColorHLSToRGB(ImLerp<WORD>(H, 255, flVariance), L, S);
Tertiary = (Alpha << IM_COL32_A_SHIFT) | ColorHLSToRGB(ImLerp<WORD>(H, 0, -flVariance), L, S);
}
static ImColor AlphaModulate(ImColor& Color, float flAlpha)
{
ImColor ColorOut = Color;
ColorOut.Value.w *= flAlpha;
return ColorOut;
}
static ImColor Secondary(ImColor& Color)
{
float h = 0.0f, s = 0.0f, v = 0.0f;
float r = 0.0f, g = 0.0f, b = 0.0f;
ImGui::ColorConvertRGBtoHSV(Color.Value.x, Color.Value.y, Color.Value.z, h, s, v);
ImGui::ColorConvertHSVtoRGB(h, s, v * 0.60f, r, g, b);
return ImColor(r, g, b, Color.Value.w * (1.0f - v));
}
//static constexpr ImColor ()
};
class CMenu
{
public:
CMenu(const CAdapter* pAdapter);
~CMenu(void);
void Draw(const ImVec2 vSize);
void DisplayEntityHandles(void);
HRESULT KeyboardHandler(HRESULT Result, LPVOID lpvData, DWORD cbData);
HRESULT MouseHandler(LPVOID lpvData, DWORD cbData);
bool IsOpen(void) const;
ImGuiStyle* ApplyStyle(ImColor& Primary = ImColor(7, 74, 25, 255),
ImColor& PrimaryBg = ImColor(7, 17, 74, 220));
void LoadConfig(LPCTSTR szConfig);
void SaveConfig(LPCTSTR szConfig);
private:
void GameplayTab(Pl0000* pCameraEnt);
void VisualsTab(CBehaviorAppBase* pCameraEnt);
void MiscTab(void);
void ConfigTab(void);
bool m_bOpened;
bool m_bIgnoreInputWhenOpened;
char m_szAdapterUtf8[128 * 4];
char m_szOutputUtf8[32 * 4];
BOOLEAN m_KeyboardState[256];
BOOLEAN m_OldKeyboardState[256];
DIMOUSESTATE2 MouseState;
DIMOUSESTATE2 OldMouseState;
ImColor m_Primary;
ImColor m_PrimaryBg;
CConfig* m_pConfig;
struct Config_t
{
PWIN32_FIND_DATA_LIST pHead;
INT iSelectedConfig;
TCHAR szName[MAX_PATH];
} Config;
constexpr static const char* s_MenuTitle = "2B Hook! ~ 2B Owns Me and All :^)";
};
extern CMenu* g_pMenu;
static void ApplyModelMods(Pl0000* pEntity);
static bool BlacklistItemCallback(void* data, int idx, const char** out_text);
static bool ConfigCallback(void* data, int idx, const char** out_text);