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

Function DrawFlagArray8Mask

port/gui/UIWidgets.cpp:1135–1159  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1133}
1134
1135void DrawFlagArray8Mask(const std::string& name, uint8_t& flags, Colors color) {
1136 ImGui::PushID(name.c_str());
1137 for (int8_t flagIndex = 0; flagIndex < 8; flagIndex++) {
1138 if ((flagIndex % 8) != 0) {
1139 ImGui::SameLine();
1140 }
1141 ImGui::PushID(flagIndex);
1142 uint8_t bitMask = 1 << flagIndex;
1143 bool flag = (flags & bitMask) != 0;
1144 PushStyleCheckbox(color);
1145 ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(4.0f, 3.0f));
1146 std::string id = fmt::format("##{}{}", name, flagIndex);
1147 if (ImGui::Checkbox(id.c_str(), &flag)) {
1148 if (flag) {
1149 flags |= bitMask;
1150 } else {
1151 flags &= ~bitMask;
1152 }
1153 }
1154 ImGui::PopStyleVar();
1155 PopStyleCheckbox();
1156 ImGui::PopID();
1157 }
1158 ImGui::PopID();
1159}
1160
1161std::map<std::string, int32_t> buttonMap = {
1162 { "A", BTN_A },

Callers

nothing calls this directly

Calls 3

PushStyleCheckboxFunction · 0.85
CheckboxFunction · 0.85
PopStyleCheckboxFunction · 0.85

Tested by

no test coverage detected