Make the ImDebugger a bit less crash prone outside of games

This commit is contained in:
Henrik Rydgård committed 2026-08-07 22:40:05 +02:00
1 parent b4c476d5ed
commit 8d2c1e7a66
5 files changed
+258 -223

No files matched your search

+22
View File
@@ -63,4 +63,26 @@ bool CollapsingHeaderWithCount(const char *title, int count, ImGuiTreeNodeFlags
return ImGui::CollapsingHeader(temp, flags);
}
bool CheckboxInverted(const char* label, bool* v) {
bool value = !(*v);
if (ImGui::Checkbox(label, &value)) {
*v = !value;
return true;
}
return false;
}
bool MenuItemInverted(const char* label, const char* shortcut, bool* p_selected, bool enabled) {
if (p_selected) {
bool value = !(*p_selected);
if (ImGui::MenuItem(label, shortcut, &value, enabled)) {
*p_selected = !value;
return true;
}
} else {
return ImGui::MenuItem(label, shortcut, nullptr, enabled);
}
return false;
}
} // namespace ImGui
+3 -1
View File
@@ -10,8 +10,10 @@ inline void TextUnformatted(std::string_view str) {
}
bool RepeatButton(const char *title);
int 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);
bool CheckboxInverted(const char *label, bool *v);
bool MenuItemInverted(const char* label, const char* shortcut = nullptr, bool* p_selected = nullptr, bool enabled = true);
} // namespace ImGui