mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
Replace MyEventReceiver KeyList with std::unordered_set (#10419)
This commit is contained in:
parent
34e3ede8ee
commit
787561b29a
3 changed files with 64 additions and 111 deletions
|
@ -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;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue