REVIEWED: IsMouseButtonPressed() to use define value

This commit is contained in:
Ray
2020-03-11 16:00:41 +01:00
parent d3c810311c
commit 9d911f7104

View File

@ -575,6 +575,7 @@ static bool guiTooltipEnabled = true; // Gui tooltips enabled
#define KEY_UP 265
#define KEY_BACKSPACE 259
#define KEY_ENTER 257
#define MOUSE_LEFT_BUTTON 0
// Input required functions
@ -1624,7 +1625,7 @@ bool GuiTextBox(Rectangle bounds, char *text, int textSize, bool editMode)
}
}
if (IsKeyPressed(KEY_ENTER) || (!CheckCollisionPointRec(mousePoint, bounds) && IsMouseButtonPressed(0))) pressed = true;
if (IsKeyPressed(KEY_ENTER) || (!CheckCollisionPointRec(mousePoint, bounds) && IsMouseButtonPressed(MOUSE_LEFT_BUTTON))) pressed = true;
// Check text alignment to position cursor properly
int textAlignment = GuiGetStyle(TEXTBOX, TEXT_ALIGNMENT);
@ -1636,7 +1637,7 @@ bool GuiTextBox(Rectangle bounds, char *text, int textSize, bool editMode)
if (CheckCollisionPointRec(mousePoint, bounds))
{
state = GUI_STATE_FOCUSED;
if (IsMouseButtonPressed(0)) pressed = true;
if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON)) pressed = true;
}
}
@ -1821,7 +1822,7 @@ bool GuiValueBox(Rectangle bounds, const char *text, int *value, int minValue, i
if (valueHasChanged) *value = TextToInteger(textValue);
if (IsKeyPressed(KEY_ENTER) || (!CheckCollisionPointRec(mousePoint, bounds) && IsMouseButtonPressed(0))) pressed = true;
if (IsKeyPressed(KEY_ENTER) || (!CheckCollisionPointRec(mousePoint, bounds) && IsMouseButtonPressed(MOUSE_LEFT_BUTTON))) pressed = true;
}
else
{
@ -1831,7 +1832,7 @@ bool GuiValueBox(Rectangle bounds, const char *text, int *value, int minValue, i
if (CheckCollisionPointRec(mousePoint, bounds))
{
state = GUI_STATE_FOCUSED;
if (IsMouseButtonPressed(0)) pressed = true;
if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON)) pressed = true;
}
}
@ -1963,14 +1964,14 @@ bool GuiTextBoxMulti(Rectangle bounds, char *text, int textSize, bool editMode)
cursor.y = bounds.y + GuiGetStyle(TEXTBOX, BORDER_WIDTH) + GuiGetStyle(TEXTBOX, TEXT_INNER_PADDING)/2 + ((GuiGetStyle(DEFAULT, TEXT_SIZE) + GuiGetStyle(TEXTBOX, TEXT_INNER_PADDING))*currentLine) + 2;
// Exit edit mode
if (!CheckCollisionPointRec(mousePoint, bounds) && IsMouseButtonPressed(0)) pressed = true;
if (!CheckCollisionPointRec(mousePoint, bounds) && IsMouseButtonPressed(MOUSE_LEFT_BUTTON)) pressed = true;
}
else
{
if (CheckCollisionPointRec(mousePoint, bounds))
{
state = GUI_STATE_FOCUSED;
if (IsMouseButtonPressed(0)) pressed = true;
if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON)) pressed = true;
}
}