Explorar el Código

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

Andidy hace 3 años
padre
commit
acc19b74b3
Se han modificado 1 ficheros con 3 adiciones y 0 borrados
  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