aboutsummaryrefslogtreecommitdiff
path: root/src/saffron_button.c
diff options
context:
space:
mode:
authorArslaan Pathan <[email protected]>2026-04-30 13:06:18 +1200
committerArslaan Pathan <[email protected]>2026-04-30 13:06:18 +1200
commit2cc161aabfe5c1343ca504b79a6a1c7706048a91 (patch)
treea5afba4165244b40f61f06d1919334b2dcbab217 /src/saffron_button.c
parent6bd14230b3ed93e7eeab55d957db685c63a65069 (diff)
downloadsaffron-2cc161aabfe5c1343ca504b79a6a1c7706048a91.tar.xz
saffron-2cc161aabfe5c1343ca504b79a6a1c7706048a91.zip
Start work on button implementation(s)
Diffstat (limited to 'src/saffron_button.c')
-rw-r--r--src/saffron_button.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/saffron_button.c b/src/saffron_button.c
new file mode 100644
index 0000000..f0cf77e
--- /dev/null
+++ b/src/saffron_button.c
@@ -0,0 +1,21 @@
+#include <SDL3/SDL.h>
+#include <stdlib.h>
+#include <saffron.h>
+
+static void saffron_button_draw(SaffronWidget* widget, SDL_Renderer* renderer) {
+ // do stuff here
+}
+
+SaffronButton* saffron_button_new(bool enabled, void (*callback)(SaffronButton* self), int width, int height) {
+ SaffronButton* button = malloc(sizeof(SaffronButton));
+ saffron_widget_init((SaffronWidget*)button);
+
+ ((SaffronWidget*)button)->type = SAFFRON_WIDGET_BUTTON;
+ ((SaffronWidget*)button)->draw = saffron_button_draw;
+
+ button->callback = callback;
+ button->enabled = enabled;
+ button->base = *saffron_box_new(SAFFRON_ORIENTATION_HORIZONTAL, SAFFRON_HALIGN_CENTER, SAFFRON_VALIGN_CENTER, 5, 5, 0, width, height);
+
+ return button;
+}