MCPcopy Create free account
hub / github.com/cinder/Cinder / GetKeyPressedAmount

Method GetKeyPressedAmount

src/imgui/imgui.cpp:9330–9338  ·  view source on GitHub ↗

Return value representing the number of presses in the last time period, for the given repeat rate (most often returns 0 or 1. The result is generally only >1 when RepeatRate is smaller than DeltaTime, aka large DeltaTime or fast RepeatRate)

Source from the content-addressed store, hash-verified

9328// Return value representing the number of presses in the last time period, for the given repeat rate
9329// (most often returns 0 or 1. The result is generally only >1 when RepeatRate is smaller than DeltaTime, aka large DeltaTime or fast RepeatRate)
9330int ImGui::GetKeyPressedAmount(ImGuiKey key, float repeat_delay, float repeat_rate)
9331{
9332 ImGuiContext& g = *GImGui;
9333 const ImGuiKeyData* key_data = GetKeyData(key);
9334 if (!key_data->Down) // In theory this should already be encoded as (DownDuration < 0.0f), but testing this facilitates eating mechanism (until we finish work on key ownership)
9335 return 0;
9336 const float t = key_data->DownDuration;
9337 return CalcTypematicRepeatAmount(t - g.IO.DeltaTime, t, repeat_delay, repeat_rate);
9338}
9339
9340// Return 2D vector representing the combination of four cardinal direction, with analog value support (for e.g. ImGuiKey_GamepadLStick* values).
9341ImVec2 ImGui::GetKeyMagnitude2d(ImGuiKey key_left, ImGuiKey key_right, ImGuiKey key_up, ImGuiKey key_down)

Callers

nothing calls this directly

Calls 1

GetKeyDataFunction · 0.85

Tested by

no test coverage detected