瀏覽代碼

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

Andidy 3 年之前
父節點
當前提交
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