-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.cpp
More file actions
58 lines (53 loc) · 1.44 KB
/
test.cpp
File metadata and controls
58 lines (53 loc) · 1.44 KB
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
#include <iostream>
#include <math.h>
#include <windows.h>
using namespace std;
bool crosshairon=false;
HDC ragedc = NULL;
int crosshairsize=0;
int cx=0;
int cy=0;
void CrossThread(void)
{
while(1)
{
if(GetAsyncKeyState(VK_NUMPAD0)&1)
{
crosshairon=!crosshairon;
ragedc = GetDC(HWND_DESKTOP);
cx=GetSystemMetrics(SM_CXSCREEN)/2-((crosshairsize-1)/2);
cy=GetSystemMetrics(SM_CYSCREEN)/2-((crosshairsize-1)/2);
}
Sleep(1);
}
}
int main()
{
cout<<"Crosshair size in pixels:\n";
cin>>crosshairsize;
if(crosshairsize%2==0)
{
crosshairsize+=1;
}
system("cls");
cout<<"Press numpad0 to toggle the crosshair on and off\n";
CreateThread(0,0,(LPTHREAD_START_ROUTINE)CrossThread,0,0,0);
while(1)
{
if(crosshairon==true)
{
for(int i=0;i<crosshairsize;i++)
{
SetPixel(ragedc, cx+i, cy+((crosshairsize-1)/2), RGB(255,0,0));
SetPixel(ragedc, cx+((crosshairsize-1)/2), cy+i, RGB(0,0,255));
}
if(crosshairon==false)
for(int i=1;i<crosshairsize;i++)
{
SetPixel(ragedc, cx+i, cy+((crosshairsize-1)/2), RGB(0,0,0));
SetPixel(ragedc, cx+((crosshairsize-1)/2), cy+i, RGB(0,0,0));
}
}
Sleep(33);
}
}