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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
|
#pragma once
enum FontFlags_t
{
FONTFLAG_NONE,
FONTFLAG_ITALIC = 0x001,
FONTFLAG_UNDERLINE = 0x002,
FONTFLAG_STRIKEOUT = 0x004,
FONTFLAG_SYMBOL = 0x008,
FONTFLAG_ANTIALIAS = 0x010,
FONTFLAG_GAUSSIANBLUR = 0x020,
FONTFLAG_ROTARY = 0x040,
FONTFLAG_DROPSHADOW = 0x080,
FONTFLAG_ADDITIVE = 0x100,
FONTFLAG_OUTLINE = 0x200,
FONTFLAG_CUSTOM = 0x400,
FONTFLAG_BITMAP = 0x800,
};
struct Vector2D
{
Vector2D() {}
Vector2D(float x, float y) { this->x = x; this->y = y; }
float x;
float y;
};
struct Vertex_t
{
Vertex_t() {}
Vertex_t(const Vector2D& pos, const Vector2D& coord = Vector2D(0, 0))
{
m_Position = pos;
m_TexCoord = coord;
}
void Init(const Vector2D& pos, const Vector2D& coord = Vector2D(0, 0))
{
m_Position = pos;
m_TexCoord = coord;
}
Vector2D m_Position;
Vector2D m_TexCoord;
};
class ISurface
{
public:
unsigned long CreateFonts(void)
{
using OriginalFn = unsigned long(__thiscall*)(void*);
return CallVfunc< OriginalFn >(this, 51)(this);
}
void SetFontGlyphSet(unsigned long& font, const char* WindowsFontName, int tall, int weight, int blur, int scanlines, int flags)
{
using OriginalFn = void(__thiscall*)(void*, unsigned long, const char*, int, int, int, int, int, int, int);
CallVfunc<OriginalFn>(this, 58)(this, font, WindowsFontName, tall, weight, blur, scanlines, flags, 0, 0);
}
void GetTextSize(unsigned long font, const wchar_t* text, int& width, int& tall)
{
using OriginalFn = bool(__thiscall*)(void*, unsigned long, const wchar_t*, int&, int&);
CallVfunc<OriginalFn>(this, 66)(this, font, text, width, tall);
}
};
extern ISurface* pSurface;
class IVGuiPaintSurface
{
public:
void DrawColoredCircle(int centerx, int centery, float radius, int r, int g, int b, int a)
{
typedef void(__thiscall* OriginalFn)(void*, int, int, int, int, int, int, int);
CallVfunc< OriginalFn >(this, 7)(this, centerx, centery, radius, r, g, b, a);
}
void DrawFilledRectFade(int x0, int y0, int x1, int y1, size_t alpha0, size_t alpha1, bool horizontal)
{
using OriginalFn = void(__thiscall*)(void*, int, int, int, int, size_t, size_t, bool);
CallVfunc<OriginalFn>(this, 9)(this, x0, y0, x1, y1, alpha0, alpha1, horizontal);
}
void DrawOutlinedCircle(int x, int y, int radius, int segments)
{
typedef void(__thiscall* OriginalFn)(void*, int, int, int, int);
CallVfunc< OriginalFn >(this, 10)(this, x, y, radius, segments);
}
void DrawSetTextFont(unsigned long font)
{
using OriginalFn = void(__thiscall*)(void*, unsigned long);
CallVfunc< OriginalFn >(this, 13)(this, font);
}
void DrawSetColor(int r, int g, int b, int a)
{
using OriginalFn = void(__thiscall*)(void*, int, int, int, int);
CallVfunc<OriginalFn>(this, 17)(this, r, g, b, a);
}
void DrawFilledRect(int x0, int y0, int x1, int y1)
{
using OriginalFn = void(__thiscall*)(void*, int, int, int, int);
CallVfunc< OriginalFn >(this, 19)(this, x0, y0, x1, y1);
}
void DrawOutlinedRect(int x0, int y0, int x1, int y1)
{
using OriginalFn = void(__thiscall*)(void*, int, int, int, int);
CallVfunc< OriginalFn >(this, 21)(this, x0, y0, x1, y1);
}
void DrawLine(int x0, int y0, int x1, int y1)
{
using OriginalFn = void(__thiscall*)(void*, int, int, int, int);
CallVfunc< OriginalFn >(this, 22)(this, x0, y0, x1, y1);
}
void DrawSetTextColor(int r, int g, int b, int a)
{
using OriginalFn = void(__thiscall*)(void*, int, int, int, int);
CallVfunc< OriginalFn >(this, 25)(this, r, g, b, a);
}
void DrawSetTextPos(int x, int y)
{
using OriginalFn = void(__thiscall*)(void*, int, int);
CallVfunc< OriginalFn >(this, 26)(this, x, y);
}
void DrawPrintText(const wchar_t* text, int textLen)
{
using OriginalFn = void(__thiscall*)(void*, const wchar_t*, int);
CallVfunc< OriginalFn >(this, 27)(this, text, textLen);
}
void DrawSetTexture(int id)
{
typedef void(__thiscall* OriginalFn)(void*, int);
CallVfunc< OriginalFn >(this, 33)(this, id);
}
void DrawTexturedPolygon(int Count, Vertex_t* Vertices, bool bClipVertices = false)
{
typedef void(__thiscall* OriginalFn)(void*, int, Vertex_t*, bool);
return CallVfunc< OriginalFn >(this, 38)(this, Count, Vertices, bClipVertices);
}
void GetTextSize(unsigned long font, const wchar_t* text, int& width, int& tall)
{
using OriginalFn = bool(__thiscall*)(void*, unsigned long, const wchar_t*, int&, int&);
CallVfunc< OriginalFn >(this, 57)(this, font, text, width, tall);
}
int CreateNewTextureID(bool procedural = false)
{
typedef int(__thiscall* OriginalFn)(void*, bool);
return CallVfunc< OriginalFn >(this, 60)(this, procedural);
}
void DrawSetTextureRGBA(int id, const unsigned char* rgba, int wide, int tall, int hw = 0, bool fr = true)
{
using OriginalFn = void(__thiscall*)(void*, int, const unsigned char*, int, int, int, bool);
CallVfunc< OriginalFn >(this, 64)(this, id, rgba, wide, tall, hw, fr);
}
};
extern IVGuiPaintSurface* pPaintSurface;
|