HikoGUI
A low latency retained GUI
Loading...
Searching...
No Matches
keyboard_state.hpp
1// Copyright Take Vos 2022.
2// Distributed under the Boost Software License, Version 1.0.
3// (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt)
4
5#pragma once
6
7#include "../macros.hpp"
8namespace hi::inline v1 {
9
10enum class keyboard_state : uint8_t {
11 idle = 0x00,
12 caps_lock = 0x01,
13 scroll_lock = 0x02,
14 num_lock = 0x04,
15};
16
17[[nodiscard]] constexpr keyboard_state operator|(keyboard_state const& lhs, keyboard_state const& rhs) noexcept
18{
19 return static_cast<keyboard_state>(std::to_underlying(lhs) | std::to_underlying(rhs));
20}
21
22[[nodiscard]] constexpr keyboard_state operator&(keyboard_state const& lhs, keyboard_state const& rhs) noexcept
23{
24 return static_cast<keyboard_state>(std::to_underlying(lhs) & std::to_underlying(rhs));
25}
26
27constexpr keyboard_state& operator|=(keyboard_state& lhs, keyboard_state const& rhs) noexcept
28{
29 return lhs = lhs | rhs;
30}
31
32bool operator>=(keyboard_state const& lhs, keyboard_state const& rhs) = delete;
33
34[[nodiscard]] constexpr bool to_bool(keyboard_state const& rhs) noexcept
35{
36 return to_bool(std::to_underlying(rhs));
37}
38
39}
DOXYGEN BUG.
Definition algorithm.hpp:16
constexpr Out narrow_cast(In const &rhs) noexcept
Cast numeric values without loss of precision.
Definition cast.hpp:377
T operator>=(T... args)