diff options
author | Vincent Robinson <robinsonvincent89@gmail.com> | 2020-09-23 10:12:20 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-23 19:12:20 +0200 |
commit | 787561b29afdbc78769f68c2f5c4f2cff1b32340 (patch) | |
tree | dc97c2b4be4cf6f9291de43aefe2b940728dfff9 /src/client/keycode.h | |
parent | 34e3ede8eeb05e193e64ba3d055fc67959d87d86 (diff) | |
download | minetest-787561b29afdbc78769f68c2f5c4f2cff1b32340.tar.gz minetest-787561b29afdbc78769f68c2f5c4f2cff1b32340.tar.bz2 minetest-787561b29afdbc78769f68c2f5c4f2cff1b32340.zip |
Replace MyEventReceiver KeyList with std::unordered_set (#10419)
Diffstat (limited to 'src/client/keycode.h')
-rw-r--r-- | src/client/keycode.h | 19 |
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; |