diff --git a/icon.ico b/icon.ico new file mode 100644 index 0000000..ebbfcd7 Binary files /dev/null and b/icon.ico differ diff --git a/main.c b/main.c new file mode 100644 index 0000000..4385246 --- /dev/null +++ b/main.c @@ -0,0 +1,91 @@ +#include +#include +#include +#include +#include "resource.h" + +#define PI 3.14159265 +#define RADIUS_X 40 +#define RADIUS_Y 20 + +bool killing = false; +bool clicking = false; + +void left_click() { + mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0); + mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0); +} + +void move_mouse_circle() { + POINT cursorPos; + GetCursorPos(&cursorPos); + + double angle = 0.0; + while (killing) { + int newX = cursorPos.x + (int)(RADIUS_X * cos(angle * PI / 180)); + int newY = cursorPos.y + (int)(RADIUS_Y * sin(angle * PI / 180)); + + SetCursorPos(newX, newY); + left_click(); + + angle += 10.0; + if (angle >= 360.0) { + angle = 0.0; + } + + Sleep(50); + } +} + +DWORD WINAPI kill_enemy(LPVOID lpParam) { + move_mouse_circle(); + return 0; +} + +void toggle_killing() { + if (!killing) { + killing = true; + CreateThread(NULL, 0, kill_enemy, NULL, 0, NULL); + } else { + killing = false; + } +} + +void toggle_clicking() { + clicking = !clicking; +} + +DWORD WINAPI click_continuously(LPVOID lpParam) { + while (clicking) { + left_click(); + } + return 0; +} + +int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd) { + HICON hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_MYICON)); + HWND hwnd = GetConsoleWindow(); + SendMessage(hwnd, WM_SETICON, ICON_BIG, (LPARAM)hIcon); + + printf("Press Shift + Alt + 1 to start/stop mouse circle movement.\n"); + printf("Press Shift + Alt + 2 to start/stop clicking without spinning.\n"); + printf("Press ESC to exit.\n"); + + while (true) { + if (GetAsyncKeyState(VK_SHIFT) & 0x8000 && GetAsyncKeyState(VK_MENU) & 0x8000 && GetAsyncKeyState('1') & 0x8000) { + toggle_killing(); + Sleep(300); + } + if (GetAsyncKeyState(VK_SHIFT) & 0x8000 && GetAsyncKeyState(VK_MENU) & 0x8000 && GetAsyncKeyState('2') & 0x8000) { + if (!clicking) { + clicking = true; + CreateThread(NULL, 0, click_continuously, NULL, 0, NULL); + } else { + clicking = false; + } + Sleep(300); + } + } + + return 0; +} \ No newline at end of file diff --git a/make.bat b/make.bat new file mode 100644 index 0000000..3afa209 --- /dev/null +++ b/make.bat @@ -0,0 +1,2 @@ +windres resources.rc -o resources.o +gcc -o click.exe main.c resources.o \ No newline at end of file diff --git a/resource.h b/resource.h new file mode 100644 index 0000000..8015ac7 --- /dev/null +++ b/resource.h @@ -0,0 +1 @@ +#define IDI_MYICON 101 \ No newline at end of file diff --git a/resources.rc b/resources.rc new file mode 100644 index 0000000..8b6c1f9 --- /dev/null +++ b/resources.rc @@ -0,0 +1,3 @@ +#include "resource.h" + +IDI_MYICON ICON "icon.ico"