2
0
Эх сурвалжийг харах

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

Andidy 3 жил өмнө
parent
commit
acc19b74b3
1 өөрчлөгдсөн 3 нэмэгдсэн , 0 устгасан
  1. 3 0
      src/raygui.h

+ 3 - 0
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