mirror of
https://github.com/Drezil/imgui.git
synced 2024-11-15 01:17:00 +00: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 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);
|
bool pressed = ImGui::Checkbox(label, &v);
|
||||||
if (v)
|
if (pressed)
|
||||||
*flags |= flags_value;
|
{
|
||||||
else
|
if (v)
|
||||||
*flags &= ~flags_value;
|
*flags |= flags_value;
|
||||||
|
else
|
||||||
|
*flags &= ~flags_value;
|
||||||
|
}
|
||||||
|
|
||||||
return pressed;
|
return pressed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user