From acc19b74b30a8d92225a18441b85de5a61fb413d Mon Sep 17 00:00:00 2001 From: Andidy <37605997+Andidy@users.noreply.github.com> Date: Sun, 7 Nov 2021 03:52:11 -0600 Subject: [PATCH] Fixed bounds check so that out of bounds values don't persist until the next call to GuiValueBox (#165) --- src/raygui.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/raygui.h b/src/raygui.h index da231eb..9bc0132 100644 --- a/src/raygui.h +++ b/src/raygui.h @@ -2184,6 +2184,9 @@ bool GuiValueBox(Rectangle bounds, const char *text, int *value, int minValue, i if (valueHasChanged) *value = TextToInteger(textValue); + if (*value > maxValue) *value = maxValue; + else if (*value < minValue) *value = minValue; + if (IsKeyPressed(KEY_ENTER) || (!CheckCollisionPointRec(mousePoint, bounds) && IsMouseButtonPressed(MOUSE_LEFT_BUTTON))) pressed = true; } else