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)
| 10132 | // Return value representing the number of presses in the last time period, for the given repeat rate |
| 10133 | // (most often returns 0 or 1. The result is generally only >1 when RepeatRate is smaller than DeltaTime, aka large DeltaTime or fast RepeatRate) |
| 10134 | int ImGui::GetKeyPressedAmount(ImGuiKey key, float repeat_delay, float repeat_rate) |
| 10135 | { |
| 10136 | ImGuiContext& g = *GImGui; |
| 10137 | const ImGuiKeyData* key_data = GetKeyData(key); |
| 10138 | 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) |
| 10139 | return 0; |
| 10140 | const float t = key_data->DownDuration; |
| 10141 | return CalcTypematicRepeatAmount(t - g.IO.DeltaTime, t, repeat_delay, repeat_rate); |
| 10142 | } |
| 10143 | |
| 10144 | // Return 2D vector representing the combination of four cardinal direction, with analog value support (for e.g. ImGuiKey_GamepadLStick* values). |
| 10145 | ImVec2 ImGui::GetKeyMagnitude2d(ImGuiKey key_left, ImGuiKey key_right, ImGuiKey key_up, ImGuiKey key_down) |
nothing calls this directly
no test coverage detected