This repository has been archived by the owner on Jan 26, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
MenuX_sFunction.h
114 lines (87 loc) · 2.81 KB
/
MenuX_sFunction.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
void DrawBorder(int x, int y, int w, int h, int px, D3DCOLOR BorderColor, LPDIRECT3DDEVICE9 pDevice)
{
FillRGB(x,(y + h - px), w, px, BorderColor, pDevice);
FillRGB(x, y, px, h, BorderColor, pDevice);
FillRGB(x, y, w, px, BorderColor, pDevice);
FillRGB(x + w - px, y, px, h, BorderColor, pDevice);
}
void DrawBox(int x, int y, int w, int h, D3DCOLOR Color, D3DCOLOR BorderColor, LPDIRECT3DDEVICE9 pDevice)
{
DrawBorder(x, y, w, h, 2, BorderColor, pDevice);
const DWORD D3D_FVF = D3DFVF_XYZRHW | D3DFVF_DIFFUSE;
struct Vertex {
float x, y, w, h;
D3DCOLOR Color;
}
V[4] = {{(float) x, (float)(y + h), 0.0f, 0.0f, Color},
{(float) x, (float)y, 0.0f, 0.0f, Color},
{(float)(x + w), (float)(y + h), 0.0f, 0.0f, Color},
{(float)(x + w), (float)y, 0.0f, 0.0f, Color}
};
pDevice->SetRenderState(D3DRS_ALPHABLENDENABLE, D3DZB_TRUE);
pDevice->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA);
pDevice->SetRenderState(D3DRS_ZENABLE, D3DZB_FALSE);
pDevice->SetRenderState(D3DRS_FOGENABLE, D3DZB_FALSE);
pDevice->SetFVF(D3D_FVF);
pDevice->SetTexture(0, NULL);
pDevice->DrawPrimitiveUP(D3DPT_TRIANGLESTRIP, 2, V, sizeof(Vertex));
}
void PrintText(LPD3DXFONT g_pFont, INT x, INT y, DWORD Flags, DWORD Color, CHAR *text, ...)
{
RECT rec;
SetRect(&rec, x, y, x, y);
CHAR logbuf[512] = {0};
va_list va_alist;
va_start(va_alist, text);
vsnprintf(logbuf + strlen(logbuf), sizeof(logbuf) - strlen(logbuf), text, va_alist);
va_end(va_alist);
g_pFont->DrawTextA(NULL, logbuf, -1, &rec, Flags, Color);
}
void Item(CHAR *text, CHAR **opt, INT &val, INT maxvalue, LPDIRECT3DDEVICE9 pDevice)
{
DWORD Color1, Color2;
INT bVar = (val)?(val):0;
extern INT Current;
if(Menu && NHT3XT)
{
if(MenuSelection == qntHacks)
{
if(IsKeyPressed(VK_RIGHT,0))
if(val < maxvalue - 1)
val++;
if(IsKeyPressed(VK_LEFT,0))
if(val > 0)
val--;
}
Color1 = White;
Color2 = (bVar)?Green:Red;
PrintText(NHT3XT, menux + 20, menuy + 20 + (qntHacks * 20), TLeft, Color1, text);
PrintText(NHT3XT, menux - 15 + mxofs, menuy + 20 + (qntHacks * 20), TRight, Color2, opt[bVar]);
qntHacks++;
}
Current++;
}
void Folder(CHAR *text, CHAR **opt, INT &val, INT maxvalue)
{
DWORD Color1, Color2;
int bVar = (val)?(val):0;
extern int Current;
if(Menu && NHT3XT)
{
if(MenuSelection == qntHacks)
{
if(IsKeyPressed(VK_RIGHT,0))
if(val < maxvalue - 1)
val++;
if(IsKeyPressed(VK_LEFT,0))
if(val > 0)
val--;
}
Color1 = Yellow;
Color2 = (bVar)?Yellow:Yellow;
PrintText(NHT3XT, menux + 20, menuy + 20 + (qntHacks * 20), TLeft, Color1, text);
PrintText(NHT3XT, menux - 15 + mxofs, menuy + 20 + (qntHacks * 20), TRight, Color2, opt[bVar]);
qntHacks++;
}
Current++;
}