mirror of
https://github.com/ocornut/imgui.git
synced 2024-11-25 14:59:00 +08:00
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:
commit
8e8e59a942
14
imgui.cpp
14
imgui.cpp
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user