-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDraw.h
356 lines (324 loc) · 9.78 KB
/
Draw.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
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
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
void Font(CHAR* FontName, int HFont, DWORD Stile, IDirect3DDevice9* pDevice)
{
D3DXCreateFont(pDevice, HFont, 0, Stile, 1, 0, RUSSIAN_CHARSET, OUT_DEVICE_PRECIS, CLEARTYPE_QUALITY, DEFAULT_PITCH | FF_DONTCARE, FontName, &pFont);
}
void DrawBox(FLOAT x, FLOAT y, FLOAT w, FLOAT h, D3DCOLOR Color, LPDIRECT3DDEVICE9 pDevice)
{
D3DRECT rec = { x, y - h, x + w, y };
pDevice->SetRenderState(D3DRS_ALPHABLENDENABLE, TRUE);
pDevice->Clear(1, &rec, D3DCLEAR_TARGET, Color, 0, 0);
}
void DrawBorder(int x, int y, int w, int h, int o, D3DCOLOR color, LPDIRECT3DDEVICE9 pDevice)
{
DrawBox(x, y, w, 2, color, pDevice);
DrawBox(x - 1, y, 2, h, color, pDevice);
DrawBox(x - 1, y - h, w + 2 + 1, 2, color, pDevice);
DrawBox(x + w, y, 2, h, color, pDevice);
}
LPD3DXLINE S_Line;
void DrawLine(float StartX, float StartY, float EndX, float EndY, int Width, D3DCOLOR dColor)
{
S_Line[0].SetWidth(Width);
S_Line[0].SetGLLines(0);
S_Line[0].SetAntialias(1);
D3DXVECTOR2 v2Line[2];
v2Line[0].x = StartX;
v2Line[0].y = StartY;
v2Line[1].x = EndX;
v2Line[1].y = EndY;
S_Line[0].Begin();
S_Line[0].Draw(v2Line, 2, dColor);
S_Line[0].End();
}
LPD3DXLINE g_pLine = NULL;
void DrawRectangle(float x, float y, float w, int h)
{
D3DXVECTOR2 vLine1[2];
D3DXVECTOR2 vLine2[2];
D3DXVECTOR2 vLine3[2];
D3DXVECTOR2 vLine4[2];
vLine1[0].x = x;
vLine1[0].y = y;
vLine1[1].x = x;
vLine1[1].y = y+h;
vLine2[0].x = x+w;
vLine2[0].y = y;
vLine2[1].x = x+w;
vLine2[1].y = y+h;
vLine3[0].x = x;
vLine3[0].y = y;
vLine3[1].x = x+w;
vLine3[1].y = y;
vLine4[0].x = x;
vLine4[0].y = y+h;
vLine4[1].x = x+w;
vLine4[1].y = y+h;
S_Line->SetWidth(2);
S_Line->SetAntialias(false);
S_Line->SetGLLines(false);
S_Line->Begin();
S_Line->Draw(vLine1, 2, 0xFF0000FF);
S_Line->Draw(vLine2, 2, 0xFF0000FF);
S_Line->Draw(vLine3, 2, 0xFF0000FF);
S_Line->Draw(vLine4, 2, 0xFF0000FF);
S_Line->End();
}
void String(int x, int y, DWORD Color, DWORD Style, const char *Format, ...)
{
RECT rect;
SetRect(&rect, x, y, x, y);
char Buffer[1024] = { '\0' };
va_list va_alist;
va_start(va_alist, Format);
vsprintf_s(Buffer, Format, va_alist);
va_end(va_alist);
pFont->DrawTextA(NULL, Buffer, -1, &rect, Style, Color);
return;
}
void SString(int x, int y, DWORD Color, DWORD Style, const char *Format, ...)
{
RECT rect;
SetRect(&rect, x, y, x, y);
char Buffer[1024] = { '\0' };
va_list va_alist;
va_start(va_alist, Format);
vsprintf_s(Buffer, Format, va_alist);
va_end(va_alist);
pFont->DrawTextA(NULL, Buffer, -1, &rect, Style, Color);
return;
}
void Box(int x, int y, int w, int h, D3DCOLOR Color, LPDIRECT3DDEVICE9 pD3D9)
{
struct Vertex
{
float x, y, z, ht;
DWORD Color;
}
V[4] = { {x, y + h, 0.0f, 0.0f, Color}, { x, y, 0.0f, 0.0f, Color }, { x + w, y + h, 0.0f, 0.0f, Color }, { x + w, y, 0.0f, 0.0f, Color } };
pD3D9->SetTexture(0, NULL);
pD3D9->SetPixelShader(0);
pD3D9->SetFVF(D3DFVF_XYZRHW | D3DFVF_DIFFUSE);
pD3D9->SetRenderState(D3DRS_ALPHABLENDENABLE, true);
pD3D9->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA);
pD3D9->SetRenderState(D3DRS_ZENABLE, FALSE);
pD3D9->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE);
pD3D9->DrawPrimitiveUP(D3DPT_TRIANGLESTRIP, 2, V, sizeof(Vertex));
return;
}
void Border(int x, int y, int w, int h, int s, D3DCOLOR Color, LPDIRECT3DDEVICE9 pD3D9)
{
Box(x - s, y, s, h, Color, pD3D9);
Box(x - s, y + h, w + s * 2, s, Color, pD3D9);
Box(x - s, y - s, w + s * 2, s, Color, pD3D9);
Box(x + w, y, s, h + s, Color, pD3D9);
}
//-----------------------------------------------------------------------------
// Exam: Xhair(Size,Width,Color,10,pDevice);
// Desc: Ïåðåõðåñòèå â öåíòðå åêðàíà (Ïðèöåë â øóòåðàõ , CrossHair)
// Ñonc: Menu
//-----------------------------------------------------------------------------
VOID Xhair(D3DCOLOR Color, IDirect3DDevice9* pDevice)
{
D3DVIEWPORT9 viewP;
pDevice->GetViewport(&viewP);
DWORD ScreenCenterX = viewP.Width / 2;
DWORD ScreenCenterY = viewP.Height / 2;
D3DRECT rec16 = {ScreenCenterX-5, ScreenCenterY, ScreenCenterX+ 5, ScreenCenterY+1};
D3DRECT rec17 = {ScreenCenterX, ScreenCenterY-5, ScreenCenterX+ 1,ScreenCenterY+5};
pDevice->Clear( 1, &rec16, D3DCLEAR_TARGET, Color, 0, 0 );
pDevice->Clear( 1, &rec17, D3DCLEAR_TARGET, Color, 0, 0 );
}
//-----------------------------------------------------------------------------
// Exam: D3D9ScreenShot(pDevice);
// Desc: Ñêðèíøîò
// Ñonc: Menu
//-----------------------------------------------------------------------------
//int i1,i2,i3,i4,i5,i6,i7,i8,i9,i10,i11,i12,i13,i14,i15,i16,i17,i18,i19,i20,i21,i22,i23,i24,i25,i26,i27,i28,i29,i30,off,on,save;
void D3D9ScreenShot(IDirect3DDevice9* pDevice)
{
/*
i=Show;
i1=Fun.Art;
i2=Fun.Crosshair;
i3=Fun.Drop;
i4=Fun.Grib;
i5=Fun.Listva;
i6=Fun.Mob;
i7=Fun.Nichki;
i8=Fun.pvp;
i9=Fun.Svet;
i10=Fun.Travi;
i11=Fun.WireFrame;
Show=0;
Fun.Art=0;
Fun.Crosshair=0;
Fun.Drop=0;
Fun.Grib=0;
Fun.Listva=0;
Fun.Mob=0;
Fun.Nichki=0;
Fun.pvp=0;
Fun.Svet=0;
Fun.Travi=0;
Fun.WireFrame=0;
scr=1;
if( Show==0&&Fun.Art==0&&Fun.Crosshair==0&&Fun.Drop==0&&Fun.Grib==0&&Fun.Listva==0&&Fun.Mob==0&&Fun.Nichki==0&&Fun.pvp==0&&Fun.Svet==0&&Fun.Travi==0&&Fun.WireFrame==0&&scr==1)
{
sprintf(FileName, "SZOHack Screen %d.jpg", I);
add_log("%d %d %d %d %d",Show,Fun.Art,Fun.Mob,Fun.pvp,scr);
pDevice->GetBackBuffer(0, 0, D3DBACKBUFFER_TYPE_MONO, &surf);
D3DXSaveSurfaceToFile(FileName, D3DXIFF_JPG, surf, NULL, NULL);
I++;
Beep(1000, 100);
//off=0;
}
Fun.Art=i1;
Fun.Crosshair=i2;
Fun.Drop=i3;
Fun.Grib=i4;
Fun.Listva=i5;
Fun.Mob=i6;
Fun.Nichki=i7;
Fun.pvp=i8;
Fun.Svet=i9;
Fun.Travi=i10;
Fun.WireFrame=i11;
Show=i;
scr=0;
//on=0;
*/
scr=1;
//for(int b;b<5;b++){nope=nope;}
if(scr==1)
{
sprintf(FileName, "SZOHack Screen %d.jpg", I);
pDevice->GetBackBuffer(0, 0, D3DBACKBUFFER_TYPE_MONO, &surf);
D3DXSaveSurfaceToFile(FileName, D3DXIFF_JPG, surf, NULL, NULL);
I++;
Beep(1000, 100);
scr=0;
}
}
//-----------------------------------------------------------------------------
// Exam: Circle(X,Y,10,10,Color);
// Desc: Êðóã
// Ñonc: Menu
//-----------------------------------------------------------------------------
void Circle(int X, int Y, int radius, int numSides, DWORD Color)
{
D3DXVECTOR2 Line[128];
float Step = PI * 2.0 / numSides;
int Count = 0;
for (float a=0; a < PI*2.0; a += Step)
{
float X1 = radius * cos(a) + X;
float Y1 = radius * sin(a) + Y;
float X2 = radius * cos(a+Step) + X;
float Y2 = radius * sin(a+Step) + Y;
Line[Count].x = X1;
Line[Count].y = Y1;
Line[Count+1].x = X2;
Line[Count+1].y = Y2;
Count += 2;
}
pLine->Begin();
pLine->Draw(Line,Count,Color);
pLine->End();
}
//-----------------------------------------------------------------------------
// Êîìïîíåíòû ColorCircle
//-----------------------------------------------------------------------------
struct D3DTLVERTEX{float fX;float fY;float fZ;float fRHW; D3DCOLOR Color; float fU; float fV;};
D3DTLVERTEX Vtex[400];
D3DTLVERTEX CreateD3DTLVERTEX (float X, float Y, float Z, float RHW, D3DCOLOR color, float U, float V)
{
D3DTLVERTEX v;
v.fX = X;v.fY = Y;v.fZ = Z;
v.fRHW = RHW;v.Color = color;
v.fU = U;v.fV = V;
return v;
}
//-----------------------------------------------------------------------------
// Exam: ColorCircle(x,y,10,10,Colorit,pDevice);
// Desc: ÖâåòíîéÊðóã
// Ñonc: Menu
//-----------------------------------------------------------------------------
void ColorCircle(int x,int y,int radius,DWORD Colorit,IDirect3DDevice9* pDevice)
{
float xPos = (float)x;
float yPos = (float)y;
//LPDIRECT3DTEXTURE9 Col_ = NULL;
//GenerateTextureCircle(pDevice, &Col_, Colorit);
D3DCOLOR Color = D3DCOLOR_ARGB( 255, 255, 255, 255 );
pDevice->SetTexture( 0, Green );
float x1 = xPos;
float y1 = yPos;
for( int i=0;i<=363;i+=3 )
{
float angle = ( i / 57.3f );
float x2 = xPos + ( radius * sin( angle ) );
float y2 = yPos + ( radius * cos( angle ) );
Vtex[i] = CreateD3DTLVERTEX( xPos, yPos, 0, 1, Color, 0, 0 );
Vtex[i+1] = CreateD3DTLVERTEX( x1, y1, 0, 1, Color, 0, 0 );
Vtex[i+2] = CreateD3DTLVERTEX( x2, y2, 0, 1, Color, 0, 0 );
y1 = y2;
x1 = x2;
}
pDevice->DrawPrimitiveUP( D3DPT_TRIANGLESTRIP, 363, Vtex, sizeof( D3DTLVERTEX ) );
}
//-----------------------------------------------------------------------------
// Exam: IsInBox(x,y,w,h);
// Desc: Íàâåäåíèå
// Ñonc: Components
//-----------------------------------------------------------------------------
BOOL IsInBox(int x, int y, int w, int h)
{
POINT MousePosition;
GetCursorPos(&MousePosition);
ScreenToClient(GetForegroundWindow(), &MousePosition);
return(MousePosition.x >= x && MousePosition.x <= x + w && MousePosition.y >= y && MousePosition.y <= y + h);
}
/*
//Class ñîçäàíèÿ øðèôòà
class cInstalling
{
public:
void __fastcall InstallLine(LPDIRECT3DDEVICE9 pDevice)
{
D3DXCreateLine(pDevice, &pLine);
}
void __fastcall ResetLine()
{
pLine->OnLostDevice();
pLine->OnResetDevice();
}
void __fastcall OnLostLine()
{
pLine->OnLostDevice();
}
void __fastcall InstallFont(LPDIRECT3DDEVICE9 pDevice)
{
D3DXCreateFontA(pDevice, 13, 0, FW_BOLD, 1, 0, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, DEFAULT_QUALITY, FF_MODERN, "Tahoma", &pFont);
D3DXCreateFontA(pDevice, 18, 0, FW_REGULAR, 1, 0, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, DEFAULT_QUALITY, FF_MODERN, "Fixedsys", &pFonts);
}
void __fastcall ResetFont()
{
pFont->OnLostDevice();
pFont->OnResetDevice();
pFonts->OnLostDevice();
pFonts->OnResetDevice();
}
void __fastcall OnLostFont()
{
pFont->OnLostDevice();
pFonts->OnLostDevice();
}
BOOL __fastcall CheckFont()
{
if (pFont && pFonts)
return FALSE;
else
return TRUE;
}
}*cInstall;
*/