Fixed bounds check so that out of bounds values don't persist until the next call to GuiValueBox (#165)

This commit is contained in:
Andidy 2021-11-07 03:52:11 -06:00 committed by GitHub
parent 65a82bfe54
commit acc19b74b3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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