MCPcopy Create free account
hub / github.com/JRickey/BattleShip / CVarRadioButton

Function CVarRadioButton

port/gui/UIWidgets.cpp:1036–1055  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1034}
1035
1036bool 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
1057void DrawFlagArray32(const std::string& name, uint32_t& flags, Colors color) {
1058 ImGui::PushID(name.c_str());

Callers

nothing calls this directly

Calls 5

PushStyleCheckboxFunction · 0.85
RadioButtonFunction · 0.85
PopStyleCheckboxFunction · 0.85
Ship_IsCStringEmptyFunction · 0.85
WrappedTextFunction · 0.85

Tested by

no test coverage detected