overlay: help tooltip updates (#279)

## Link to GitHub Issue, if one exists
n/a

## Description of change

In Options (and in Advanced/API/Search tabs), remove the help marker
`(?)` and instead add a tooltip to the option name label and the control
widgets like the checkbox, text input, and combo. This is to help with
discoverability as many users failed to discover the `(?)` widget.

Similarly, update the Patches tab to remove `(?)` and add tooltips to
widgets. Patches with warnings `(!)` will continue to show it to
distinguish it from other patches.

Update styling for the tooltip (dark red background -> dark gray) so
that it stands out from other widgets.

Remove the purple option text used for game-specific options.

## Compiling
👍 

## Testing
Tested in spicecfg, and in-game overlay.
This commit is contained in:
bicarus-dev
2025-03-28 20:34:58 -07:00
committed by GitHub
parent 104a9cbffd
commit 4f1ada7a2f
5 changed files with 97 additions and 35 deletions
+27 -10
View File
@@ -649,17 +649,9 @@ namespace overlay::windows {
// first column, part 1: help / caution marker
ImGui::TableNextColumn();
const std::string description = patch.description;
const std::string caution = patch.caution;
if (!description.empty() && !caution.empty()) {
if (!patch.caution.empty()) {
ImGui::AlignTextToFramePadding();
ImGui::WarnMarker(description.c_str(), caution.c_str());
} else if (!description.empty()) {
ImGui::AlignTextToFramePadding();
ImGui::HelpMarker(description.c_str());
} else if (!caution.empty()) {
ImGui::AlignTextToFramePadding();
ImGui::WarnMarker(nullptr, caution.c_str());
ImGui::WarnMarker(nullptr, patch.caution.c_str());
} else {
ImGui::DummyMarker();
}
@@ -705,6 +697,11 @@ namespace overlay::windows {
if (style_color_pushed) {
ImGui::PopStyleColor(style_color_pushed);
}
if (ImGui::IsItemHovered()) {
show_patch_tooltip(patch);
}
// show range after label for integer patches
if (patch.type == PatchType::Integer) {
ImGui::SameLine();
auto& numpatch = patch.patch_number;
@@ -741,6 +738,9 @@ namespace overlay::windows {
patch.last_status = is_patch_active(patch);
}
ImGui::EndDisabled();
if (ImGui::IsItemHovered()) {
show_patch_tooltip(patch);
}
// second column, part 2: additional options UI (dropdown, text input)
ImGui::SameLine();
@@ -767,6 +767,9 @@ namespace overlay::windows {
}
ImGui::EndCombo();
}
if (ImGui::IsItemHovered()) {
show_patch_tooltip(patch);
}
} else if (patch.type == PatchType::Integer) {
ImGui::SetNextItemWidth(200.0f);
auto& numpatch = patch.patch_number;
@@ -780,6 +783,9 @@ namespace overlay::windows {
apply_patch(patch, true);
config_dirty = true;
}
if (ImGui::IsItemHovered()) {
show_patch_tooltip(patch);
}
}
} else if (patch_status == PatchStatus::Disabled) {
ImGui::SetNextItemWidth(200.0f);
@@ -794,6 +800,9 @@ namespace overlay::windows {
ImGui::InputInt("##dummy_int_input", &patch.patch_number.value);
}
ImGui::EndDisabled();
if (ImGui::IsItemHovered()) {
show_patch_tooltip(patch);
}
}
} else {
ImGui::AlignTextToFramePadding();
@@ -822,6 +831,14 @@ namespace overlay::windows {
}
}
void PatchManager::show_patch_tooltip(const PatchData& patch) {
if (!patch.caution.empty()) {
ImGui::WarnTooltip(patch.description.c_str(), patch.caution.c_str());
} else if (!patch.description.empty()) {
ImGui::HelpTooltip(patch.description.c_str());
}
}
void PatchManager::hard_apply_patches() {
std::vector<std::string> written_list;
for (auto& patch : patches) {