MCPcopy Create free account
hub / github.com/KebsCS/KBotExt / GetKeyName

Method GetKeyName

KBotExt/imgui/imgui.cpp:7942–7964  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7940IM_STATIC_ASSERT(ImGuiKey_NamedKey_COUNT == IM_ARRAYSIZE(GKeyNames));
7941
7942const char* ImGui::GetKeyName(ImGuiKey key)
7943{
7944 ImGuiContext& g = *GImGui;
7945#ifdef IMGUI_DISABLE_OBSOLETE_KEYIO
7946 IM_ASSERT((IsNamedKeyOrModKey(key) || key == ImGuiKey_None) && "Support for user key indices was dropped in favor of ImGuiKey. Please update backend and user code.");
7947#else
7948 if (IsLegacyKey(key))
7949 {
7950 if (g.IO.KeyMap[key] == -1)
7951 return "N/A";
7952 IM_ASSERT(IsNamedKey((ImGuiKey)g.IO.KeyMap[key]));
7953 key = (ImGuiKey)g.IO.KeyMap[key];
7954 }
7955#endif
7956 if (key == ImGuiKey_None)
7957 return "None";
7958 if (key & ImGuiMod_Mask_)
7959 key = ConvertSingleModFlagToKey(&g, key);
7960 if (!IsNamedKey(key))
7961 return "Unknown";
7962
7963 return GKeyNames[key - ImGuiKey_NamedKey_BEGIN];
7964}
7965
7966// ImGuiMod_Shortcut is translated to either Ctrl or Super.
7967void ImGui::GetKeyChordName(ImGuiKeyChord key_chord, char* out_buf, int out_buf_size)

Callers

nothing calls this directly

Calls 4

IsNamedKeyOrModKeyFunction · 0.85
IsLegacyKeyFunction · 0.85
IsNamedKeyFunction · 0.85

Tested by

no test coverage detected