CPS Tester

 将测出10s的平均cps值

在窗内点击即可

github已编译程序:https://github.com/Ice-watermelon233/cps-tester

#include <bits/stdc++.h>
#include <windows.h>

#define KEY_DOWN(VK_NONAME) ((GetAsyncKeyState(VK_NONAME) & 0x8000) ? 1:0)

using namespace std;

int main() {

    int sc;
    int cps = 1;

    while (1) {

        if(KEY_DOWN(VK_LBUTTON)) {

            sc = clock();
            break;

        }

    }

    while (clock() - sc <= 10000) {
        
        HANDLE hout;
        COORD coord;
        coord.X=0;
        coord.Y=0;
        hout=GetStdHandle(STD_OUTPUT_HANDLE);
        SetConsoleCursorPosition(hout,coord);
        printf("%.1f", cps / ((clock() - sc) / 1000.0));
        
        if(KEY_DOWN(VK_LBUTTON)) {

            while (KEY_DOWN(VK_LBUTTON));
            cps++;


        }

    }

    HANDLE hout;
    COORD coord;
    coord.X=0;
    coord.Y=0;
    hout=GetStdHandle(STD_OUTPUT_HANDLE);
    SetConsoleCursorPosition(hout,coord);

    printf("%.1f\n", cps / 10.0);

    return 0;

}

猜你喜欢

转载自www.cnblogs.com/Ice-watermelon233/p/CPS_Tester_C_with_Class.html