summaryrefslogtreecommitdiff
path: root/src/ui_elements/Button.c
diff options
context:
space:
mode:
authorphysick <mynameisgennadiy@vk.com>2026-07-31 18:36:22 +0500
committerphysick <mynameisgennadiy@vk.com>2026-07-31 18:36:22 +0500
commit722a9d1e729aff2eb64f3c064c33d547ea980eb0 (patch)
treefb03a4f5bf76d1274565ef261e7f2e3a579a0823 /src/ui_elements/Button.c
parente20b4c3a5dfe081fa2d6d772617307fae4689698 (diff)
Buttons GUI start
Diffstat (limited to 'src/ui_elements/Button.c')
-rw-r--r--src/ui_elements/Button.c17
1 files changed, 17 insertions, 0 deletions
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 <raylib.h>
+
+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);
+}