Unravel Engine C++ Reference
Loading...
Searching...
No Matches
os_keyboard.cpp
Go to the documentation of this file.
1#include "os_keyboard.hpp"
2
3namespace input
4{
5// ----------------------------------------------------------------------------
7{
8 return key_state_map_.get_state(key, key_state::up);
9}
10
11// ----------------------------------------------------------------------------
12auto os_keyboard::get_name() const -> const std::string&
13{
14 static const std::string name = "Keyboard";
15 return name;
16}
17
18// ----------------------------------------------------------------------------
20{
21 if(!is_input_allowed())
22 {
23 return false;
24 }
25 const key_state state = key_state_map_.get_state(key, key_state::up);
26 return (state == key_state::down || state == key_state::pressed);
27}
28
29// ----------------------------------------------------------------------------
31{
32 if(!is_input_allowed())
33 {
34 return false;
35 }
36 return key_state_map_.get_state(key, key_state::up) == key_state::pressed;
37}
38
39// ----------------------------------------------------------------------------
41{
42 if(!is_input_allowed())
43 {
44 return false;
45 }
46 return key_state_map_.get_state(key, key_state::up) == key_state::released;
47}
48
50{
51 key_state_map_.update();
52}
53
54// ----------------------------------------------------------------------------
56{
57 return key_state_map_;
58}
59} // namespace input
auto get_key_state(key_code key) const -> key_state override
auto is_released(key_code key) const -> bool override
auto get_key_state_map() -> key_state_map &
auto is_pressed(key_code key) const -> bool override
auto get_name() const -> const std::string &override
auto is_down(key_code key) const -> bool override
std::string name
Definition hub.cpp:27
key_code
Definition key.hpp:6