From dbb75f37b059a03e5f4b466e6d85be34360f019b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sergio=20Mart=C3=ADnez?= Date: Wed, 24 Oct 2018 12:51:14 +0200 Subject: [PATCH] GuiDropdownBox usage changed --- src/raygui.h | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/raygui.h b/src/raygui.h index a19dd9f..8547608 100644 --- a/src/raygui.h +++ b/src/raygui.h @@ -1701,15 +1701,16 @@ RAYGUIDEF bool GuiDropdownBox(Rectangle bounds, const char **text, int count, in if (CheckCollisionPointRec(mousePoint, closeBounds)) { if (IsMouseButtonDown(MOUSE_LEFT_BUTTON)) state = PRESSED; - else if (IsMouseButtonReleased(MOUSE_LEFT_BUTTON)) pressed = true; + + if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON)) pressed = true; else state = FOCUSED; } } else { - if (CheckCollisionPointRec(mousePoint, openBounds)) + if (CheckCollisionPointRec(mousePoint, closeBounds)) { - if (IsMouseButtonReleased(MOUSE_LEFT_BUTTON)) pressed = true; + if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON)) pressed = true; } else if (!CheckCollisionPointRec(mousePoint, openBounds)) @@ -1760,7 +1761,11 @@ RAYGUIDEF bool GuiDropdownBox(Rectangle bounds, const char **text, int count, in } else { - if (GuiListElement((Rectangle){ bounds.x, bounds.y + bounds.height*(i+1) + DROPDOWNBOX_PADDING, bounds.width, bounds.height - DROPDOWNBOX_PADDING }, text[i], false, true)) auxActive = i; + if (GuiListElement((Rectangle){ bounds.x, bounds.y + bounds.height*(i+1) + DROPDOWNBOX_PADDING, bounds.width, bounds.height - DROPDOWNBOX_PADDING }, text[i], false, true)) + { + auxActive = i; + pressed = true; + } } } }