mirror of
https://github.com/raysan5/raygui.git
synced 2026-01-29 02:09:17 -05:00
REVIEWED: GuiCheckBox() #330
return internal-state: 1->Value changed in the control
This commit is contained in:
@ -2189,7 +2189,7 @@ int GuiToggleSlider(Rectangle bounds, const char *text, int *active)
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check Box control, returns true when active
|
// Check Box control, returns 1 when state changed
|
||||||
int GuiCheckBox(Rectangle bounds, const char *text, bool *checked)
|
int GuiCheckBox(Rectangle bounds, const char *text, bool *checked)
|
||||||
{
|
{
|
||||||
int result = 0;
|
int result = 0;
|
||||||
@ -2228,7 +2228,11 @@ int GuiCheckBox(Rectangle bounds, const char *text, bool *checked)
|
|||||||
if (IsMouseButtonDown(MOUSE_LEFT_BUTTON)) state = STATE_PRESSED;
|
if (IsMouseButtonDown(MOUSE_LEFT_BUTTON)) state = STATE_PRESSED;
|
||||||
else state = STATE_FOCUSED;
|
else state = STATE_FOCUSED;
|
||||||
|
|
||||||
if (IsMouseButtonReleased(MOUSE_LEFT_BUTTON)) *checked = !(*checked);
|
if (IsMouseButtonReleased(MOUSE_LEFT_BUTTON))
|
||||||
|
{
|
||||||
|
*checked = !(*checked);
|
||||||
|
result = 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//--------------------------------------------------------------------
|
//--------------------------------------------------------------------
|
||||||
|
|||||||
Reference in New Issue
Block a user