From 56f152cf57e0bd3491be74195905b863519d9fca Mon Sep 17 00:00:00 2001 From: Physick <96335032+DegustatorPonos@users.noreply.github.com> Date: Mon, 3 Aug 2026 00:46:21 +0500 Subject: memory leak issues + qol stull --- src/ui_elements/Button.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/ui_elements/Button.c') diff --git a/src/ui_elements/Button.c b/src/ui_elements/Button.c index f3ab8fa..e7293c8 100644 --- a/src/ui_elements/Button.c +++ b/src/ui_elements/Button.c @@ -1,8 +1,8 @@ #include "UI.h" #include -void UpdateButton(Button *btn, Rectangle *location) { - if (IsMouseInRec(*location) && IsMouseButtonPressed(MOUSE_BUTTON_LEFT)) { +void UpdateButton(Button *btn) { + if (IsMouseInRec(btn->previousFramePosition) && IsMouseButtonPressed(MOUSE_BUTTON_LEFT)) { btn->OnClick(btn->parent); } } @@ -14,4 +14,5 @@ void DrawButton(Button *btn, Rectangle *location) { (Vector2) { 0 , 0 }, 0, WHITE); + btn->previousFramePosition = *location; } -- cgit v1.3