Line data Source code
1 : #pragma once
2 :
3 : #include <cstdint>
4 : #include <string_view>
5 :
6 : namespace jage::engine::input::keyboard {
7 : enum class action : std::uint8_t {
8 : release,
9 : press,
10 : repeat,
11 : };
12 :
13 : [[nodiscard]] constexpr auto
14 11 : serialize(const action input_action) -> std::string_view {
15 11 : switch (input_action) {
16 4 : case action::release:
17 4 : return "release";
18 3 : case action::press:
19 3 : return "press";
20 2 : case action::repeat:
21 2 : return "repeat";
22 2 : default:
23 2 : return "unknown enumerator";
24 : }
25 : }
26 :
27 : } // namespace jage::engine::input::keyboard
|