nsnake
Classic snake game for the terminal
InputManager.hpp
1 #ifndef INPUTMANAGER_H_DEFINED
2 #define INPUTMANAGER_H_DEFINED
3 
4 #include <string>
5 #include <map>
6 
8 namespace InputManager
9 {
11  void bind(std::string name, int key);
12 
14  void unbind(std::string name);
15 
17  int getBind(std::string name);
18 
20  bool noKeyPressed();
21 
24  bool isPressed(int key);
25 
28  bool isPressed(std::string key);
29 
36  void update(int delay_ms=0);
37 
39  std::string keyToString(int key);
40 
42  int stringToKey(std::string string);
43 
51  extern int pressedKey;
52 
54  extern std::map<std::string, int> binds;
55 };
56 
57 #endif //INPUTMANAGER_H_DEFINED
58