mirror of
https://github.com/HarbourMasters/Shipwright
synced 2026-08-17 05:41:46 -04:00
Actor view values now using pointers rather than copies, add playerState flags to save editor (#2388)
This commit is contained in:
@@ -663,4 +663,67 @@ namespace UIWidgets {
|
||||
|
||||
return changed;
|
||||
}
|
||||
|
||||
void DrawFlagArray32(const std::string& name, uint32_t& flags) {
|
||||
ImGui::PushID(name.c_str());
|
||||
for (int32_t flagIndex = 0; flagIndex < 32; flagIndex++) {
|
||||
if ((flagIndex % 8) != 0) {
|
||||
ImGui::SameLine();
|
||||
}
|
||||
ImGui::PushID(flagIndex);
|
||||
uint32_t bitMask = 1 << flagIndex;
|
||||
bool flag = (flags & bitMask) != 0;
|
||||
if (ImGui::Checkbox("##check", &flag)) {
|
||||
if (flag) {
|
||||
flags |= bitMask;
|
||||
} else {
|
||||
flags &= ~bitMask;
|
||||
}
|
||||
}
|
||||
ImGui::PopID();
|
||||
}
|
||||
ImGui::PopID();
|
||||
}
|
||||
|
||||
void DrawFlagArray16(const std::string& name, uint16_t& flags) {
|
||||
ImGui::PushID(name.c_str());
|
||||
for (int16_t flagIndex = 0; flagIndex < 16; flagIndex++) {
|
||||
if ((flagIndex % 8) != 0) {
|
||||
ImGui::SameLine();
|
||||
}
|
||||
ImGui::PushID(flagIndex);
|
||||
uint16_t bitMask = 1 << flagIndex;
|
||||
bool flag = (flags & bitMask) != 0;
|
||||
if (ImGui::Checkbox("##check", &flag)) {
|
||||
if (flag) {
|
||||
flags |= bitMask;
|
||||
} else {
|
||||
flags &= ~bitMask;
|
||||
}
|
||||
}
|
||||
ImGui::PopID();
|
||||
}
|
||||
ImGui::PopID();
|
||||
}
|
||||
|
||||
void DrawFlagArray8(const std::string& name, uint8_t& flags) {
|
||||
ImGui::PushID(name.c_str());
|
||||
for (int8_t flagIndex = 0; flagIndex < 8; flagIndex++) {
|
||||
if ((flagIndex % 8) != 0) {
|
||||
ImGui::SameLine();
|
||||
}
|
||||
ImGui::PushID(flagIndex);
|
||||
uint8_t bitMask = 1 << flagIndex;
|
||||
bool flag = (flags & bitMask) != 0;
|
||||
if (ImGui::Checkbox("##check", &flag)) {
|
||||
if (flag) {
|
||||
flags |= bitMask;
|
||||
} else {
|
||||
flags &= ~bitMask;
|
||||
}
|
||||
}
|
||||
ImGui::PopID();
|
||||
}
|
||||
ImGui::PopID();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user