Last active
August 29, 2015 14:23
-
-
Save jgc128/228f203628bf9518c30e to your computer and use it in GitHub Desktop.
Clicker for the Steam's Monster Summer Game
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "windows.h" | |
#include "iostream" | |
#define INTERVAL_BETWEEN_CLICKS 125 | |
#define CLICK_INTERVAL 50 | |
using namespace std; | |
inline void mouse_move(LONG x, LONG y) | |
{ | |
SetCursorPos(x, y); | |
} | |
inline void mouse_click(LONG x, LONG y) | |
{ | |
mouse_move(x, y); | |
mouse_event(MOUSEEVENTF_LEFTDOWN, NULL, NULL, NULL, NULL); | |
Sleep(CLICK_INTERVAL); | |
mouse_event(MOUSEEVENTF_LEFTUP, NULL, NULL, NULL, NULL); | |
} | |
bool work_cycle() | |
{ | |
POINT pOriginalPoint; | |
POINT pCurrentPoint; | |
int num_clicks; | |
cout << "Place the cursor to the position, enter number of clicks (0 to exit): "; | |
cin >> num_clicks; | |
if (num_clicks == 0) | |
return false; | |
GetCursorPos(&pOriginalPoint); | |
for (int i = 0; i < num_clicks; i++) | |
{ | |
GetCursorPos(&pCurrentPoint); | |
if (pCurrentPoint.x != pOriginalPoint.x || pCurrentPoint.y != pOriginalPoint.y) | |
break; | |
mouse_click(pOriginalPoint.x, pOriginalPoint.y); | |
Sleep(INTERVAL_BETWEEN_CLICKS); | |
} | |
return true; | |
} | |
void main() | |
{ | |
while (work_cycle()) { | |
SetForegroundWindow(GetConsoleWindow()); | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment