imgui debugger: Make the repeat button capable of returning values > 1

(for very fast repeats, but the caller must support it)

Also just increase the repeat rates in the ge debugger
This commit is contained in:
Henrik Rydgård committed 2026-01-22 13:47:14 +01:00
1 parent f12472aede
commit 026ea6e197
3 files changed
+12 -8

No files matched your search

+6 -4
View File
@@ -1028,19 +1028,21 @@ void ImGeDebuggerWindow::Draw(ImConfig &cfg, ImControl &control, GPUDebugInterfa
bool disableStepButtons = gpuDebug->GetBreakNext() != GPUDebug::BreakNext::NONE && gpuDebug->GetBreakNext() != GPUDebug::BreakNext::DEBUG_RUN;
constexpr float fastRepeatRate = 0.025f;
if (disableStepButtons) {
ImGui::BeginDisabled();
}
ImGui::SameLine();
if (ImGui::RepeatButtonShift("Tex")) {
if (ImGui::RepeatButtonShift("Tex", fastRepeatRate)) {
gpuDebug->SetBreakNext(GPUDebug::BreakNext::TEX);
}
ImGui::SameLine();
if (ImGui::RepeatButtonShift("Prim")) {
if (ImGui::RepeatButtonShift("Prim", fastRepeatRate)) {
gpuDebug->SetBreakNext(GPUDebug::BreakNext::PRIM);
}
ImGui::SameLine();
if (ImGui::RepeatButtonShift("Draw")) {
if (ImGui::RepeatButtonShift("Draw", fastRepeatRate)) {
gpuDebug->SetBreakNext(GPUDebug::BreakNext::DRAW);
}
ImGui::SameLine();
@@ -1052,7 +1054,7 @@ void ImGeDebuggerWindow::Draw(ImConfig &cfg, ImControl &control, GPUDebugInterfa
gpuDebug->SetBreakNext(GPUDebug::BreakNext::CURVE);
}
ImGui::SameLine();
if (ImGui::RepeatButtonShift("Single step")) {
if (ImGui::RepeatButtonShift("Single step", fastRepeatRate)) {
gpuDebug->SetBreakNext(GPUDebug::BreakNext::OP);
}
if (disableStepButtons) {
+5 -3
View File
@@ -17,10 +17,11 @@ bool RepeatButton(const char *title) {
return false;
}
bool RepeatButtonShift(const char* label, float repeatRate) {
int RepeatButtonShift(const char* label, float repeatRate) {
bool clicked = ImGui::Button(label);
bool shiftHeld = ImGui::IsKeyDown(ImGuiKey_LeftShift) || ImGui::IsKeyDown(ImGuiKey_RightShift);
bool ctrlHeld = ImGui::IsKeyDown(ImGuiKey_LeftCtrl) || ImGui::IsKeyDown(ImGuiKey_RightCtrl);
bool held = ImGui::IsItemActive() && shiftHeld;
static float repeatDelay = 0.25f; // seconds before repeating starts
@@ -39,8 +40,9 @@ bool RepeatButtonShift(const char* label, float repeatRate) {
int steps = static_cast<int>(t / repeatRate);
static int lastStep = -1;
if (steps != lastStep) {
int count = steps - lastStep;
lastStep = steps;
return true;
return count;
}
}
}
@@ -52,7 +54,7 @@ bool RepeatButtonShift(const char* label, float repeatRate) {
}
}
return clicked;
return clicked ? 1 : 0;
}
bool CollapsingHeaderWithCount(const char *title, int count, ImGuiTreeNodeFlags flags) {
+1 -1
View File
@@ -10,7 +10,7 @@ inline void TextUnformatted(std::string_view str) {
}
bool RepeatButton(const char *title);
bool RepeatButtonShift(const char* label, float repeatRate = 0.05f);
int RepeatButtonShift(const char* label, float repeatRate = 0.05f);
bool CollapsingHeaderWithCount(const char *title, int count, ImGuiTreeNodeFlags flags = 0);