MCPcopy Create free account
hub / github.com/TheForceEngine/TheForceEngine / GetKeyChordName

Method GetKeyChordName

TheForceEngine/TFE_Ui/imGUI/imgui.cpp:8529–8547  ·  view source on GitHub ↗

Return untranslated names: on macOS, Cmd key will show as Ctrl, Ctrl key will show as super. Lifetime of return value: valid until next call to same function.

Source from the content-addressed store, hash-verified

8527// Return untranslated names: on macOS, Cmd key will show as Ctrl, Ctrl key will show as super.
8528// Lifetime of return value: valid until next call to same function.
8529const char* ImGui::GetKeyChordName(ImGuiKeyChord key_chord)
8530{
8531 ImGuiContext& g = *GImGui;
8532
8533 const ImGuiKey key = (ImGuiKey)(key_chord & ~ImGuiMod_Mask_);
8534 if (IsModKey(key))
8535 key_chord &= ~GetModForModKey(key); // Return "Ctrl+LeftShift" instead of "Ctrl+Shift+LeftShift"
8536 ImFormatString(g.TempKeychordName, IM_ARRAYSIZE(g.TempKeychordName), "%s%s%s%s%s",
8537 (key_chord & ImGuiMod_Ctrl) ? "Ctrl+" : "",
8538 (key_chord & ImGuiMod_Shift) ? "Shift+" : "",
8539 (key_chord & ImGuiMod_Alt) ? "Alt+" : "",
8540 (key_chord & ImGuiMod_Super) ? "Super+" : "",
8541 (key != ImGuiKey_None || key_chord == ImGuiKey_None) ? GetKeyName(key) : "");
8542 size_t len;
8543 if (key == ImGuiKey_None && key_chord != 0)
8544 if ((len = strlen(g.TempKeychordName)) != 0) // Remove trailing '+'
8545 g.TempKeychordName[len - 1] = 0;
8546 return g.TempKeychordName;
8547}
8548
8549// t0 = previous time (e.g.: g.Time - g.IO.DeltaTime)
8550// t1 = current time (e.g.: g.Time)

Callers

nothing calls this directly

Calls 3

IsModKeyFunction · 0.85
GetModForModKeyFunction · 0.85
ImFormatStringFunction · 0.85

Tested by

no test coverage detected