aboutsummaryrefslogtreecommitdiff
path: root/src/ui/ui_base.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/ui/ui_base.cpp')
-rw-r--r--src/ui/ui_base.cpp15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/ui/ui_base.cpp b/src/ui/ui_base.cpp
index 550432e4..3bee2269 100644
--- a/src/ui/ui_base.cpp
+++ b/src/ui/ui_base.cpp
@@ -1,6 +1,19 @@
#include "ui_base.h"
+#include "system_headers.h"
+
namespace cru {
namespace 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;
+ }
+ }
}