Support keypad Enter key with GuiValueBox and GuiValueBoxFloat. (#413)

This commit is contained in:
Mitchell Davis
2024-07-16 12:33:59 -07:00
committed by GitHub
parent 3fb9d77a67
commit 187dd8647f

View File

@ -2903,7 +2903,7 @@ int GuiValueBox(Rectangle bounds, const char *text, int *value, int minValue, in
//if (*value > maxValue) *value = maxValue;
//else if (*value < minValue) *value = minValue;
if (IsKeyPressed(KEY_ENTER) || (!CheckCollisionPointRec(mousePoint, bounds) && IsMouseButtonPressed(MOUSE_LEFT_BUTTON)))
if ((IsKeyPressed(KEY_ENTER) || IsKeyPressed(KEY_KP_ENTER)) || (!CheckCollisionPointRec(mousePoint, bounds) && IsMouseButtonPressed(MOUSE_LEFT_BUTTON)))
{
if (*value > maxValue) *value = maxValue;
else if (*value < minValue) *value = minValue;
@ -3019,7 +3019,7 @@ int GuiValueBoxFloat(Rectangle bounds, const char *text, char *textValue, float
if (valueHasChanged) *value = TextToFloat(textValue);
if (IsKeyPressed(KEY_ENTER) || (!CheckCollisionPointRec(mousePoint, bounds) && IsMouseButtonPressed(MOUSE_LEFT_BUTTON))) result = 1;
if ((IsKeyPressed(KEY_ENTER) || IsKeyPressed(KEY_KP_ENTER)) || (!CheckCollisionPointRec(mousePoint, bounds) && IsMouseButtonPressed(MOUSE_LEFT_BUTTON))) result = 1;
}
else
{