mirror of
https://github.com/DumbDev69420/EscapeTheBackrooms_Internal.git
synced 2024-12-22 14:37:30 +08:00
81 lines
1.3 KiB
C++
81 lines
1.3 KiB
C++
#pragma once
|
|
#include <Windows.h>
|
|
#include "../Cheat.h"
|
|
|
|
namespace ZeroGUI
|
|
{
|
|
bool isGameFocussed = false;
|
|
bool isInputLocked = false;
|
|
HWND CurrentWindow = NULL;
|
|
|
|
namespace Input
|
|
{
|
|
bool mouseDown[5];
|
|
bool mouseDownAlready[256];
|
|
|
|
bool keysDown[256];
|
|
bool keysDownAlready[256];
|
|
|
|
bool IsAnyMouseDown()
|
|
{
|
|
if (mouseDown[0]) return true;
|
|
if (mouseDown[1]) return true;
|
|
if (mouseDown[2]) return true;
|
|
if (mouseDown[3]) return true;
|
|
if (mouseDown[4]) return true;
|
|
|
|
return false;
|
|
}
|
|
|
|
bool IsMouseClicked(int button, int element_id, bool repeat)
|
|
{
|
|
if (mouseDown[button])
|
|
{
|
|
if (!mouseDownAlready[element_id])
|
|
{
|
|
mouseDownAlready[element_id] = true;
|
|
return true;
|
|
}
|
|
if (repeat)
|
|
return true;
|
|
}
|
|
else
|
|
{
|
|
mouseDownAlready[element_id] = false;
|
|
}
|
|
return false;
|
|
}
|
|
bool IsKeyPressed(int key, bool repeat)
|
|
{
|
|
if (keysDown[key])
|
|
{
|
|
if (!keysDownAlready[key])
|
|
{
|
|
keysDownAlready[key] = true;
|
|
return true;
|
|
}
|
|
if (repeat)
|
|
return true;
|
|
}
|
|
else
|
|
{
|
|
keysDownAlready[key] = false;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
void Handle()
|
|
{
|
|
isGameFocussed = GetActiveWindow() == CurrentWindow;
|
|
|
|
|
|
if (GetAsyncKeyState(0x01) && !isInputLocked && isGameFocussed)
|
|
{
|
|
mouseDown[0] = true;
|
|
}
|
|
else
|
|
mouseDown[0] = false;
|
|
}
|
|
}
|
|
}
|