-
Notifications
You must be signed in to change notification settings - Fork 2
/
Visual.cpp
72 lines (58 loc) · 2.09 KB
/
Visual.cpp
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
// Don't take credits for this ;) Joplin / Manhhao are the first uploaders ;)
#include "Visuals.h"
#include "Interfaces.h"
#include "RenderManager.h"
// Any init here
void CVisuals::Init()
{
// Idk
}
// Don't really need to do anything in here
void CVisuals::Move(CUserCmd *pCmd, bool &bSendPacket) {}
// Main ESP Drawing loop
void CVisuals::Draw()
{
// Crosshair
if (Menu::Window.VisualsTab.OtherCrosshair.GetState())
DrawCrosshair();
// Recoil Crosshair
if (Menu::Window.VisualsTab.OtherRecoilCrosshair.GetIndex())
DrawRecoilCrosshair();
}
// Draw a basic crosshair
void CVisuals::DrawCrosshair()
{
// Crosshair
RECT View = Render::GetViewport();
int MidX = View.right / 2;
int MidY = View.bottom / 2;
Render::Line(MidX - 8, MidY - 8, MidX + 8, MidY + 8, Color(0, 0, 0, 200));
Render::Line(MidX + 8, MidY - 8, MidX - 8, MidY + 8, Color(0, 0, 0, 200));
Render::Line(MidX - 4, MidY - 4, MidX + 4, MidY + 4, Color(0, 255, 0, 255));
Render::Line(MidX + 4, MidY - 4, MidX - 4, MidY + 4, Color(0, 255, 0, 255));
}
// Recoil crosshair
void CVisuals::DrawRecoilCrosshair()
{
if (Menu::Window.RageBotTab.AccuracyRecoil.GetState())
return;
IClientEntity *pLocal = hackManager.pLocal();
// Get the view with the recoil
Vector ViewAngles;
Interfaces::Engine->GetViewAngles(ViewAngles);
ViewAngles += pLocal->localPlayerExclusive()->GetAimPunchAngle() * 2.f;
// Build a ray going fowards at that angle
Vector fowardVec;
AngleVectors(ViewAngles, &fowardVec);
fowardVec *= 10000;
// Get ray start / end
Vector start = pLocal->GetOrigin() + pLocal->GetViewOffset();
Vector end = start + fowardVec, endScreen;
if (Render::WorldToScreen(end, endScreen) && pLocal->IsAlive())
{
Render::Line(endScreen.x - 4, endScreen.y - 4, endScreen.x + 4, endScreen.y + 4, Color(0, 255, 0, 255));
Render::Line(endScreen.x + 4, endScreen.y - 4, endScreen.x - 4, endScreen.y + 4, Color(0, 255, 0, 255));
Render::Line(endScreen.x - 2, endScreen.y - 2, endScreen.x + 2, endScreen.y + 2, Color(0, 0, 0, 200));
Render::Line(endScreen.x + 2, endScreen.y - 2, endScreen.x - 2, endScreen.y + 2, Color(0, 0, 0, 200));
}
}