aboutsummaryrefslogtreecommitdiff
path: root/src/client/keycode.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/keycode.h')
-rw-r--r--src/client/keycode.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/client/keycode.h b/src/client/keycode.h
index 7036705d1..263b722c7 100644
--- a/src/client/keycode.h
+++ b/src/client/keycode.h
@@ -24,12 +24,20 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include <IEventReceiver.h>
#include <string>
+class KeyPress;
+namespace std
+{
+ template <> struct hash<KeyPress>;
+}
+
/* A key press, consisting of either an Irrlicht keycode
or an actual char */
class KeyPress
{
public:
+ friend struct std::hash<KeyPress>;
+
KeyPress() = default;
KeyPress(const char *name);
@@ -55,6 +63,17 @@ protected:
std::string m_name = "";
};
+namespace std
+{
+ template <> struct hash<KeyPress>
+ {
+ size_t operator()(const KeyPress &key) const
+ {
+ return key.Key;
+ }
+ };
+}
+
extern const KeyPress EscapeKey;
extern const KeyPress CancelKey;