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