| 1034 | } |
| 1035 | |
| 1036 | bool CVarRadioButton(const char* text, const char* cvarName, int32_t id, const RadioButtonsOptions& options) { |
| 1037 | std::string make_invisible = "##" + std::string(text) + std::string(cvarName); |
| 1038 | |
| 1039 | bool ret = false; |
| 1040 | int val = CVarGetInteger(cvarName, options.defaultIndex); |
| 1041 | PushStyleCheckbox(options.color); |
| 1042 | if (ImGui::RadioButton(make_invisible.c_str(), id == val)) { |
| 1043 | CVarSetInteger(cvarName, id); |
| 1044 | Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame(); |
| 1045 | ret = true; |
| 1046 | } |
| 1047 | ImGui::SameLine(); |
| 1048 | ImGui::Text("%s", text); |
| 1049 | PopStyleCheckbox(); |
| 1050 | if (ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenDisabled) && !Ship_IsCStringEmpty(options.tooltip)) { |
| 1051 | ImGui::SetTooltip("%s", WrappedText(options.tooltip).c_str()); |
| 1052 | } |
| 1053 | |
| 1054 | return ret; |
| 1055 | } |
| 1056 | |
| 1057 | void DrawFlagArray32(const std::string& name, uint32_t& flags, Colors color) { |
| 1058 | ImGui::PushID(name.c_str()); |
nothing calls this directly
no test coverage detected