Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <Windows.h>
- #include <iostream>
- #include <thread>
- #include <stdlib.h>
- using namespace std;
- int input;
- int sharpness;
- int key;
- int mode;
- void InGame() {
- while (true) {
- Sleep(300);
- if (GetAsyncKeyState(38)) {
- input++;
- Sleep(300);
- }
- Sleep(300);
- if (GetAsyncKeyState(40)) {
- input--;
- Sleep(300);
- }
- if (GetAsyncKeyState(37)) {
- sharpness--;
- Sleep(300);
- }
- if (GetAsyncKeyState(39)) {
- sharpness++;
- Sleep(300);
- }
- std::this_thread::sleep_for(std::chrono::milliseconds(1));
- }
- }
- void Emergency() {
- while (true) {
- if (GetAsyncKeyState(98)) {
- Beep(523, 300);
- Beep(523, 300);
- Beep(523, 300);
- exit(EXIT_FAILURE);
- }
- std::this_thread::sleep_for(std::chrono::milliseconds(1));
- }
- }
- void Function() {
- while (true) {
- if (GetAsyncKeyState(key)) {
- if (GetAsyncKeyState(1)) {
- POINT cursorpos;
- GetCursorPos(&cursorpos);
- SetCursorPos(cursorpos.x, cursorpos.y + input);
- Sleep(sharpness);
- }
- else {
- POINT cursorpos;
- GetCursorPos(&cursorpos);
- SetCursorPos(cursorpos.x, cursorpos.y);
- }
- }
- std::this_thread::sleep_for(std::chrono::milliseconds(1));
- }
- }
- int main() {
- SetConsoleTitle("Mazhu");
- cout << "Mazhu - Small Project" << endl << endl;
- cout << "Hold Key: ";
- cin >> key;
- cout << endl;
- cout << "Power: ";
- cin >> input;
- cout << endl << "Sharpness Delay: ";
- cin >> sharpness;
- cout << endl << "LAN/Stream Mode: ";
- cin >> mode;
- if (mode >= 1) {
- FreeConsole();
- }
- else {
- getchar();
- }
- std::thread EmergencyThread(Emergency);
- std::thread FunctionThread(Function);
- std::thread IngameThread(InGame);
- EmergencyThread.join();
- FunctionThread.join();
- IngameThread.join();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement