- C20240181's blog
极速键鼠检测
- 2024-10-28 11:22:18 @
#include<stdio.h>
#include<windows.h>
#include<time.h>
using namespace std;
#define keydown(vk) ((GetAsyncKeyState(vk) & 0x8000)?1:0)
#define LMB MOUSE_MOVED
#define MMB MOUSE_WHEELED
#define RMB MOUSE_EVENT
bool kb[128],ms[4];
void ckb() {
for (int i = 0; i < 128; ++i) {
if (keydown(i))kb[i]=1;
else kb[i]=0;
}
if (keydown(LMB)) ms[1]=1;
else ms[1]=0;
if (keydown(MMB)) ms[2]=1;
else ms[2]=0;
if (keydown(RMB)) ms[3]=1;
else ms[3]=0;
return;
}