From 15740faf9fe9fe4be08965098bbf2947e096aeeb Mon Sep 17 00:00:00 2001 From: chai Date: Wed, 14 Aug 2019 22:50:43 +0800 Subject: +Unity Runtime code --- Runtime/IMGUI/NamedKeyControlList.cpp | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 Runtime/IMGUI/NamedKeyControlList.cpp (limited to 'Runtime/IMGUI/NamedKeyControlList.cpp') diff --git a/Runtime/IMGUI/NamedKeyControlList.cpp b/Runtime/IMGUI/NamedKeyControlList.cpp new file mode 100644 index 0000000..6574a13 --- /dev/null +++ b/Runtime/IMGUI/NamedKeyControlList.cpp @@ -0,0 +1,27 @@ +#include "UnityPrefix.h" +#include "Runtime/IMGUI/NamedKeyControlList.h" +namespace IMGUI +{ + +void NamedKeyControlList::AddNamedControl (const std::string &name, int id, int windowID) +{ + m_NamedControls[name] = NamedControl (id, windowID); +} + +std::string NamedKeyControlList::GetNameOfControl (int id) +{ + for (std::map::const_iterator i = m_NamedControls.begin(); i != m_NamedControls.end(); i++) + if (i->second.ID == id) + return i->first; + return std::string (""); +} + +NamedControl* NamedKeyControlList::GetControlNamed (const std::string &name) +{ + std::map::iterator i = m_NamedControls.find (name); + if (i != m_NamedControls.end ()) + return &i->second; + return NULL; +} + +} // namespace \ No newline at end of file -- cgit v1.1-26-g67d0