From 1c3305031d2dcab2fbd3c7d7ded8b7aee1738908 Mon Sep 17 00:00:00 2001 From: Ray Date: Tue, 12 Sep 2023 14:42:05 +0200 Subject: [PATCH] REVIEWED: `GuiCheckBox()` #330 return internal-state: 1->Value changed in the control --- src/raygui.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/raygui.h b/src/raygui.h index c1ea5df..26d6bac 100644 --- a/src/raygui.h +++ b/src/raygui.h @@ -2189,7 +2189,7 @@ int GuiToggleSlider(Rectangle bounds, const char *text, int *active) 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 result = 0; @@ -2228,7 +2228,11 @@ int GuiCheckBox(Rectangle bounds, const char *text, bool *checked) if (IsMouseButtonDown(MOUSE_LEFT_BUTTON)) state = STATE_PRESSED; else state = STATE_FOCUSED; - if (IsMouseButtonReleased(MOUSE_LEFT_BUTTON)) *checked = !(*checked); + if (IsMouseButtonReleased(MOUSE_LEFT_BUTTON)) + { + *checked = !(*checked); + result = 1; + } } } //--------------------------------------------------------------------