aboutsummaryrefslogtreecommitdiff
path: root/src/ui/ui_base.cpp
blob: 3bee2269596a06f0675befd59b40260b8c0b9b4e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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;
        }
    }
}