blob: 6cf2d695146079c3d10232f0ad4b28318f20a0b7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
#include "input_util.hpp"
#include "system_headers.hpp"
namespace cru::ui
{
bool IsKeyDown(const int virtual_code)
{
const auto result = ::GetKeyState(virtual_code);
return (static_cast<unsigned short>(result) & 0x8000) != 0;
}
bool IsKeyToggled(const int virtual_code)
{
const auto result = ::GetKeyState(virtual_code);
return (static_cast<unsigned short>(result) & 1) != 0;
}
bool IsAnyMouseButtonDown()
{
return IsKeyDown(VK_LBUTTON) || IsKeyDown(VK_RBUTTON) || IsKeyDown(VK_MBUTTON);
}
}
|