Merge pull request #555 from DMartinek/patch-1

CheckboxFlags: Added support for passing/testing multiple flags at the same time.
This commit is contained in:
omar 2016-03-21 13:09:55 -07:00
commit 8e8e59a942

View File

@ -6905,12 +6905,16 @@ bool ImGui::Checkbox(const char* label, bool* v)
bool ImGui::CheckboxFlags(const char* label, unsigned int* flags, unsigned int flags_value)
{
bool v = (*flags & flags_value) ? true : false;
bool v = ((*flags & flags_value) == flags_value);
bool pressed = ImGui::Checkbox(label, &v);
if (v)
*flags |= flags_value;
else
*flags &= ~flags_value;
if (pressed)
{
if (v)
*flags |= flags_value;
else
*flags &= ~flags_value;
}
return pressed;
}