From 722a9d1e729aff2eb64f3c064c33d547ea980eb0 Mon Sep 17 00:00:00 2001 From: physick Date: Fri, 31 Jul 2026 18:36:22 +0500 Subject: Buttons GUI start --- src/ui_elements/Button.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 src/ui_elements/Button.c (limited to 'src/ui_elements/Button.c') diff --git a/src/ui_elements/Button.c b/src/ui_elements/Button.c new file mode 100644 index 0000000..f3ab8fa --- /dev/null +++ b/src/ui_elements/Button.c @@ -0,0 +1,17 @@ +#include "UI.h" +#include + +void UpdateButton(Button *btn, Rectangle *location) { + if (IsMouseInRec(*location) && IsMouseButtonPressed(MOUSE_BUTTON_LEFT)) { + btn->OnClick(btn->parent); + } +} + +void DrawButton(Button *btn, Rectangle *location) { + DrawTexturePro(*btn->atlas, + btn->textrueLocation, + *location, + (Vector2) { 0 , 0 }, + 0, + WHITE); +} -- cgit v1.3