Kaynağa Gözat

Review some logic

Ray 5 yıl önce
ebeveyn
işleme
1cc900bff9
1 değiştirilmiş dosya ile 11 ekleme ve 6 silme
  1. 11 6
      src/gui_textbox_extended.h

+ 11 - 6
src/gui_textbox_extended.h

@@ -766,15 +766,11 @@ RAYGUIDEF bool GuiTextBoxEx(Rectangle bounds, char *text, int textSize, bool edi
                 else selStart = selStart - guiTextBoxState.start;
             }
             else state = GUI_STATE_FOCUSED;
+            
+            if (IsKeyPressed(KEY_ENTER) || (!CheckCollisionPointRec(mousePoint, bounds) && IsMouseButtonPressed(0))) pressed = true;
         }
         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 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.start = start;
             }
+            
+            if (CheckCollisionPointRec(mousePoint, bounds))
+            {
+                state = GUI_STATE_FOCUSED;
+                if (IsMouseButtonPressed(0)) pressed = true;
+            }
+
         }
+        
+        if (pressed) framesCounter = 0;
     }
 
     // Draw control