Clicker Heroes 自动快速点击程序
本来不是很想写,但是为了广大玩家,我就写了一个。
(使用说明在代码下面,还有资源链接)
用C++写的,代码如下:
#include "all.h"
using namespace std;
int main(){
while(1){
while(1){
if(GetAsyncKeyState('S')&&GetAsyncKeyState(18))break;
}
while(1){
click_left();
if(GetAsyncKeyState('P'))break;
}
}
return 0;
}
其实很简单,我都写在了all.h这个库里
all.h
#include <cstdio>
#include <conio.h>
#include <cstdlib>
#include <cstring>
#include <fstream>
#include <iostream>
#include <windows.h>
#include <algorithm>
#define REP(i,a,b) for (int i=(a);i<=(b);i++)
#define PER(i,a,b) for (int i=(a);i>=(b);i--)
#define max(x,y) ((x)<(y)?(y):(x))
#define min(y,x) ((x)<(y)?(x):(y))
#define MEM(a,b) memset(a,(b),sizeof(a))
#define KEY_DOWN(VK_NONAME) ((GetAsyncKeyState(VK_NONAME) & 0x8000) ? 1:0)
#define setcolor(x) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),x)
#define getkey(x) GetAsyncKeyState(x)
/*
鼠标左键 : MOUSE_MOVED
鼠标右键 :MOUSE_EVENT
鼠标滚轮 : MOUSE_WHEELED
MK_CONTROL当CTRL键按下时。
MK_LBUTTON当鼠标左键按下时。
MK_MBUTTON当鼠标中键按下时。
MK_RBUTTON当鼠标右键按下时.
MK_SHIFT当SHIFT按下时。
*/
using std::cin;
using std::cout;
using std::endl;
int brand();
void GOTO(int x,int y);
int brand(){return (rand()<<16)|(rand()<<1)|(rand()&1);}
void bsrand(){srand(GetTickCount());}
void cls(){system("cls");}
int getmouse_y(){//获取鼠标在屏幕中x的位置
POINT pt;
GetCursorPos(&pt);
return pt.x;
}
int getmouse_x(){//获取鼠标在屏幕中y的位置
POINT pt;
GetCursorPos(&pt);
return pt.y;
}
void setmouse(int y,int x){SetCursorPos(x,y);}//设置鼠标在屏幕中的位置
void click_left(){
mouse_event(MOUSEEVENTF_LEFTDOWN,0,0,0,0);
Sleep(10);//要留给某些应用的反应时间
mouse_event(MOUSEEVENTF_LEFTUP,0,0,0,0);
}
void click_right(){
mouse_event(MOUSEEVENTF_RIGHTDOWN,0,0,0,0);
Sleep(10);
mouse_event(MOUSEEVENTF_RIGHTUP,0,0,0,0);
}
void GOTO(int x,int y){
CONSOLE_SCREEN_BUFFER_INFO csbiInfo;
HANDLE hConsoleOut;
hConsoleOut = GetStdHandle(STD_OUTPUT_HANDLE);
GetConsoleScreenBufferInfo(hConsoleOut,&csbiInfo);
csbiInfo.dwCursorPosition.Y = x;
csbiInfo.dwCursorPosition.X = y;
SetConsoleCursorPosition(hConsoleOut,csbiInfo.dwCursorPosition);
}
/*
<span style="white-space:pre"> </span>字
1 深蓝色
2 深绿色
3 深青色
4 深红色
5 深粉色
6 黄色
7 深白色
8 灰色
9 浅蓝色
10 浅绿色
11 浅青色
12 浅红色
13 浅粉色
14 浅黄色
15 浅白色
背景
1~15 黑色
16~31 深蓝色
32~47 深绿色
48~63 深青色
64~79 深红色
80~95 深粉色
96~111 深黄色
112~127 深白色
128~143 灰色
144~159 浅蓝色
160~175 浅绿色
176~191 浅青色
192~207 浅红色
208~223 浅粉色
224~239 浅黄色
240~255 浅白色
*/
说明:
将鼠标移到游戏窗口点击的位置,然后按下Alt+S开始,按P键暂停。
记住用完要叉掉,暂时没设关闭键,我会更新的。
链接
谢谢大家,如有问题,可以在下方留言。