Created
July 3, 2023 22:37
-
-
Save kauefraga/bf91c75c498fec9274ca795d5ec10362 to your computer and use it in GitHub Desktop.
🖱 A code that move the cursor randomly in the screen (1280x720).
This file contains 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 <thread> | |
namespace screen { | |
const int WIDTH = 1280; | |
const int HEIGHT = 720; | |
} | |
int main() { | |
// Seeding with current time | |
srand(time(NULL)); | |
while (!GetAsyncKeyState(VK_SPACE)) { | |
std::this_thread::sleep_for(std::chrono::milliseconds(200)); | |
// Setting the positions relative to the screen size | |
int position[2] = { rand() % screen::WIDTH, rand() % screen::HEIGHT }; | |
// Move the mouse cursor to | |
SetCursorPos(position[0], position[1]); | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment