mirror of
https://github.com/Drezil/imgui.git
synced 2025-07-04 12:08:47 +02:00
Backends: OSX: Build fIx. Made GetKeyName() input tolerant. Internals: added GetNavInputName().
This commit is contained in:
14
imgui.cpp
14
imgui.cpp
@ -7435,6 +7435,8 @@ const char* ImGui::GetKeyName(ImGuiKey key)
|
||||
#endif
|
||||
if (key == ImGuiKey_None)
|
||||
return "None";
|
||||
if (!IsNamedKey(key))
|
||||
return "Unknown";
|
||||
|
||||
return GKeyNames[key - ImGuiKey_NamedKey_BEGIN];
|
||||
}
|
||||
@ -9717,6 +9719,18 @@ static ImVec2 ImGui::NavCalcPreferredRefPos()
|
||||
}
|
||||
}
|
||||
|
||||
const char* ImGui::GetNavInputName(ImGuiNavInput n)
|
||||
{
|
||||
static const char* names[] =
|
||||
{
|
||||
"Activate", "Cancel", "Input", "Menu", "DpadLeft", "DpadRight", "DpadUp", "DpadDown", "LStickLeft", "LStickRight", "LStickUp", "LStickDown",
|
||||
"FocusPrev", "FocusNext", "TweakSlow", "TweakFast", "KeyLeft", "KeyRight", "KeyUp", "KeyDown"
|
||||
};
|
||||
IM_ASSERT(IM_ARRAYSIZE(names) == ImGuiNavInput_COUNT);
|
||||
IM_ASSERT(n >= 0 && n < ImGuiNavInput_COUNT);
|
||||
return names[n];
|
||||
}
|
||||
|
||||
float ImGui::GetNavInputAmount(ImGuiNavInput n, ImGuiInputReadMode mode)
|
||||
{
|
||||
ImGuiContext& g = *GImGui;
|
||||
|
Reference in New Issue
Block a user