Add cursor condition to check if mouse button is held down

This commit is contained in:
WarmUpTill
2026-11-06 20:46:32 +01:00
parent b7bf68615d
commit b3f47cdb68
6 changed files with 54 additions and 1 deletions

View File

@@ -17,6 +17,18 @@ std::chrono::high_resolution_clock::time_point GetLastMouseRightClickTime()
{
return {};
}
bool IsMouseLeftButtonDown()
{
return false;
}
bool IsMouseMiddleButtonDown()
{
return false;
}
bool IsMouseRightButtonDown()
{
return false;
}
#endif
} // namespace advss

View File

@@ -6,5 +6,8 @@ namespace advss {
std::chrono::high_resolution_clock::time_point GetLastMouseLeftClickTime();
std::chrono::high_resolution_clock::time_point GetLastMouseMiddleClickTime();
std::chrono::high_resolution_clock::time_point GetLastMouseRightClickTime();
bool IsMouseLeftButtonDown();
bool IsMouseMiddleButtonDown();
bool IsMouseRightButtonDown();
} // namespace advss

View File

@@ -278,6 +278,21 @@ std::chrono::high_resolution_clock::time_point GetLastMouseRightClickTime()
return lastMouseRightClickTime;
}
bool IsMouseLeftButtonDown()
{
return GetAsyncKeyState(VK_LBUTTON) & 0x8000;
}
bool IsMouseMiddleButtonDown()
{
return GetAsyncKeyState(VK_MBUTTON) & 0x8000;
}
bool IsMouseRightButtonDown()
{
return GetAsyncKeyState(VK_RBUTTON) & 0x8000;
}
static void handleRawMouseInput(LPARAM lParam)
{
UINT dwSize;