Review some logic

This commit is contained in:
Ray
2019-11-25 19:41:15 +01:00
parent a2c5ffc272
commit 1cc900bff9

View File

@ -766,15 +766,11 @@ RAYGUIDEF bool GuiTextBoxEx(Rectangle bounds, char *text, int textSize, bool edi
else selStart = selStart - guiTextBoxState.start; else selStart = selStart - guiTextBoxState.start;
} }
else state = GUI_STATE_FOCUSED; else state = GUI_STATE_FOCUSED;
if (IsKeyPressed(KEY_ENTER) || (!CheckCollisionPointRec(mousePoint, bounds) && IsMouseButtonPressed(0))) pressed = true;
} }
else else
{ {
if (CheckCollisionPointRec(mousePoint, bounds))
{
state = GUI_STATE_FOCUSED;
if (IsMouseButtonPressed(0)) pressed = true;
}
if (active && IsKeyDown(KEY_LEFT_CONTROL) && IsKeyPressed(KEY_C)) if (active && IsKeyDown(KEY_LEFT_CONTROL) && IsKeyPressed(KEY_C))
{ {
// If active copy all text to clipboard even when disabled // If active copy all text to clipboard even when disabled
@ -797,7 +793,16 @@ RAYGUIDEF bool GuiTextBoxEx(Rectangle bounds, char *text, int textSize, bool edi
guiTextBoxState.cursor = cursor; guiTextBoxState.cursor = cursor;
guiTextBoxState.start = start; guiTextBoxState.start = start;
} }
if (CheckCollisionPointRec(mousePoint, bounds))
{
state = GUI_STATE_FOCUSED;
if (IsMouseButtonPressed(0)) pressed = true;
}
} }
if (pressed) framesCounter = 0;
} }
// Draw control // Draw control