blob: 193cba4ab67d74d73d42c49f30029e2c3fc0f05c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
#include "input_util.hpp"
#include <Windows.h>
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);
}
} // namespace cru::ui
|