好耶是新系列
cpp
#include<windows.h>
#include<bits/stdc++.h>
using namespace std;
POINT p;
HANDLE hOutput = GetStdHandle(STD_OUTPUT_HANDLE);
HWND h=GetForegroundWindow();
CONSOLE_FONT_INFO consoleCurrentFont;
int X,Y,jg;
bool f;
void G(int x,int y){
COORD pos={x,y};
HANDLE hOut=GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleCursorPosition(hOut,pos);
return;
}
void S(int ForgC, int BackC) {
WORD wColor = ((BackC & 0x0F) << 4) + (ForgC & 0x0F);
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), wColor);
}
void HC(){
CONSOLE_CURSOR_INFO cur={1,0};
SetConsoleCursorInfo(GetStdHandle(STD_OUTPUT_HANDLE),&cur);
}
void SC(){
CONSOLE_CURSOR_INFO cur={1,1};
SetConsoleCursorInfo(GetStdHandle(STD_OUTPUT_HANDLE),&cur);
}
int main(){
system("mode con cols=50 lines=20");
HC();
srand(time(0));
HANDLE hStdin = GetStdHandle(STD_INPUT_HANDLE);
DWORD mode;
GetConsoleMode(hStdin, &mode);
mode &= ~ENABLE_QUICK_EDIT_MODE;
SetConsoleMode(hStdin, mode);
X=rand()%47+2;Y=rand()%17+2;
while(1){
POINT p;
GetCursorPos(&p);
ScreenToClient(h,&p);
GetCurrentConsoleFont(hOutput, FALSE, &consoleCurrentFont);
int x=p.x/=consoleCurrentFont.dwFontSize.X;
int y=p.y/=consoleCurrentFont.dwFontSize.Y;
if(x>1&&x<50&&y>1&&y<20&&x!=X&&y!=Y) {
G(x,y);
cout<<".";
}
if((x==X||x==X+1)&&y==Y){
f=true;
}else f=false;
if(GetAsyncKeyState(VK_LBUTTON)){
if((x==X||x==X+1)&&y==Y){
G(X,Y);
cout<<" ";
X=rand()%47+2;Y=rand()%17+2;
}
}
Sleep(10);
G(x,y);
cout<<" ";
G(X,Y);
if(f)S(9,0);
else S(14,0);
cout<<"按";
S(15,0);
if(jg!=0)jg--;
}
return 0;
}
你管他是啥,"好用就行"