-
Notifications
You must be signed in to change notification settings - Fork 1
/
input_manager.hpp
32 lines (23 loc) · 758 Bytes
/
input_manager.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#ifndef INPUT_MANAGER_HPP_INCLUDED
#define INPUT_MANAGER_HPP_INCLUDED
#include <string_view>
#include <string>
#include <vector>
#include <utility>
#include <map>
#include <optional>
struct render_window;
struct input_manager
{
std::vector<std::pair<std::string, std::vector<int>>> linear_keys;
std::map<std::string, std::vector<int>, std::less<>> glfw_key_map;
input_manager();
void display_key_rebindings(render_window& win);
bool is_key_down(std::string_view view);
bool is_key_pressed(std::string_view view);
void rebind(std::string_view name, const std::vector<int>& glfw_key);
private:
std::vector<int> rebinding_keys;
std::optional<std::string> last_rebind_purpose;
};
#endif // INPUT_MANAGER_HPP_INCLUDED