mirror of
https://github.com/raysan5/raygui.git
synced 2026-01-30 10:49:19 -05:00
REVIEWED: IsMouseButtonPressed() to use define value
This commit is contained in:
13
src/raygui.h
13
src/raygui.h
@ -575,6 +575,7 @@ static bool guiTooltipEnabled = true; // Gui tooltips enabled
|
|||||||
#define KEY_UP 265
|
#define KEY_UP 265
|
||||||
#define KEY_BACKSPACE 259
|
#define KEY_BACKSPACE 259
|
||||||
#define KEY_ENTER 257
|
#define KEY_ENTER 257
|
||||||
|
|
||||||
#define MOUSE_LEFT_BUTTON 0
|
#define MOUSE_LEFT_BUTTON 0
|
||||||
|
|
||||||
// Input required functions
|
// 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
|
// Check text alignment to position cursor properly
|
||||||
int textAlignment = GuiGetStyle(TEXTBOX, TEXT_ALIGNMENT);
|
int textAlignment = GuiGetStyle(TEXTBOX, TEXT_ALIGNMENT);
|
||||||
@ -1636,7 +1637,7 @@ bool GuiTextBox(Rectangle bounds, char *text, int textSize, bool editMode)
|
|||||||
if (CheckCollisionPointRec(mousePoint, bounds))
|
if (CheckCollisionPointRec(mousePoint, bounds))
|
||||||
{
|
{
|
||||||
state = GUI_STATE_FOCUSED;
|
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 (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
|
else
|
||||||
{
|
{
|
||||||
@ -1831,7 +1832,7 @@ bool GuiValueBox(Rectangle bounds, const char *text, int *value, int minValue, i
|
|||||||
if (CheckCollisionPointRec(mousePoint, bounds))
|
if (CheckCollisionPointRec(mousePoint, bounds))
|
||||||
{
|
{
|
||||||
state = GUI_STATE_FOCUSED;
|
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;
|
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
|
// Exit edit mode
|
||||||
if (!CheckCollisionPointRec(mousePoint, bounds) && IsMouseButtonPressed(0)) pressed = true;
|
if (!CheckCollisionPointRec(mousePoint, bounds) && IsMouseButtonPressed(MOUSE_LEFT_BUTTON)) pressed = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (CheckCollisionPointRec(mousePoint, bounds))
|
if (CheckCollisionPointRec(mousePoint, bounds))
|
||||||
{
|
{
|
||||||
state = GUI_STATE_FOCUSED;
|
state = GUI_STATE_FOCUSED;
|
||||||
if (IsMouseButtonPressed(0)) pressed = true;
|
if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON)) pressed = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user